[When the printer driver compression mode is selected]
(1)For the [ESC] SG0;
(2)How to compress data
Compression is performed for every data of one line specified for the number of graphic width dots.
The data is made up in units of 8 dots. A repeated value is encoded in 2 bytes. The first byte is a numeric value n indicating that a value is repeated
The range is between
If a value is not repeated, the first byte is the numeric value m. The length of the values is indicated in (m+1). The range of “m” is between 0 and 126. The length of the repetition of the value “n” and ”m” should not exceed 127 and 126, respectively.
If it exceeds the range, it should be divided into blocks of repetition.
When the same contents as the data for 1 line appear repeatedly in the next line and after, the number of lines in which the same contents appear is encoded in 2 bytes. The first byte is fixed as 127. The second byte indicates “N” times that the same contents are repeated. Its range is between 1 and 255. “N” should not exceed 255. If it exceeds the range, the data for the excess number of times should be compressed as the new data of 1 line, and the remaining number of repetitions should be encoded.
[Example] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Data before being compressed | (Width: 120 dots, Height: 300 lines) |
|
|
| |||||||||||||
Line No. | Graphic data |
|
|
|
|
|
|
|
|
|
|
|
|
| |||
1 |
| AAh | AAh | AAh | AAh | AAh | AAh | AAh | BBh | CCh | DDh | EEh | FFh | FFh | |||
|
| FFh | FFh |
|
|
|
|
|
|
|
|
|
|
|
|
| |
2 |
| AAh | AAh | AAh | AAh | AAh | AAh | AAh | BBh | CCh | DDh | EEh | FFh | FFh | |||
|
| FFh | FFh |
|
|
|
|
|
|
|
|
|
|
|
|
| |
299 |
| AAh | AAh | AAh | AAh | AAh | AAh | AAh | BBh | CCh | DDh | EEh | FFh | FFh | |||
|
| FFh | FFh |
|
|
|
|
|
|
|
|
|
|
|
|
| |
300 |
| AAh | AAh | AAh | AAh | AAh | AAh | AAh | BBh | CCh | DDh | EEh | FFh | FFh | |||
|
| FFh | FFh |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Data after being compressed |
|
|
|
|
|
|
|
|
|
|
|
| |||||
Line No. | Graphic data |
|
|
|
|
|
|
|
|
|
|
|
|
| |||
1 |
| FAh | AAh | 03h | BBh | CCh | DDh | EEh | FEh | FFh |
|
|
|
| |||
2 to 256 |
| 7FH | FFH |
|
|
|
|
|
|
|
|
|
|
|
|
| |
257 |
| FAh | AAh |
| 03h | BBh | CCh | DDh | EEh | FEh | FFh |
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 to 300 |
| 7FH | 2BH |
|
|
|
|
|
|
|
|
|
|
|
|
|
FAh =
FEh =
FFh is repeated 3 times.
CCh DDh EEh) without
AAh is repeated 7 times.
- 214 -