How to do an InvertRect ?

The page is there:

Is it possible to use it with 2015-2017 (2018) Xojo versions (it use User32.lib and User32.dll), and if so, what can be its Xojo syntax.

Long time ago (more than 15 years), I used it, but I lost my archives, so…

Use: ? Invert Drop areas images (I actually use two images to do that when only one is enough).

From memory:

The InvertRect call is in User32

You get the hdc of the graphics using


The RECT will be a pointer to a memoryblock holding 4 LONGs (probably 32bit UINTs)
left, top, right, bottom

try something like:

Declare Function InvertRect Lib “User32” (ByVal hdc As Integer, mb as memoryblock) As Integer

Thanks Jeff, I will try it.

Use the TRANSFORM function… it is VERY FAST

myPic.RGBSurface.Transform map_invert
dim map_invert(255) as integer
for i=0 to 255
next i

Here are a few maps I created years a go for a Paint program I wrote

For i=0 To 255
// Sepia Map
// Invert Colors
map_invert(i) = 255 - i
// 216 Websafe Colors
map_websafe216(i)=round(i/&h33)*&h33 ' 216 color WEBSAFE
// 64 Websafe Colors
map_websafe64(i)=round(i/&h55)*&h55 ' 64 color WEBSAFE
// Gray Scale
// * 0.299 * 0.587 * 0.114
Next i

Hi Dave,

Thank you for both answers.

I really love the Transform idea (not the answer of the question but A VALID ANSWER !)

Best of all, it works on Windows (tried on XP right now) and so certainy do the same on macOS (and Linux) !!!

OK: I was (still) am tired… I searched in the docs and found the (!) example there to be used near as is (!). It works fine (not like I wanted, bit gaves the expected result). I will let the night and be back by tomorrow morning to adjust the example as I want it.

Nota: there is an error in the code @ RGBSurface.Transform .
Line 2 miss a k in the konstant name.

I had that InvertRect in a memory case (in my brain) and I keep the idea, my brain was focussed to that idea :frowning: when a multipurpose solution was in the LR !!!.