build static method
List<int>
build(
- Image image, {
- required LabelLanguage language,
- PrinterDpi dpi = PrinterDpi.dpi203,
- LabelCompression compression = LabelCompression.none,
- double? widthMm,
- double? heightMm,
- double gapMm = 2,
- LabelMedia media = LabelMedia.gap,
- int copies = 1,
- int threshold = 127,
- double topOffsetMm = 0,
Implementation
static List<int> build(
Image image, {
required LabelLanguage language,
PrinterDpi dpi = PrinterDpi.dpi203,
LabelCompression compression = LabelCompression.none,
double? widthMm,
double? heightMm,
double gapMm = 2,
LabelMedia media = LabelMedia.gap,
int copies = 1,
int threshold = 127,
double topOffsetMm = 0,
}) {
final bitmap = MonoBitmap.fromImage(image, threshold: threshold);
final wMm = widthMm ?? image.width / dpi.dotsPerMm;
final hMm = heightMm ?? image.height / dpi.dotsPerMm;
final compress = compression == LabelCompression.compressed;
switch (language) {
case LabelLanguage.tspl:
return _tspl(bitmap, wMm, hMm, gapMm, media, copies, compress);
case LabelLanguage.escPos:
return _escPos(
bitmap,
media,
copies,
compress,
dpi.mmToDots(topOffsetMm),
);
case LabelLanguage.detong:
return _detong(bitmap, media, copies, dpi.mmToDots(topOffsetMm));
case LabelLanguage.cpcl:
return _cpcl(bitmap, dpi, media, copies, compress);
}
}