Implement Label printing interface for PrinterDriver
Some checks failed
Build ptprnt / build (push) Failing after 32s

This commit is contained in:
2024-04-28 20:02:07 +02:00
parent bb7ab6239d
commit 59ef4189c4
8 changed files with 57 additions and 31 deletions

View File

@@ -23,6 +23,7 @@
#include <cstdint>
#include <iterator>
#include <memory>
#include <thread>
#include <vector>
@@ -32,7 +33,7 @@
#include "spdlog/fmt/bin_to_hex.h"
// as long as DRYRUN is defined, no data is actually send to the printer, we need to save some tape ;)
#define DRYRUN
//#define DRYRUN
namespace ptprnt::printer {
@@ -158,6 +159,15 @@ bool P700Printer::printBitmap(const graphics::Bitmap<graphics::ALPHA8>& bitmap)
return true;
}
bool P700Printer::printLabel(std::unique_ptr<graphics::ILabel> label) {
// not quite sure if I should stack allocate Bitmap, but data is held on the heap anyway (std::vector).
auto bm = graphics::Bitmap<graphics::ALPHA8>(label->getWidth(), label->getHeight());
spdlog::debug("Label has {}x{}px size", label->getWidth(), label->getHeight());
bm.setPixels(label->getRaw());
printBitmap(bm);
return true;
}
bool P700Printer::print() {
send(p700::commands::LF);
send(p700::commands::FF);