Page 1 of 1

PostPosted: Tue Mar 04, 2003 12:45 pm
by chan
I think I might have found a bug in CopyRect. What I am currently trying to do is to copy a rectangle from another buffer onto a display buffer using the overlay mode. When I copy the rectangle onto a white area of the screen, the rectangle is displayed properly. However, when I copy the rectangle onto a portion of the screen where there are already pixels of another color, for example red, the image colors seems to be messed up. Is the Overlay mode supposed to work like this or am I doing something wrong?
Thanks in advance for any help.

PostPosted: Tue Mar 04, 2003 1:35 pm
by jstadolnik
This is not a bug.

What overlay mode does is logically "OR" the bits of the source and destination pixels.

If say you have pixel in the destination which has color index 0x55, and the pixel from the source buffer is set to 0xa5, the resulting pixel will have color index 0xf5, which is probably some bizarre color not intended. As such it is best ensure that the destination area has been cleared out of colored pixels before "overlay" mode is used.

One neat trick you can do is to put a grayscale or color image in a buffer and then use CopyRect in overlay mode to place the image behind black text (on a white background). This technique can be used to give your apps a "skin".


The PToolboxLib guy.