Xteink-X4-crosspoint-reader/src/activities/reader/ReaderActivity.h
Eunchurn Park 810066d4f2
feat(xtc): add XTC ebook format support
Add support for XTC (XTeink X4 native) ebook format with pre-rendered
bitmap pages. Key changes:

- Add Xtc library with XtcParser for reading XTC files
- XTC format: 22-byte XTG page headers with 480x800 1-bit bitmaps
- XtcReaderActivity for displaying XTC pages on e-ink display
- Correct bit polarity: 0=black, 1=white in XTC format
- FileSelectionActivity: detect and handle .xtc files
- ReaderActivity: route to XtcReaderActivity for XTC files
- Cover BMP generation from first XTC page

XTC pages include pre-rendered status bar with page numbers and
progress, so no additional overlay is needed.
2025-12-27 19:14:07 +09:00

31 lines
1.1 KiB
C++

#pragma once
#include <memory>
#include "../ActivityWithSubactivity.h"
class Epub;
class Xtc;
class ReaderActivity final : public ActivityWithSubactivity {
std::string initialBookPath;
std::string currentBookPath; // Track current book path for navigation
const std::function<void()> onGoBack;
static std::unique_ptr<Epub> loadEpub(const std::string& path);
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
static bool isXtcFile(const std::string& path);
static std::string extractFolderPath(const std::string& filePath);
void onSelectBookFile(const std::string& path);
void onGoToFileSelection(const std::string& fromBookPath = "");
void onGoToEpubReader(std::unique_ptr<Epub> epub);
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
public:
explicit ReaderActivity(GfxRenderer& renderer, InputManager& inputManager, std::string initialBookPath,
const std::function<void()>& onGoBack)
: ActivityWithSubactivity("Reader", renderer, inputManager),
initialBookPath(std::move(initialBookPath)),
onGoBack(onGoBack) {}
void onEnter() override;
};