Pixel Matching Using RGBSurface

I’m using RGBSurface to do pixel matching in an app that compares pictures on the clipboard with pictures in a database. It works in OS X and it previously worked in Windows until recently when identical pictures started failing to match. My code hasn’t changed so something must have changed either in Windows or the IDE but I can’t figure out what. Here is the code:

rgb1 = ClipPic.RGBSurface
rgb2 = DBPic.RGBSurface
w = ClipPic.width - 1
h = ClipPic.height - 1
For x = 0 to w
     For y = 0 to h
          If rgb1.pixel(x,y) = rgb2.pixel(x,y) then
               Match = True
          Else
               Match = False
               Exit
          End if
     Next
Next

Switched to Xojo 2016R4.1 ?
Turned on HDI?

[quote=320388:@Jeff Tullin]Switched to Xojo 2016R4.1 ?
Turned on HDI?[/quote]
Yes to both.

Flip a coin.
Xojo Windows version changed to using Direct2D in this build and is by several accounts unusable for graphics work.
(I havent switched yet… )

Alpha channel is not well managed in Windows in 2016r4.1
I filed a case in Feedback but I cannot refer to it because this morning Feedback doesn’t work (at least for me).

I went back and turned off Hi-DPI but it didn’t have any effect on the problem, pixel matching still doesn’t work in Windows. I’ll have to go back and try it with an older version of Xojo and see if it starts working again.

I went back and turned off Hi-DPI but it didn’t have any effect on the problem, pixel matching still doesn’t work in Windows. I’ll have to go back and try it with an older version of Xojo and see if it starts working again.

I went back and ran my project file in 2015r4 and had the same problem. Doesn’t matter if GDI+ or Hi-DPI are on or off. I don’t know what changed but pixel matching using RGBSurface has stopped working in Windows 10.

Did you trash the Xojo cache ?

That’s what another user here told me when I assisted in a HiDPI-savvy grayscale method.
For others participating in the Pre-Release tests: <https://xojo.com/issue/47346>

I think I finally got it all sorted out. Pixel matching works up to 2016r3, before GDI+ was dropped. In addition to pixel matching not working in 2016r4.1, I also found that Clipboard.Picture becomes nil in Windows once the picture is passed to a variable even though the picture is still present on the clipboard. It looks like the pixel matching problem is related to the absence of GDI+, not sure why Clipboard.Picture becomes nil after the picture is passed to a variable. Neither of these problems occur in OS X.

Sorry, I didn’t respond to that question when you initially asked it. I did delete all the Xojo temp files I could find but the problem appeared to be related to saving the project file in 2016r4.1. Once saved in 2016r4.1 pixel matching would continue to fail in older versions of the IDE. I went back to a version of the project file that was saved in 2016r2 and ran it in 2016r3 and it worked. I made the necessary changes to the source code and did the build for the update I was working on in 2016r3 so that pixel matching would continue to work for my customers.