Implement Label printing interface for PrinterDriver
Some checks failed
Build ptprnt / build (push) Failing after 32s
Some checks failed
Build ptprnt / build (push) Failing after 32s
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user