CopyRect problem

A PocketC native palm library offering native forms and assorted utilities

Postby chan on Tue Mar 04, 2003 12:45 pm

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.
Posts: 4
Joined: Fri Sep 27, 2002 10:51 am

Postby jstadolnik on Tue Mar 04, 2003 1:35 pm

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.
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest