Pixel transformation problem

Hi, I have a problem with some pixel transformation.

I explain.

I have some drawings on my FrameBuffer (the drawings I want to display), and I have to modify the LSB of each component (R, G, B, A).

ie, If I have a green rectangle (R=0, G=128, B=0)
So I could need to transform my rectangle in a rectangle of color (R=1, G=127, B=1)
ie I have to change the LSB of each component color.

How can I do this?
Is there a way to use blending functions, or a drawPixel?

Finally, it is just a AND operation between my present FrameBuffer and a ‘transformation’ rectangle, but I don’t know how to do this.

Thanx a lot