rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (10/15/89)
You people want to blit mirror image? Here's some ideas.
First, most obvious solution. Do a single pixel column at a time. For
an mxn blit, by d bitplanes, you will need m*d blits, each n words long,
for a total of 3*m*n*d memory references not counting setup (which is
appreciable in this case.)
A slight improvement is to try to do each bit0->bit15 in one blit.
Problem with this is you need one channel to increment and the other
to decrement. This can be done with modulos, using a width of 1,
providing the width in words times the height of your rectangle is
<= 1024, and that your rectangle spans the entire bitmap. If these
conditions are met, a total of 16 blits are all that is required.
Best, though, is simple table lookup:
char table[256] ;
for (i=0; i<256; i++)
for (b=0; b<8; b++)
if (i & (1 << b))
table[i] |= (128 >> b) ;
Now, for each byte in the source image, look it up in the table,
and if necessary, shift it some bits. Very fast, very easy.
-tom