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