HP (Hewlett-Packard) PCL 5 Printer User Manual


 
Run-length
Encoding
(Method 1)
Run-length encoding interprets raster data in pairs of
bytes. The first byte of each pair is the repetition count for
the data in the second byte. The second byte is the raster
data to be printed. A repetition count of 0 signifies the
pattern in the data byte is not repeated (it occurs only
once). A repetition count of 1 signifies the pattern occurs
twice. The repetition count can range from 0 to 255 for a
repetition of 1 to 256 times.
[(Repetition count byte 0-255)(pattern byte)] . [ . ] [ ]
Tagged Image File
Format Encoding
(Method 2)
Tagged Image File Format encoding interprets raster data
as TIFF “Packbits.” This format combines features of
methods 0 and 1. A control byte precedes the raster data
(pattern bytes). The control byte identifies whether the
pattern byte(s) represent a byte that is to be repeated some
number of times (up to 127), or represent some number of
bytes (up to 127) which are to be printed as is (literally).
The sign of the number in the control byte identifies
whether the byte or bytes that follow represent a literal
pattern or byte to be repeated. A positive number (1 to 127)
indicates that the bytes are literal. A negative number (-1 to
-127), represented by the twos complement, indicates a
repeated byte. The value of the number, if positive (literal),
identifies the number of pattern bytes which follow the
control byte; if negative (repeated), it identifies the number
of times to repeat the following byte. A pattern byte may be
repeated up to 127 times; or up to 127 literal bytes may
follow the control byte.
As mentioned, for a byte to be repeated, the control byte
must be a negative value as represented by the twos
complement. For example, to repeat a pattern three times
would require the twos complement of the number 3. The
twos complement is computed as follows. The binary of 3 is
00000011. Complement each bit to get 11111100, then add
one to this value to produce 11111101, the twos complement.
The decimal value of this number, 253, used in the control
byte, produces a repetition of 3 bytes for a total of 4
occurrences of the pattern.
Raster Graphics 6-21Raster Graphics 6-21