Print the picture as follows:
Std::vector<qbytearray> Guilauncher::convertimagetobytearray (const qimage &img) {std::vector<
Qbytearray> cmd_serial;
Just print image!!
int w = img.width ();
int rw = W/8;
int RH = Img.height ();
int h = ((RH + 23)/24) * 24;
int32_t img_seg_height = h;
Cmd_serial.push_back (Poscmd ({27, 64}));
RECV Data!!
Qbytearray cmd;
int32_t img_seg_count = h/img_seg_height;
for (int si = 0; si < Img_seg_count; si++) {cmd.clear ();
Cmd.append (29);
Cmd.append (118);
Cmd.append (48);
Cmd.append ((char) 0);
Cmd.append ((char) (rw% 256));
Cmd.append ((char) (rw/256));
Cmd.append ((char) (img_seg_height% 256));
Cmd.append ((char) (img_seg_height/256));
for (int ph = 0, ph < img_seg_height; ph++) {for (int rwi = 0; rwi < RW; rwi++) {char t = 0x00;
for (int j = 0; J < 8; ++j) {int image_x = RWI * 8 + J;
int image_y = ph + si * img_seg_height;
int V; if (image_y >= RH) {v = 0;
} else {v = qblue (Img.pixel (image_x, image_y)) < 0xc0? 1:0;
} t |= (v << (7-j));
} cmd.append (t);
}} cmd_serial.push_back (cmd);
} cmd_serial.push_back (Poscmd ({29, 86, 66, 0}));
return cmd_serial; }
Where cmd_serial is the POS command sequence, which is sent sequentially to the POS machine.