mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 06:37:38 +03:00
feat(epub): add PNG support
This commit is contained in:
parent
55f8e67002
commit
b6671e5ace
@ -1,11 +1,10 @@
|
||||
#include "Page.h"
|
||||
|
||||
#include <GfxRenderer.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <SDCardManager.h>
|
||||
#include <Serialization.h>
|
||||
|
||||
#include <GfxRenderer.h>
|
||||
|
||||
namespace {
|
||||
constexpr uint16_t MAX_PATH_LEN = 512;
|
||||
} // namespace
|
||||
@ -43,8 +42,7 @@ void PageImage::render(GfxRenderer& renderer, const int fontId, const int xOffse
|
||||
Bitmap bitmap(file, true);
|
||||
const auto err = bitmap.parseHeaders();
|
||||
if (err != BmpReaderError::Ok) {
|
||||
Serial.printf("[%lu] [PGE] Failed to parse bitmap %s: %s\n", millis(), bmpPath.c_str(),
|
||||
Bitmap::errorToString(err));
|
||||
Serial.printf("[%lu] [PGE] Failed to parse bitmap %s: %s\n", millis(), bmpPath.c_str(), Bitmap::errorToString(err));
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#include "ChapterHtmlSlimParser.h"
|
||||
|
||||
#include "../../Epub.h"
|
||||
|
||||
#include <FsHelpers.h>
|
||||
#include <GfxRenderer.h>
|
||||
#include <HardwareSerial.h>
|
||||
@ -10,6 +8,7 @@
|
||||
#include <ZipFile.h>
|
||||
#include <expat.h>
|
||||
|
||||
#include "../../Epub.h"
|
||||
#include "../Page.h"
|
||||
|
||||
const char* HEADER_TAGS[] = {"h1", "h2", "h3", "h4", "h5", "h6"};
|
||||
@ -175,8 +174,7 @@ bool ChapterHtmlSlimParser::generateImageBmp(const std::string& imageHref, std::
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool success =
|
||||
JpegToBmpConverter::jpegFileToBmpStreamWithSize(jpgFile, bmpFile, viewportWidth, viewportHeight);
|
||||
const bool success = JpegToBmpConverter::jpegFileToBmpStreamWithSize(jpgFile, bmpFile, viewportWidth, viewportHeight);
|
||||
jpgFile.close();
|
||||
bmpFile.close();
|
||||
SdMan.remove(tmpJpgPath.c_str());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user