Retina switch confusion

A long long time ago I converted my app to Retina with the usual IDE script line

Call DoShellCommand("/usr/bin/defaults write " + AppPath + "/Contents/Info ""NSHighResolutionCapable"" YES")

and everything worked fine. Today I used the new option in the build settings for Retina in 2016r11 and to my astonishment I saw a couple of incorrectly drawn icons (not a big deal). But why do I suddenly get a NOE for the following code:

[code]Function MakeDarker(extends OriginalPicture as Picture, theAmount as Double) As Picture

'change the value (lighter or darker) for the Original Picture

dim OriginalHeight as integer = OriginalPicture.height
dim OriginalWidth as integer = OriginalPicture.width
dim OriginalRGBS as RGBSurface = OriginalPicture.RGBSurface

dim ResultPicture as new Picture(OriginalPicture.Width, OriginalPicture.Height, 32)
dim ResultRGBS as RGBSurface = ResultPicture.RGBSurface

for currentX as Integer = 0 to OriginalWidth
for currentY as Integer = 0 to OriginalHeight
dim theColor as Color = OriginalRGBS.Pixel(currentX, currentY) '<—noe here
ResultRGBS.Pixel(currentX, CurrentY) = HSV(theColor.Hue, theColor.Saturation, theColor.Value * theAmount)

ResultPicture.Mask = OriginalPicture.mask

Return ResultPicture

End Function[/code]

Shouldn’t the result between the IDE script and the switch in the IDE be the same?

When you have the Retina setting turned on, pictures dragged onto the ide and opened with Picture.Open are immutable And thusly have no Graphics or RGBSurface to manipulate and OriginalRGBS is Nil.

You’ll probably also need to use OriginalImage.CopyMask on the second to last line.

Another thing you could do here is to start by doing a DrawPicture to transfer the OriginalPicture onto the ResultPicture and then manipulate the pixels directly.

@Greg: thanks for the explanation.