#: 20139 S12/OS9/68000 (OSK)
18-Jul-94 00:31:38
Sb: #20138-#mm2hp
Fm: LARRY OLSON 72227,3467
To: Bob van der Poel 76510,2203 (X)
> You are completely correct that the program is trying to send more dots
> than the printer can handle. However, I don't think that the answer is to
> convert 8 bits to 7, etc. Remember, each byte of data is just a bit
> stream...and the bits represent pixels. On a 256 color screen each byte
> represents one pixel; on a 16 color 4 bits are 1 pixel. So what really
> needs to be done is to take each pixel (4 or 8 bits) and convert that to a
> grey scale (or even a color value if you are using a color ink jet
> printer). It sort of works by just dumping the raster image...but it is not
> the _correct_ way to do it.
Bob,
You are right that the pixels will need to be converted to a grey
scale. Each screen byte would be changed to a 7 bit pattern, something
like the following: ( assuming 256 color pixel)
pixel value 7 6 5 4 3 2 1
0 - 31 2 2 2 2 2 2 2
32 - 63 2 2 2 2 2 2 2 = black
64 - 95 2 2 2 2 2 = white
96 - 127 2 2 2 2
128 - 159 2 2 2
160 - 191 2 2
192 - 223 2
224 - 255
Then these 7 bit values would be packed back into 8 bit bytes to be
sent to the printer.
bytes to be set to printer
byte 1 byte 2 byte 3 byte 4
8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1
_________________ _________________ _________________ _________________
|1|2|3|4|5|6|7|1| |2|3|4|5|6|7|1|2| |3|4|5|6|7|1|2|3| |4|5|6|7| | | | |
|----- 1------|------ 2 -------|------- 3 ------|------- 4 ------|
each pixel is represented by 7 bits
My biggest problem at this point is the working with bits in C, I'm
real shaky with C as it is, without doing this fancy stuff.
I'll let you know if I get anywhere with this
----- Larry Olson -----
There is 1 Reply.
|