Mail Archives: djgpp/1999/11/05/04:28:12
Flenser <flenser AT cs DOT iastate DOT edu> wrote:
> The operation was called and under Paint Shop's arithmetic operations dialog, that's all
> I know about it. Your idea works fine, I was just hoping that there was some magic
> solution that didn't involve going through each pixel and testing it. Thank you for your
> help.
Well, I think there is (partially). You can reduce the ifs if you
_really_ AND the image. For this, let's say that color 255 is the
one which will show the image, color 0 is the one which will block
the image.
With this assumption, you first clear your final bitmap to black or
white, and then something like:
for (y=0;y<bmp_final->h;y++)
for (x=0;x<bmp_final->h;x++)
putpixel(bmp_final,x,y,
getpixel(bmp_source,x,y) & getpixel(bmp_mask,x,y);
Since 255 is 1111 1111 in bits, your source image will be shown.
Color 0, which is 0000 0000 in bits, will put color 0 on your
destination bitmap.
Ok, so this really is ANDING, which you requested in first place.
Sorry for the "way-round" I initially took :-)
The problem was that I was thinking about an algorithm which you
could feed any image, greyscale it, make it black&white, etc.
Grzegorz Adam Hankiewicz - gradha AT iname DOT com
Gogosoftware - http://welcome.to/gogosoftware/
"She broke my heart. I broke her neck. Now we are even, aren't we?"
- Raw text -