Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: Alextp on September 13, 2020, 03:14:23 pm

Title: Xor colors of rect
Post by: Alextp on September 13, 2020, 03:14:23 pm
I need to Xor all pixels in a rect, with the same color n.
For TCanvas, I did Pixels[i,j]:= Pixels[i,j] xor n.
For TBgraBitmap, I cannot find how to.
I tried to use FillRect with DrawMode all values, but got not expected result colors.
dmDrawTransparent comment tells it must do xor?
Title: Re: Xor colors of rect
Post by: circular on September 16, 2020, 10:46:54 am
That would be using dmXor mode.

Note that it would Xor the alpha channel as well which is probably not what you want to do, so specify the color for example like that: BGRA(255,255,255, 0).

Otherwise you can use CanvasBGRA property where you can set the pen mode as you would do with Canvas.
TinyPortal © 2005-2018