28 static constexpr std::string_view
PRINT_DIR =
"prints";
32 Paper(
unsigned x,
unsigned y,
double dotSizeX,
double dotSizeY);
34 [[nodiscard]] std::string
save()
const;
36 void plot(
double x,
double y);
39 uint8_t& dot(
unsigned x,
unsigned y);
42 std::vector<uint8_t> buf;
43 std::vector<int> table;
61 if (!strobe && prevStrobe) {
87 : motherBoard(motherBoard_)
90 motherBoard.getCommandController(),
"print-resolution",
91 "resolution of the output image of emulated dot matrix printer in DPI",
93 , graphicsHiLo(graphicsHiLo_)
153 for (
auto i :
xrange(9)) {
154 if (pattern & (1 << i)) {
198 int dpi = dpiSetting->getInt();
199 auto paperSizeX = unsigned((210 / 25.4) * dpi);
200 auto paperSizeY = unsigned((297 / 25.4) * dpi);
206 paper = std::make_unique<Paper>(paperSizeX, paperSizeY,
216 auto filename = paper->save();
218 "Printed to ", filename);
221 "Failed to print: ", e.getMessage());
232static constexpr unsigned compress9(
unsigned a)
235 for (
auto i :
xrange(9)) {
237 result |= 1 << (i / 2);
249 uint8_t attribute = charBitmap[0];
250 unsigned start = (attribute >> 4) & 0x07;
251 unsigned end = attribute & 0x0f;
252 unsigned topBits = attribute >> 7;
277 unsigned charBits = unsigned(charBitmap[i + 1]) << topBits;
283 charBits = compress9(charBits);
290 plot9Dots(destX, destY + y * dblStrikeOffset, charBits);
294 hPos += headRelative;
303static constexpr std::array<uint8_t, 256 * 8> MSXFontRaw = {
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305 0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C,
306 0x3C, 0x7E, 0xDB, 0xFF, 0xFF, 0xDB, 0x66, 0x3C,
307 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
308 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
309 0x10, 0x38, 0x54, 0xFE, 0x54, 0x10, 0x38, 0x00,
310 0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x10, 0x38, 0x00,
311 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00,
312 0xFF, 0xFF, 0xFF, 0xE7, 0xE7, 0xFF, 0xFF, 0xFF,
313 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00,
314 0xC7, 0xBB, 0x7D, 0x7D, 0x7D, 0xBB, 0xC7, 0xFF,
315 0x0F, 0x03, 0x05, 0x79, 0x88, 0x88, 0x88, 0x70,
316 0x38, 0x44, 0x44, 0x44, 0x38, 0x10, 0x7C, 0x10,
317 0x30, 0x28, 0x24, 0x24, 0x28, 0x20, 0xE0, 0xC0,
318 0x3C, 0x24, 0x3C, 0x24, 0x24, 0xE4, 0xDC, 0x18,
319 0x10, 0x54, 0x38, 0xEE, 0x38, 0x54, 0x10, 0x00,
320 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10,
321 0x10, 0x10, 0x10, 0xFF, 0x00, 0x00, 0x00, 0x00,
322 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10,
323 0x10, 0x10, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10,
324 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10,
325 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x10,
326 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
327 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
328 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10,
329 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x10, 0x10,
330 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00,
331 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00,
332 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81,
333 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
334 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
335 0x00, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x00,
338 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x50, 0x50, 0xF8, 0x50, 0xF8, 0x50, 0x50, 0x00,
340 0x20, 0x78, 0xA0, 0x70, 0x28, 0xF0, 0x20, 0x00,
341 0xC0, 0xC8, 0x10, 0x20, 0x40, 0x98, 0x18, 0x00,
342 0x40, 0xA0, 0x40, 0xA8, 0x90, 0x98, 0x60, 0x00,
343 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00,
345 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00,
346 0x20, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0x20, 0x00,
347 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40,
349 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
351 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
352 0x70, 0x88, 0x98, 0xA8, 0xC8, 0x88, 0x70, 0x00,
353 0x20, 0x60, 0xA0, 0x20, 0x20, 0x20, 0xF8, 0x00,
354 0x70, 0x88, 0x08, 0x10, 0x60, 0x80, 0xF8, 0x00,
355 0x70, 0x88, 0x08, 0x30, 0x08, 0x88, 0x70, 0x00,
356 0x10, 0x30, 0x50, 0x90, 0xF8, 0x10, 0x10, 0x00,
357 0xF8, 0x80, 0xE0, 0x10, 0x08, 0x10, 0xE0, 0x00,
358 0x30, 0x40, 0x80, 0xF0, 0x88, 0x88, 0x70, 0x00,
359 0xF8, 0x88, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00,
360 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00,
361 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60, 0x00,
362 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00,
363 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x20, 0x40,
364 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00,
365 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x00, 0x00,
366 0xC0, 0x60, 0x30, 0x18, 0x30, 0x60, 0xC0, 0x00,
367 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20, 0x00,
368 0x70, 0x88, 0x08, 0x68, 0xA8, 0xA8, 0x70, 0x00,
369 0x20, 0x50, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x00,
370 0xF0, 0x48, 0x48, 0x70, 0x48, 0x48, 0xF0, 0x00,
371 0x30, 0x48, 0x80, 0x80, 0x80, 0x48, 0x30, 0x00,
372 0xE0, 0x50, 0x48, 0x48, 0x48, 0x50, 0xE0, 0x00,
373 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8, 0x00,
374 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00,
375 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x70, 0x00,
376 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x00,
377 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
378 0x38, 0x10, 0x10, 0x10, 0x90, 0x90, 0x60, 0x00,
379 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88, 0x00,
380 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8, 0x00,
381 0x88, 0xD8, 0xA8, 0xA8, 0x88, 0x88, 0x88, 0x00,
382 0x88, 0xC8, 0xC8, 0xA8, 0x98, 0x98, 0x88, 0x00,
383 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
384 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80, 0x00,
385 0x70, 0x88, 0x88, 0x88, 0xA8, 0x90, 0x68, 0x00,
386 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0x90, 0x88, 0x00,
387 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00,
388 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
389 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
390 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x00,
391 0x88, 0x88, 0x88, 0xA8, 0xA8, 0xD8, 0x88, 0x00,
392 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00,
393 0x88, 0x88, 0x88, 0x70, 0x20, 0x20, 0x20, 0x00,
394 0xF8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xF8, 0x00,
395 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00,
396 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00,
397 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00,
398 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00,
400 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
401 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
402 0x80, 0x80, 0xB0, 0xC8, 0x88, 0xC8, 0xB0, 0x00,
403 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70, 0x00,
404 0x08, 0x08, 0x68, 0x98, 0x88, 0x98, 0x68, 0x00,
405 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
406 0x10, 0x28, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x00,
407 0x00, 0x00, 0x68, 0x98, 0x98, 0x68, 0x08, 0x70,
408 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x00,
409 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00,
410 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x90, 0x60,
411 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00,
412 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
413 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0xA8, 0x00,
414 0x00, 0x00, 0xB0, 0xC8, 0x88, 0x88, 0x88, 0x00,
415 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00,
416 0x00, 0x00, 0xB0, 0xC8, 0xC8, 0xB0, 0x80, 0x80,
417 0x00, 0x00, 0x68, 0x98, 0x98, 0x68, 0x08, 0x08,
418 0x00, 0x00, 0xB0, 0xC8, 0x80, 0x80, 0x80, 0x00,
419 0x00, 0x00, 0x78, 0x80, 0xF0, 0x08, 0xF0, 0x00,
420 0x40, 0x40, 0xF0, 0x40, 0x40, 0x48, 0x30, 0x00,
421 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x68, 0x00,
422 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00,
423 0x00, 0x00, 0x88, 0xA8, 0xA8, 0xA8, 0x50, 0x00,
424 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00,
425 0x00, 0x00, 0x88, 0x88, 0x98, 0x68, 0x08, 0x70,
426 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8, 0x00,
427 0x18, 0x20, 0x20, 0x40, 0x20, 0x20, 0x18, 0x00,
428 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00,
429 0xC0, 0x20, 0x20, 0x10, 0x20, 0x20, 0xC0, 0x00,
430 0x40, 0xA8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x00, 0x20, 0x50, 0xF8, 0x00, 0x00, 0x00,
432 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x20, 0x60,
433 0x90, 0x00, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00,
434 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
435 0x20, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
436 0x48, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
437 0x20, 0x10, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
438 0x20, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
439 0x00, 0x70, 0x80, 0x80, 0x80, 0x70, 0x10, 0x60,
440 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
441 0x50, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
442 0x20, 0x10, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
443 0x50, 0x00, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
444 0x20, 0x50, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
445 0x40, 0x20, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
446 0x50, 0x00, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
447 0x20, 0x00, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
448 0x10, 0x20, 0xF8, 0x80, 0xF0, 0x80, 0xF8, 0x00,
449 0x00, 0x00, 0x6C, 0x12, 0x7E, 0x90, 0x6E, 0x00,
450 0x3E, 0x50, 0x90, 0x9C, 0xF0, 0x90, 0x9E, 0x00,
451 0x60, 0x90, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
452 0x90, 0x00, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
453 0x40, 0x20, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
454 0x40, 0xA0, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
455 0x40, 0x20, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
456 0x90, 0x00, 0x90, 0x90, 0xB0, 0x50, 0x10, 0xE0,
457 0x50, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00,
458 0x50, 0x00, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
459 0x20, 0x20, 0x78, 0x80, 0x80, 0x78, 0x20, 0x20,
460 0x18, 0x24, 0x20, 0xF8, 0x20, 0xE2, 0x5C, 0x00,
461 0x88, 0x50, 0x20, 0xF8, 0x20, 0xF8, 0x20, 0x00,
462 0xC0, 0xA0, 0xA0, 0xC8, 0x9C, 0x88, 0x88, 0x8C,
463 0x18, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x40,
464 0x10, 0x20, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
465 0x10, 0x20, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
466 0x20, 0x40, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
467 0x20, 0x40, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00,
468 0x50, 0xA0, 0x00, 0xA0, 0xD0, 0x90, 0x90, 0x00,
469 0x28, 0x50, 0x00, 0xC8, 0xA8, 0x98, 0x88, 0x00,
470 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00, 0xF8,
471 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, 0xF0,
472 0x20, 0x00, 0x20, 0x40, 0x80, 0x88, 0x70, 0x00,
473 0x00, 0x00, 0x00, 0xF8, 0x80, 0x80, 0x00, 0x00,
474 0x00, 0x00, 0x00, 0xF8, 0x08, 0x08, 0x00, 0x00,
475 0x84, 0x88, 0x90, 0xA8, 0x54, 0x84, 0x08, 0x1C,
476 0x84, 0x88, 0x90, 0xA8, 0x58, 0xA8, 0x3C, 0x08,
477 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00,
478 0x00, 0x00, 0x24, 0x48, 0x90, 0x48, 0x24, 0x00,
479 0x00, 0x00, 0x90, 0x48, 0x24, 0x48, 0x90, 0x00,
480 0x28, 0x50, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
481 0x28, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
482 0x28, 0x50, 0x00, 0x70, 0x20, 0x20, 0x70, 0x00,
483 0x28, 0x50, 0x00, 0x20, 0x20, 0x20, 0x70, 0x00,
484 0x28, 0x50, 0x00, 0x70, 0x88, 0x88, 0x70, 0x00,
485 0x50, 0xA0, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
486 0x28, 0x50, 0x00, 0x88, 0x88, 0x88, 0x70, 0x00,
487 0x50, 0xA0, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
488 0xFC, 0x48, 0x48, 0x48, 0xE8, 0x08, 0x50, 0x20,
489 0x00, 0x50, 0x00, 0x50, 0x50, 0x50, 0x10, 0x20,
490 0xC0, 0x44, 0xC8, 0x54, 0xEC, 0x54, 0x9E, 0x04,
491 0x10, 0xA8, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
492 0x00, 0x20, 0x50, 0x88, 0x50, 0x20, 0x00, 0x00,
493 0x88, 0x10, 0x20, 0x40, 0x80, 0x28, 0x00, 0x00,
494 0x7C, 0xA8, 0xA8, 0x68, 0x28, 0x28, 0x28, 0x00,
495 0x38, 0x40, 0x30, 0x48, 0x48, 0x30, 0x08, 0x70,
496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
497 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
498 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
499 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
500 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x00, 0x00, 0x00,
501 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
502 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
503 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
504 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC,
505 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
506 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
507 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88,
508 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11,
509 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
510 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7C, 0xFE,
511 0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80, 0x00,
512 0x01, 0x03, 0x07, 0x0F, 0x07, 0x03, 0x01, 0x00,
513 0xFF, 0x7E, 0x3C, 0x18, 0x18, 0x3C, 0x7E, 0xFF,
514 0x81, 0xC3, 0xE7, 0xFF, 0xFF, 0xE7, 0xC3, 0x81,
515 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
516 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
517 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
518 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
519 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC,
520 0x00, 0x20, 0x20, 0x50, 0x50, 0x88, 0xF8, 0x00,
521 0x20, 0x20, 0x70, 0x20, 0x70, 0x20, 0x20, 0x00,
522 0x00, 0x00, 0x00, 0x50, 0x88, 0xA8, 0x50, 0x00,
523 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
524 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
525 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
526 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
527 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
528 0x00, 0x00, 0x68, 0x90, 0x90, 0x90, 0x68, 0x00,
529 0x30, 0x48, 0x48, 0x70, 0x48, 0x48, 0x70, 0xC0,
530 0xF8, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
531 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x98, 0x00,
532 0xF8, 0x88, 0x40, 0x20, 0x40, 0x88, 0xF8, 0x00,
533 0x00, 0x00, 0x78, 0x90, 0x90, 0x90, 0x60, 0x00,
534 0x00, 0x50, 0x50, 0x50, 0x50, 0x68, 0x80, 0x80,
535 0x00, 0x50, 0xA0, 0x20, 0x20, 0x20, 0x20, 0x00,
536 0xF8, 0x20, 0x70, 0xA8, 0xA8, 0x70, 0x20, 0xF8,
537 0x20, 0x50, 0x88, 0xF8, 0x88, 0x50, 0x20, 0x00,
538 0x70, 0x88, 0x88, 0x88, 0x50, 0x50, 0xD8, 0x00,
539 0x30, 0x40, 0x40, 0x20, 0x50, 0x50, 0x50, 0x20,
540 0x00, 0x00, 0x00, 0x50, 0xA8, 0xA8, 0x50, 0x00,
541 0x08, 0x70, 0xA8, 0xA8, 0xA8, 0x70, 0x80, 0x00,
542 0x38, 0x40, 0x80, 0xF8, 0x80, 0x40, 0x38, 0x00,
543 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00,
544 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x00,
545 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0xF8, 0x00,
546 0xC0, 0x30, 0x08, 0x30, 0xC0, 0x00, 0xF8, 0x00,
547 0x18, 0x60, 0x80, 0x60, 0x18, 0x00, 0xF8, 0x00,
548 0x10, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
549 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40,
550 0x00, 0x20, 0x00, 0xF8, 0x00, 0x20, 0x00, 0x00,
551 0x00, 0x50, 0xA0, 0x00, 0x50, 0xA0, 0x00, 0x00,
552 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00,
553 0x00, 0x30, 0x78, 0x78, 0x30, 0x00, 0x00, 0x00,
554 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
555 0x3E, 0x20, 0x20, 0x20, 0xA0, 0x60, 0x20, 0x00,
556 0xA0, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00,
557 0x40, 0xA0, 0x20, 0x40, 0xE0, 0x00, 0x00, 0x00,
558 0x00, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00,
559 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
563static constexpr auto MSXFont = []{
564 std::array<uint8_t, 256 * 9> result = {};
565 for (
auto i :
xrange(256)) {
571 for (
auto j :
xrange(8)) {
572 uint8_t charBits = 0;
573 for (
auto k :
xrange(8)) {
574 charBits |= uint8_t(((MSXFontRaw[8 * i + 7 - k] >> (7 - j)) & 1) << k);
578 if (oneBits != 0 && start < 0) start = j;
579 if (charBits != 0)
end = j;
580 result[9 * i + j + 1] = charBits;
584 if (start < 0 || start >= 7) start = 0;
587 result[9 * i] = uint8_t((start << 4) |
end);
601 return "msx-printer";
607 return "Emulate MSX printer, prints to image.";
610std::pair<unsigned, unsigned> ImagePrinterMSX::getNumberOfDots()
615void ImagePrinterMSX::resetSettings()
635unsigned ImagePrinterMSX::calcEscSequenceLength(uint8_t character)
642 case 'O':
case '\\':
case 'L':
case '/':
653unsigned ImagePrinterMSX::parseNumber(
unsigned sizeStart,
unsigned sizeChars)
656 while (sizeChars--) {
658 uint8_t data =
abEscSeq[sizeStart++];
659 if (data >=
'0' && data <=
'9') {
660 Value += unsigned(data -
'0');
666void ImagePrinterMSX::processEscSequence()
754 lineFeed = parseNumber(1, 2) * (1.0 / 2.0);
757 lineFeed = parseNumber(1, 2) * (1.0 / 3.0);
804void ImagePrinterMSX::processCharacter(uint8_t data)
867template<
typename Archive>
878static constexpr std::array<uint8_t, 12 * 256> EpsonFontRom = {
879 0x8b, 0x04, 0x0a, 0x20, 0x8a, 0x60, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
880 0x8b, 0x1c, 0x22, 0x08, 0xa2, 0x48, 0x22, 0x08, 0x22, 0x18, 0x00, 0x00,
881 0x9b, 0x00, 0x3c, 0x00, 0x82, 0x40, 0x02, 0x00, 0x3c, 0x02, 0x00, 0x00,
882 0x9a, 0x00, 0x1c, 0x22, 0x80, 0x62, 0x00, 0x22, 0x1c, 0x00, 0x00, 0x00,
883 0x96, 0x00, 0x12, 0x80, 0x5e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
884 0xa7, 0x00, 0x00, 0x40, 0xa0, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x00, 0x00,
885 0x8b, 0x12, 0x00, 0x7e, 0x80, 0x12, 0x80, 0x02, 0x80, 0x42, 0x00, 0x00,
886 0xc8, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
887 0x8b, 0x06, 0x00, 0x09, 0x00, 0x51, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00,
888 0x8b, 0x5e, 0x80, 0x10, 0x80, 0x08, 0x40, 0x04, 0x40, 0x9e, 0x00, 0x00,
889 0x8a, 0x40, 0x9e, 0x00, 0x90, 0x40, 0x10, 0x4e, 0x80, 0x00, 0x00, 0x00,
890 0x8b, 0x92, 0x28, 0x44, 0x00, 0x44, 0x00, 0x44, 0x28, 0x92, 0x00, 0x00,
891 0x8b, 0xfe, 0x00, 0xa0, 0x00, 0x48, 0x00, 0x1e, 0x00, 0x0a, 0x00, 0x00,
892 0x8b, 0x06, 0x08, 0x54, 0xa0, 0x04, 0xa0, 0x54, 0x08, 0x06, 0x00, 0x00,
893 0x8b, 0x04, 0x0a, 0x20, 0x0a, 0xa0, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
894 0x0a, 0x38, 0x44, 0x01, 0x44, 0x01, 0x46, 0x00, 0x44, 0x00, 0x00, 0x00,
895 0x9a, 0x00, 0x50, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x14, 0x00, 0x00, 0x00,
896 0x8a, 0x7e, 0x80, 0x00, 0x80, 0x12, 0x80, 0x12, 0x6c, 0x00, 0x00, 0x00,
897 0x8b, 0x3e, 0x40, 0x90, 0x00, 0xfe, 0x00, 0x92, 0x00, 0x92, 0x00, 0x00,
898 0x8b, 0x2c, 0x02, 0x28, 0x02, 0x1c, 0x20, 0x0a, 0x20, 0x1a, 0x00, 0x00,
899 0x8b, 0x3a, 0x44, 0x00, 0x8a, 0x10, 0xa2, 0x00, 0x44, 0xb8, 0x00, 0x00,
900 0x8b, 0x02, 0x08, 0x14, 0x22, 0x08, 0x22, 0x14, 0x08, 0x20, 0x00, 0x00,
901 0xa9, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
902 0x8b, 0x06, 0x88, 0x14, 0x20, 0x44, 0x20, 0x14, 0x88, 0x06, 0x00, 0x00,
903 0x8b, 0x1c, 0xa2, 0x00, 0x22, 0x00, 0x22, 0x00, 0xa2, 0x1c, 0x00, 0x00,
904 0x8b, 0x3c, 0x82, 0x00, 0x02, 0x00, 0x02, 0x00, 0x82, 0x3c, 0x00, 0x00,
905 0x8b, 0x04, 0x0a, 0xa0, 0x0a, 0x20, 0x0a, 0xa0, 0x1c, 0x02, 0x00, 0x00,
906 0x9a, 0x00, 0x1c, 0xa2, 0x00, 0x22, 0x00, 0xa2, 0x1c, 0x00, 0x00, 0x00,
907 0x8a, 0x3c, 0x80, 0x02, 0x00, 0x02, 0x80, 0x3c, 0x02, 0x00, 0x00, 0x00,
908 0x8b, 0x3e, 0x00, 0x2a, 0x00, 0x6a, 0x80, 0x2a, 0x00, 0x22, 0x00, 0x00,
909 0x8b, 0x1c, 0x22, 0x08, 0x22, 0x48, 0xa2, 0x08, 0x22, 0x18, 0x00, 0x00,
910 0x8b, 0xa8, 0x00, 0x68, 0x00, 0x3e, 0x00, 0x68, 0x00, 0xa8, 0x00, 0x00,
911 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
912 0xc8, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
913 0xa9, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
914 0x8b, 0x28, 0x00, 0xfe, 0x00, 0x28, 0x00, 0xfe, 0x00, 0x28, 0x00, 0x00,
915 0x8b, 0x24, 0x00, 0x54, 0x00, 0xfe, 0x00, 0x54, 0x00, 0x48, 0x00, 0x00,
916 0x8b, 0xc0, 0x02, 0xc4, 0x08, 0x10, 0x20, 0x46, 0x80, 0x06, 0x00, 0x00,
917 0x8b, 0x4c, 0xa0, 0x12, 0xa0, 0x4a, 0x00, 0x04, 0x08, 0x12, 0x00, 0x00,
918 0xc8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
919 0xc9, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00,
920 0xa7, 0x00, 0x00, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
921 0x8b, 0x10, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x10, 0x00, 0x00,
922 0x8b, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
923 0x39, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
924 0x8b, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
925 0xa8, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
926 0x9a, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
927 0x8b, 0x38, 0x44, 0x00, 0x82, 0x00, 0x82, 0x00, 0x44, 0x38, 0x00, 0x00,
928 0xa9, 0x00, 0x00, 0x42, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
929 0x8b, 0x42, 0x80, 0x06, 0x80, 0x0a, 0x80, 0x12, 0x80, 0x62, 0x00, 0x00,
930 0x8b, 0x84, 0x00, 0x82, 0x00, 0xa2, 0x00, 0xd2, 0x00, 0x8c, 0x00, 0x00,
931 0x8b, 0x08, 0x10, 0x28, 0x40, 0x88, 0x00, 0xfe, 0x00, 0x08, 0x00, 0x00,
932 0x8b, 0xe4, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0x9c, 0x00, 0x00,
933 0x8b, 0x0c, 0x12, 0x20, 0x52, 0x80, 0x12, 0x00, 0x12, 0x0c, 0x00, 0x00,
934 0x8b, 0x80, 0x00, 0x82, 0x04, 0x88, 0x10, 0xa0, 0x40, 0x80, 0x00, 0x00,
935 0x8b, 0x6c, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x6c, 0x00, 0x00,
936 0x8b, 0x60, 0x90, 0x00, 0x90, 0x02, 0x94, 0x08, 0x90, 0x60, 0x00, 0x00,
937 0xa7, 0x00, 0x00, 0x36, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
938 0x27, 0x00, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
939 0x89, 0x10, 0x00, 0x28, 0x00, 0x44, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
940 0x8b, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x00,
941 0xab, 0x00, 0x00, 0x82, 0x00, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00,
942 0x8b, 0x40, 0x80, 0x00, 0x80, 0x0a, 0x80, 0x10, 0x80, 0x60, 0x00, 0x00,
943 0x8b, 0x38, 0x44, 0x82, 0x10, 0xaa, 0x00, 0xaa, 0x00, 0x7a, 0x00, 0x00,
944 0x8b, 0x1e, 0x20, 0x48, 0x80, 0x08, 0x80, 0x48, 0x20, 0x1e, 0x00, 0x00,
945 0x8b, 0x82, 0x7c, 0x82, 0x10, 0x82, 0x10, 0x82, 0x10, 0x6c, 0x00, 0x00,
946 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x44, 0x00, 0x00,
947 0x8b, 0x82, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x44, 0x38, 0x00, 0x00,
948 0x8b, 0xfe, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x82, 0x00, 0x00,
949 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x80, 0x00, 0x00,
950 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x10, 0x82, 0x10, 0x82, 0x5c, 0x00, 0x00,
951 0x8b, 0xfe, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x00,
952 0xa9, 0x00, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
953 0x8a, 0x0c, 0x02, 0x00, 0x82, 0x00, 0x82, 0x7c, 0x80, 0x00, 0x00, 0x00,
954 0x8b, 0xfe, 0x00, 0x10, 0x00, 0x28, 0x00, 0x44, 0x00, 0x82, 0x00, 0x00,
955 0x8b, 0xfe, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00,
956 0x8b, 0xfe, 0x00, 0x40, 0x20, 0x10, 0x20, 0x40, 0x00, 0xfe, 0x00, 0x00,
957 0x8b, 0xfe, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0xfe, 0x00, 0x00,
958 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x7c, 0x00, 0x00,
959 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x60, 0x00, 0x00,
960 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x08, 0x82, 0x04, 0x80, 0x7a, 0x00, 0x00,
961 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x98, 0x04, 0x62, 0x00, 0x00,
962 0x8b, 0x64, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x4c, 0x00, 0x00,
963 0x8b, 0x80, 0x00, 0x80, 0x00, 0xfe, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
964 0x8b, 0xfc, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xfc, 0x00, 0x00,
965 0x8b, 0xe0, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0xe0, 0x00, 0x00,
966 0x8b, 0xfc, 0x02, 0x04, 0x08, 0x30, 0x08, 0x04, 0x02, 0xfc, 0x00, 0x00,
967 0x9a, 0x00, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00,
968 0x8b, 0x80, 0x40, 0x20, 0x10, 0x0e, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
969 0x9a, 0x00, 0x82, 0x04, 0x8a, 0x10, 0xa2, 0x40, 0x82, 0x00, 0x00, 0x00,
970 0xa9, 0x00, 0x00, 0xfe, 0x00, 0x82, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
971 0x9a, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00,
972 0xa9, 0x00, 0x00, 0x82, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
973 0x8b, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00,
974 0x0b, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
975 0xb7, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
976 0x8b, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
977 0x8a, 0xfe, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x1c, 0x00, 0x00, 0x00,
978 0x8a, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x00, 0x00,
979 0x8a, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0xfe, 0x00, 0x00, 0x00,
980 0x8b, 0x1c, 0x22, 0x08, 0x22, 0x08, 0x22, 0x08, 0x22, 0x18, 0x00, 0x00,
981 0x89, 0x10, 0x00, 0x10, 0x7e, 0x90, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00,
982 0x0a, 0x38, 0x44, 0x01, 0x44, 0x01, 0x44, 0x01, 0x7e, 0x00, 0x00, 0x00,
983 0x8a, 0xfe, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00, 0x00,
984 0x98, 0x00, 0x22, 0x00, 0xbe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
985 0x99, 0x00, 0x01, 0x00, 0x01, 0x20, 0x01, 0xbe, 0x00, 0x00, 0x00, 0x00,
986 0x9a, 0x00, 0xfe, 0x00, 0x08, 0x00, 0x14, 0x00, 0x22, 0x00, 0x00, 0x00,
987 0x98, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
988 0x8b, 0x1e, 0x20, 0x00, 0x20, 0x1e, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00,
989 0x8a, 0x3e, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00, 0x00,
990 0x8b, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x1c, 0x00, 0x00,
991 0x0a, 0x7f, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x38, 0x00, 0x00, 0x00,
992 0x1b, 0x00, 0x38, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x7e, 0x00, 0x00,
993 0x8a, 0x3e, 0x00, 0x10, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00,
994 0x8b, 0x10, 0x2a, 0x00, 0x2a, 0x00, 0x2a, 0x00, 0x2a, 0x04, 0x00, 0x00,
995 0x8a, 0x20, 0x00, 0x7c, 0x02, 0x20, 0x02, 0x20, 0x02, 0x00, 0x00, 0x00,
996 0x8b, 0x3c, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x3c, 0x02, 0x00, 0x00,
997 0x8b, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00,
998 0x8b, 0x3c, 0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02, 0x3c, 0x00, 0x00,
999 0x89, 0x22, 0x14, 0x00, 0x08, 0x00, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00,
1000 0x0b, 0x40, 0x20, 0x11, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
1001 0x89, 0x22, 0x04, 0x22, 0x08, 0x22, 0x10, 0x22, 0x00, 0x00, 0x00, 0x00,
1002 0xaa, 0x00, 0x00, 0x10, 0x00, 0x6c, 0x82, 0x00, 0x82, 0x00, 0x00, 0x00,
1003 0xc7, 0x00, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1004 0xaa, 0x00, 0x82, 0x00, 0x82, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
1005 0x8b, 0x40, 0x80, 0x00, 0x80, 0x40, 0x20, 0x00, 0x20, 0x40, 0x00, 0x00,
1006 0x8b, 0x7c, 0x82, 0x04, 0x8a, 0x10, 0xa2, 0x40, 0x82, 0x7c, 0x00, 0x00,
1007 0x8a, 0x04, 0x0a, 0x80, 0x2a, 0x60, 0x0a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1008 0x8a, 0x0c, 0x12, 0x28, 0x82, 0x68, 0x02, 0x28, 0x10, 0x00, 0x00, 0x00,
1009 0x8a, 0x0c, 0x32, 0x00, 0x82, 0x40, 0x02, 0x0c, 0x32, 0x00, 0x00, 0x00,
1010 0x8a, 0x0c, 0x12, 0x00, 0xa0, 0x42, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1011 0x98, 0x00, 0x02, 0x00, 0x16, 0x88, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00,
1012 0xa9, 0x00, 0x00, 0x40, 0xa0, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x00, 0x00,
1013 0x8b, 0x12, 0x00, 0x1e, 0x60, 0x12, 0x80, 0x12, 0x80, 0x40, 0x00, 0x00,
1014 0x9a, 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00, 0x80, 0x00, 0x00, 0x00,
1015 0x8a, 0x06, 0x01, 0x08, 0x01, 0x10, 0x21, 0x80, 0x02, 0x00, 0x00, 0x00,
1016 0x8b, 0x06, 0x58, 0x80, 0x08, 0x84, 0x40, 0x06, 0x58, 0x80, 0x00, 0x00,
1017 0x8b, 0x12, 0x4c, 0x80, 0x10, 0x80, 0x50, 0x02, 0x4c, 0x80, 0x00, 0x00,
1018 0x8b, 0x02, 0x18, 0x24, 0x80, 0x44, 0x02, 0x48, 0x30, 0x80, 0x00, 0x00,
1019 0x8b, 0x06, 0x38, 0xc0, 0x20, 0x88, 0x26, 0xd8, 0x02, 0x08, 0x00, 0x00,
1020 0x8b, 0x02, 0x04, 0x08, 0x14, 0x40, 0xa4, 0x00, 0xbe, 0x40, 0x00, 0x00,
1021 0x8a, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x8a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1022 0x1b, 0x00, 0x18, 0x21, 0x04, 0x41, 0x06, 0x40, 0x04, 0x40, 0x00, 0x00,
1023 0x8b, 0x02, 0x10, 0x6a, 0x00, 0xaa, 0x00, 0xac, 0x10, 0x80, 0x00, 0x00,
1024 0x8a, 0x06, 0x18, 0x60, 0x00, 0x82, 0x10, 0x82, 0x6c, 0x00, 0x00, 0x00,
1025 0x8b, 0x0e, 0x30, 0x40, 0x90, 0x0e, 0x70, 0x82, 0x10, 0x82, 0x00, 0x00,
1026 0x8b, 0x04, 0x22, 0x08, 0x22, 0x1c, 0x22, 0x08, 0x22, 0x10, 0x00, 0x00,
1027 0x8b, 0x1a, 0x24, 0x42, 0x08, 0x92, 0x20, 0x84, 0x48, 0xb0, 0x00, 0x00,
1028 0x8a, 0x0c, 0x11, 0x02, 0x2c, 0x12, 0x20, 0x44, 0x18, 0x00, 0x00, 0x00,
1029 0xa9, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
1030 0x8b, 0x02, 0x04, 0x08, 0x14, 0x80, 0x24, 0x00, 0x3e, 0x80, 0x00, 0x00,
1031 0x8b, 0x0c, 0x12, 0x00, 0xa2, 0x00, 0x22, 0x00, 0xa4, 0x18, 0x00, 0x00,
1032 0x8b, 0x0c, 0x32, 0x00, 0x82, 0x00, 0x02, 0x00, 0x8c, 0x30, 0x00, 0x00,
1033 0x8a, 0x04, 0x0a, 0x20, 0x8a, 0x20, 0x0a, 0x24, 0x9a, 0x00, 0x00, 0x00,
1034 0x8a, 0x0c, 0x12, 0x00, 0xa0, 0x02, 0x00, 0x24, 0x98, 0x00, 0x00, 0x00,
1035 0x8b, 0x0c, 0x32, 0x80, 0x02, 0x00, 0x02, 0x0c, 0xb2, 0x00, 0x00, 0x00,
1036 0x8b, 0x06, 0x18, 0x22, 0x08, 0x22, 0x48, 0x22, 0x80, 0x20, 0x00, 0x00,
1037 0x8a, 0x0c, 0x12, 0x28, 0x02, 0x68, 0x02, 0xa8, 0x10, 0x00, 0x00, 0x00,
1038 0x8b, 0x08, 0x20, 0x88, 0x66, 0x18, 0x20, 0x48, 0x20, 0x80, 0x00, 0x00,
1039 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1040 0x9a, 0x00, 0x02, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1041 0x9a, 0x00, 0x20, 0x40, 0x80, 0x00, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1042 0x8b, 0x28, 0x06, 0x38, 0xc0, 0x28, 0x06, 0x38, 0xc0, 0x28, 0x00, 0x00,
1043 0x8a, 0x00, 0x24, 0x10, 0x46, 0x38, 0xc4, 0x10, 0x48, 0x00, 0x00, 0x00,
1044 0x8b, 0x40, 0x82, 0x44, 0x88, 0x10, 0x22, 0x44, 0x82, 0x04, 0x00, 0x00,
1045 0x8b, 0x0c, 0x10, 0x42, 0xa0, 0x12, 0xa8, 0x44, 0x0a, 0x10, 0x00, 0x00,
1046 0xc8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
1047 0xba, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00,
1048 0x98, 0x00, 0x02, 0x00, 0x04, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
1049 0x8b, 0x10, 0x04, 0x50, 0x28, 0x10, 0x28, 0x14, 0x40, 0x10, 0x00, 0x00,
1050 0x8b, 0x10, 0x00, 0x14, 0x08, 0x10, 0x20, 0x50, 0x00, 0x10, 0x00, 0x00,
1051 0x29, 0x00, 0x00, 0x01, 0x04, 0x0a, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
1052 0x8b, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
1053 0xa8, 0x00, 0x00, 0x02, 0x04, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1054 0x9a, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1055 0x8b, 0x1c, 0x20, 0x42, 0x00, 0x82, 0x00, 0x84, 0x08, 0x70, 0x00, 0x00,
1056 0x99, 0x00, 0x02, 0x00, 0x46, 0x18, 0x62, 0x80, 0x00, 0x00, 0x00, 0x00,
1057 0x8b, 0x02, 0x40, 0x06, 0x80, 0x0a, 0x80, 0x12, 0x80, 0x60, 0x00, 0x00,
1058 0x8b, 0x04, 0x00, 0x82, 0x00, 0x92, 0x00, 0xb2, 0x4c, 0x80, 0x00, 0x00,
1059 0x8b, 0x08, 0x10, 0x08, 0x20, 0x08, 0x46, 0x38, 0xc0, 0x08, 0x00, 0x00,
1060 0x8b, 0x04, 0x60, 0x82, 0x20, 0x82, 0x20, 0x84, 0x18, 0x80, 0x00, 0x00,
1061 0x8a, 0x0c, 0x10, 0x22, 0x10, 0x42, 0x10, 0x82, 0x0c, 0x00, 0x00, 0x00,
1062 0x8b, 0x80, 0x02, 0x84, 0x08, 0x90, 0x20, 0x80, 0x40, 0x80, 0x00, 0x00,
1063 0x8b, 0x0c, 0x62, 0x10, 0x82, 0x10, 0x82, 0x10, 0x8c, 0x60, 0x00, 0x00,
1064 0x8a, 0x60, 0x02, 0x90, 0x04, 0x90, 0x08, 0x90, 0x60, 0x00, 0x00, 0x00,
1065 0xa9, 0x00, 0x00, 0x02, 0x14, 0x22, 0x14, 0x20, 0x00, 0x00, 0x00, 0x00,
1066 0x2a, 0x00, 0x00, 0x01, 0x04, 0x2a, 0x44, 0x28, 0x40, 0x00, 0x00, 0x00,
1067 0x9a, 0x00, 0x10, 0x08, 0x24, 0x02, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00,
1068 0x8a, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00,
1069 0x9a, 0x00, 0x02, 0x00, 0x04, 0x80, 0x48, 0x20, 0x10, 0x00, 0x00, 0x00,
1070 0x8a, 0x48, 0x02, 0x80, 0x08, 0x80, 0x10, 0x80, 0x60, 0x00, 0x00, 0x00,
1071 0x8b, 0x1c, 0x20, 0x42, 0x80, 0x12, 0x88, 0x22, 0x88, 0x70, 0x00, 0x00,
1072 0x8b, 0x02, 0x04, 0x08, 0x10, 0x28, 0x40, 0x88, 0x00, 0xfe, 0x00, 0x00,
1073 0x8b, 0x06, 0x98, 0x62, 0x80, 0x12, 0x80, 0x12, 0x8c, 0x60, 0x00, 0x00,
1074 0x8b, 0x1c, 0x22, 0x40, 0x82, 0x00, 0x82, 0x00, 0x84, 0x40, 0x00, 0x00,
1075 0x8b, 0x06, 0x98, 0x62, 0x80, 0x02, 0x80, 0x04, 0x88, 0x70, 0x00, 0x00,
1076 0x8b, 0x06, 0x38, 0xc2, 0x10, 0x82, 0x10, 0x82, 0x00, 0x80, 0x00, 0x00,
1077 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x80, 0x10, 0x80, 0x00, 0x80, 0x00, 0x00,
1078 0x8b, 0x1c, 0x22, 0x40, 0x82, 0x00, 0x92, 0x04, 0x98, 0x40, 0x00, 0x00,
1079 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x00, 0x10, 0x06, 0x38, 0xc0, 0x00, 0x00,
1080 0x92, 0x00, 0x02, 0x00, 0x86, 0x18, 0xe2, 0x00, 0x80, 0x00, 0x00, 0x00,
1081 0x8b, 0x0c, 0x02, 0x00, 0x02, 0x80, 0x04, 0x98, 0x60, 0x80, 0x00, 0x00,
1082 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x20, 0x08, 0x44, 0x02, 0x80, 0x00, 0x00,
1083 0x9a, 0x00, 0x06, 0x18, 0x62, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
1084 0x8b, 0x06, 0x38, 0xc0, 0x00, 0x30, 0x00, 0x46, 0x38, 0xc0, 0x00, 0x00,
1085 0x8b, 0x06, 0x38, 0xc0, 0x20, 0x10, 0x08, 0x06, 0x38, 0xc0, 0x00, 0x00,
1086 0x8b, 0x0c, 0x32, 0x40, 0x82, 0x00, 0x82, 0x04, 0x98, 0x60, 0x00, 0x00,
1087 0x8b, 0x06, 0x18, 0x60, 0x90, 0x00, 0x90, 0x00, 0x90, 0x60, 0x00, 0x00,
1088 0x8b, 0x1c, 0x20, 0x42, 0x00, 0x8a, 0x00, 0x84, 0x0a, 0x70, 0x00, 0x00,
1089 0x8b, 0x06, 0x18, 0x60, 0x80, 0x10, 0x88, 0x14, 0x82, 0x60, 0x00, 0x00,
1090 0x8b, 0x04, 0x62, 0x00, 0x92, 0x00, 0x92, 0x00, 0x8c, 0x40, 0x00, 0x00,
1091 0x8b, 0x80, 0x00, 0x86, 0x18, 0xe0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
1092 0x8b, 0x0c, 0x32, 0xc0, 0x02, 0x00, 0x02, 0x0c, 0x30, 0xc0, 0x00, 0x00,
1093 0x9b, 0x00, 0xfe, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
1094 0x8b, 0x06, 0x38, 0xc4, 0x08, 0x10, 0x08, 0x06, 0x38, 0xc0, 0x00, 0x00,
1095 0x8b, 0x02, 0x84, 0x48, 0x20, 0x18, 0x24, 0x02, 0x40, 0x80, 0x00, 0x00,
1096 0x8b, 0x80, 0x40, 0x26, 0x18, 0x00, 0x20, 0x00, 0x40, 0x80, 0x00, 0x00,
1097 0x8b, 0x02, 0x04, 0x8a, 0x00, 0x92, 0x00, 0xa2, 0x40, 0x80, 0x00, 0x00,
1098 0x9b, 0x00, 0x06, 0x18, 0x62, 0x80, 0x02, 0x80, 0x00, 0x80, 0x00, 0x00,
1099 0xa8, 0x00, 0x00, 0xc0, 0x30, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
1100 0x8a, 0x02, 0x00, 0x02, 0x80, 0x06, 0x98, 0x60, 0x80, 0x00, 0x00, 0x00,
1101 0x9a, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x40, 0x20, 0x00, 0x00, 0x00,
1102 0x0b, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
1103 0xb7, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1104 0x8a, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x0a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1105 0x8a, 0x06, 0x18, 0xe2, 0x00, 0x22, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1106 0x8a, 0x0c, 0x10, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x00, 0x00, 0x00,
1107 0x8b, 0x0c, 0x10, 0x02, 0x20, 0x02, 0x20, 0x06, 0x38, 0xc0, 0x00, 0x00,
1108 0x8a, 0x0c, 0x12, 0x28, 0x02, 0x28, 0x02, 0x28, 0x10, 0x00, 0x00, 0x00,
1109 0x8b, 0x20, 0x00, 0x26, 0x18, 0x60, 0x00, 0xa0, 0x00, 0x80, 0x00, 0x00,
1110 0x1b, 0x00, 0x18, 0x25, 0x00, 0x45, 0x00, 0x46, 0x18, 0x60, 0x00, 0x00,
1111 0x8a, 0x06, 0x18, 0xe0, 0x00, 0x20, 0x00, 0x26, 0x18, 0x00, 0x00, 0x00,
1112 0x99, 0x00, 0x02, 0x00, 0x26, 0x18, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,
1113 0x89, 0x01, 0x00, 0x01, 0x00, 0x26, 0x18, 0xa0, 0x00, 0x00, 0x00, 0x00,
1114 0x8a, 0x06, 0x18, 0x60, 0x88, 0x04, 0x12, 0x00, 0x20, 0x00, 0x00, 0x00,
1115 0x99, 0x00, 0x02, 0x00, 0x06, 0x98, 0x62, 0x80, 0x00, 0x00, 0x00, 0x00,
1116 0x8a, 0x26, 0x18, 0x20, 0x06, 0x38, 0x00, 0x26, 0x18, 0x00, 0x00, 0x00,
1117 0x89, 0x26, 0x18, 0x20, 0x00, 0x20, 0x06, 0x18, 0x00, 0x00, 0x00, 0x00,
1118 0x8a, 0x0c, 0x12, 0x00, 0x20, 0x02, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1119 0x0a, 0x03, 0x1c, 0x60, 0x04, 0x40, 0x04, 0x48, 0x30, 0x00, 0x00, 0x00,
1120 0x1b, 0x00, 0x18, 0x24, 0x00, 0x44, 0x00, 0x47, 0x18, 0x60, 0x00, 0x00,
1121 0x89, 0x06, 0x38, 0x00, 0x10, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
1122 0x8a, 0x02, 0x10, 0x02, 0x28, 0x02, 0x28, 0x04, 0x20, 0x00, 0x00, 0x00,
1123 0x9a, 0x00, 0x20, 0x0c, 0x32, 0xc0, 0x22, 0x00, 0x20, 0x00, 0x00, 0x00,
1124 0x8a, 0x0c, 0x32, 0x00, 0x02, 0x00, 0x02, 0x0c, 0x32, 0x00, 0x00, 0x00,
1125 0x9a, 0x00, 0x3e, 0x00, 0x04, 0x00, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
1126 0x8b, 0x0e, 0x30, 0x04, 0x00, 0x18, 0x04, 0x00, 0x06, 0x38, 0x00, 0x00,
1127 0x8b, 0x02, 0x00, 0x24, 0x10, 0x08, 0x04, 0x12, 0x00, 0x20, 0x00, 0x00,
1128 0x1b, 0x00, 0x40, 0x21, 0x12, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
1129 0x8b, 0x02, 0x00, 0x26, 0x00, 0x2a, 0x00, 0x32, 0x00, 0x20, 0x00, 0x00,
1130 0x9a, 0x00, 0x10, 0x04, 0x1a, 0x60, 0x82, 0x00, 0x80, 0x00, 0x00, 0x00,
1131 0x99, 0x00, 0x02, 0x04, 0x08, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
1132 0x9a, 0x00, 0x02, 0x00, 0x82, 0x0c, 0xb0, 0x40, 0x10, 0x00, 0x00, 0x00,
1133 0x8b, 0x40, 0x80, 0x00, 0x80, 0x40, 0x20, 0x00, 0x20, 0x40, 0x00, 0x00,
1134 0x8b, 0x1a, 0x24, 0x42, 0x08, 0x92, 0x20, 0x84, 0x48, 0xb0, 0x00, 0x00
1145 return "epson-printer";
1150 return "Emulate Epson FX80 printer, prints to image.";
1153std::pair<unsigned, unsigned> ImagePrinterEpson::getNumberOfDots()
1158void ImagePrinterEpson::resetSettings()
1176unsigned ImagePrinterEpson::calcEscSequenceLength(uint8_t character)
1178 switch (character & 127) {
1179 case '!':
case '-':
case '/':
case '3':
case 'A':
case 'J':
1180 case 'N':
case 'Q':
case 'R':
case 'S':
case 'U':
case 'W':
1181 case 'b':
case 'i':
case 'j':
case 'l':
case 'p':
case 's':
1183 case '%':
case '?':
case 'K':
case 'L':
case 'Z':
case '^':
1185 case '*':
case ':':
case '&':
1198unsigned ImagePrinterEpson::parseNumber(
unsigned sizeStart,
unsigned sizeChars)
1201 sizeStart += sizeChars;
1202 while (sizeChars--) {
1203 Value = Value * 256 +
abEscSeq[--sizeStart];
1208void ImagePrinterEpson::processEscSequence()
1210 uint8_t character =
abEscSeq[0] & 127;
1212 switch (character) {
1214 unsigned masterSelect = parseNumber(1, 1);
1215 elite = (masterSelect & 1) != 0;
1217 bold = (masterSelect & 8) != 0;
1244 switch (parseNumber(1, 1)) {
1282 lineFeed = (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1341 lineFeed = parseNumber(1, 1) & 127;
1365 vpos += (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1393 auto width = parseNumber(1, 2);
1394 if (width > 78) width = 78;
1405 auto script = parseNumber(1, 1) & 1;
1438 vpos -= (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1457static constexpr std::array<uint8_t, 9> intlChar35 = { 35, 35, 35, 6, 35, 35, 35, 12, 35};
1458static constexpr std::array<uint8_t, 9> intlChar36 = { 36, 36, 36, 36, 36, 11, 36, 36, 36};
1459static constexpr std::array<uint8_t, 9> intlChar64 = { 64, 0, 16, 64, 64, 29, 64, 64, 64};
1460static constexpr std::array<uint8_t, 9> intlChar91 = { 91, 5, 23, 91, 18, 23, 5, 7, 91};
1461static constexpr std::array<uint8_t, 9> intlChar92 = { 92, 15, 24, 92, 20, 24, 92, 9, 31};
1462static constexpr std::array<uint8_t, 9> intlChar93 = { 93, 16, 25, 93, 13, 13, 30, 8, 93};
1463static constexpr std::array<uint8_t, 9> intlChar94 = { 94, 94, 94, 94, 94, 25, 94, 94, 94};
1464static constexpr std::array<uint8_t, 9> intlChar96 = { 96, 96, 96, 96, 96, 30, 2, 96, 96};
1465static constexpr std::array<uint8_t, 9> intlChar123 = {123, 30, 26, 123, 19, 26, 0, 22, 123};
1466static constexpr std::array<uint8_t, 9> intlChar124 = {124, 2, 27, 124, 21, 27, 3, 10, 124};
1467static constexpr std::array<uint8_t, 9> intlChar125 = {125, 1, 28, 125, 14, 14, 1, 125, 125};
1468static constexpr std::array<uint8_t, 9> intlChar126 = {126, 22, 17, 126, 126, 28, 4, 126, 126};
1470void ImagePrinterEpson::processCharacter(uint8_t data)
1485 switch (data & 0x7f) {
1486 case 35: data = (data & 0x80) | intlChar35 [
countryCode];
break;
1487 case 36: data = (data & 0x80) | intlChar36 [
countryCode];
break;
1488 case 64: data = (data & 0x80) | intlChar64 [
countryCode];
break;
1489 case 91: data = (data & 0x80) | intlChar91 [
countryCode];
break;
1490 case 92: data = (data & 0x80) | intlChar92 [
countryCode];
break;
1491 case 93: data = (data & 0x80) | intlChar93 [
countryCode];
break;
1492 case 94: data = (data & 0x80) | intlChar94 [
countryCode];
break;
1493 case 96: data = (data & 0x80) | intlChar96 [
countryCode];
break;
1494 case 123: data = (data & 0x80) | intlChar123[
countryCode];
break;
1495 case 124: data = (data & 0x80) | intlChar124[
countryCode];
break;
1496 case 125: data = (data & 0x80) | intlChar125[
countryCode];
break;
1497 case 126: data = (data & 0x80) | intlChar126[
countryCode];
break;
1574template<
typename Archive>
1586 : buf(size_t(x) * size_t(y))
1587 , sizeX(x), sizeY(y)
1598 [&](
size_t y) {
return &buf[sizeX * y]; }));
1605 radiusX = dotSizeX * 0.5;
1606 radiusY = dotSizeY * 0.5;
1608 auto rx = int(16 * radiusX);
1609 auto ry = int(16 * radiusY);
1613 table.resize(2 * (radius16 + 16), -(1 << 30));
1615 int offset = ry + 16;
1616 int rx2 = 2 * rx * rx;
1617 int ry2 = 2 * ry * ry;
1622 int de_y = (1 - 2 * ry) * rx * rx;
1627 table[offset - y - 1] = x;
1628 table[offset + y ] = x;
1633 if ((2 * e + de_y) > 0) {
1643 de_x = (1 - 2 * rx) * ry * ry;
1649 table[offset - y - 1] = x;
1650 table[offset + y ] = x;
1655 if ((2 * e + de_x) > 0) {
1666 int xx1 = std::max(
int(floor(xPos - radiusX)), 0);
1667 int xx2 = std::min(
int(ceil (xPos + radiusX)),
int(sizeX));
1668 int yy1 = std::max(
int(floor(yPos - radiusY)), 0);
1669 int yy2 = std::min(
int(ceil (yPos + radiusY)),
int(sizeY));
1671 int y = 16 * yy1 - int(16 * yPos) + 16 + radius16;
1672 for (
auto yy :
xrange(yy1, yy2)) {
1673 int x = 16 * xx1 - int(16 * xPos);
1674 for (
auto xx :
xrange(xx1, xx2)) {
1676 for (
auto i :
xrange(16)) {
1677 int a = table[y + i];
1681 sum += std::min(
t, 2 * a);
1686 sum += std::min(16,
t);
1690 dot(xx, yy) = narrow<uint8_t>(std::max(0, dot(xx, yy) -
sum));
1697uint8_t& Paper::dot(
unsigned x,
unsigned y)
1701 return buf[y * sizeX + x];
Dot Matrix Printer Emulation code mostly copied from blueMSX but changed to: OO-style save to png ima...
void printInfo(std::string_view message)
void printWarning(std::string_view message)
Represents something you can plug devices into.
std::string_view getName() const override
Name used to identify this pluggable.
void serialize(Archive &ar, unsigned version)
ImagePrinterEpson(MSXMotherBoard &motherBoard)
std::string_view getDescription() const override
Description for this pluggable.
std::string_view getDescription() const override
Description for this pluggable.
void serialize(Archive &ar, unsigned version)
std::string_view getName() const override
Name used to identify this pluggable.
ImagePrinterMSX(MSXMotherBoard &motherBoard)
virtual unsigned calcEscSequenceLength(uint8_t character)=0
void seekPrinterHeadRelative(double offset)
void resetEmulatedPrinter()
virtual std::pair< unsigned, unsigned > getNumberOfDots()=0
unsigned remainingCommandBytes
std::array< uint8_t, MAX_ESC_CMDSIZE > abEscSeq
virtual void processCharacter(uint8_t data)=0
void plot9Dots(double x, double y, unsigned pattern)
unsigned sizeRemainingDataBytes
ImagePrinter(MSXMotherBoard &motherBoard, bool graphicsHiLo)
virtual void resetSettings()=0
void printVisibleCharacter(uint8_t data)
void forceFormFeed() override
struct openmsx::ImagePrinter::FontInfo fontInfo
virtual void processEscSequence()=0
void flushEmulatedPrinter()
void write(uint8_t data) override
void printGraphicByte(uint8_t data)
A Setting with an integer value.
MSXCliComm & getMSXCliComm()
Paper(unsigned x, unsigned y, double dotSizeX, double dotSizeY)
void plot(double x, double y)
static constexpr std::string_view PRINT_DIR
static constexpr std::string_view PRINT_EXTENSION
void setDotSize(double sizeX, double sizeY)
void writeData(uint8_t data, EmuTime::param time) override
Sets the data signals.
void setStrobe(bool strobe, EmuTime::param time) override
Sets the strobe signal: false = low, true = high.
virtual void forceFormFeed()=0
void plugHelper(Connector &connector, EmuTime::param time) override
virtual void write(uint8_t data)=0
void unplugHelper(EmuTime::param time) override
bool getStatus(EmuTime::param time) override
Returns the STATUS signal: false = low = ready, true = high = not ready.
constexpr uint8_t reverseByte(uint8_t a)
Reverse the bits in a byte.
string getNextNumberedFileName(string_view directory, string_view prefix, string_view extension, bool addSeparator)
Gets the next numbered file name with the specified prefix in the specified directory,...
void saveGrayscale(size_t width, std::span< const uint8_t * > rowPointers_, const std::string &filename)
This file implemented 3 utility functions:
constexpr void fill(ForwardRange &&range, const T &value)
constexpr auto copy(InputRange &&range, OutputIter out)
constexpr auto transform(Range &&range, UnaryOp op)
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
constexpr auto sum(InputRange &&range, Proj proj={})
std::array< uint8_t, 256 *MAX_FONT_WIDTH > rom
std::array< uint8_t, 256 *MAX_FONT_WIDTH > ram
constexpr auto xrange(T e)
constexpr auto end(const zstring_view &x)