Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] How to remove a pixel / paint with transparent color?

This thread is locked; no one can reply to it. rss feed Print
[A5] How to remove a pixel / paint with transparent color?
TeaRDoWN
Member #8,518
April 2007
avatar

Say that I have a transparent bitmap 3x3 pixels. Now say that I fill all pixels with red color (255,255,255,255). Finally say that I want the middle pixel (1,1) to be transparent. I cannot paint (0,0,0,0) since that is invisble paint and the result will still be red in that middle pixel.

Is there a way of removing a pixel restoring the transparent pixel which was there before I painted the red color?

weapon_S
Member #7,859
October 2006
avatar

Set the blender to ignore alpha. Putpixel will work too. (You'd have to call put blended pixel to use the alpha channel.)
P.S. al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO)
P.P.S. subtraction is also a possibility.

TeaRDoWN
Member #8,518
April 2007
avatar

Funny thing just after posting I remembered that command and was going to tested that when I had time. :)

So al_put_pixel put a pixel with THAT color in the bitmap at x,y no matter what color is currently at x,y?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: