Recent

Author Topic: Xor colors of rect  (Read 253 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Xor colors of rect
« 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?

circular

  • Hero Member
  • *****
  • Posts: 3563
    • Personal webpage
Re: Xor colors of rect
« Reply #1 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.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018