Pictures loaded with Picture.Open are also now immutable. As a result, the RGBSurface and Graphics objects are now nil. – Greg O’Lone
Mac Xojo 2021 R3.1
I suspect that the O’Lone quote I grabbed off the forum is relevant, but I am not sure how to proceed.
I am trying to analyze the pixels in a JPEG that I have as a file on my Mac. I can load the JPEG into a picture variable (myPict) and I can draw it onto a Canvas (myCanvas) in the Paint event of myCanvas.
g.DrawPicture(myPict, 50, 50). That works fine and I can see the picture.
However,
Var surf As RGBSurface = Self.myPict.RGBSurface
creates a surf with a value of Nil. So I cannot get the values of the individual pixels in the picture which is the goal.
I can create another Picture variable
Var anotherPic As New Picture(300,300)
anotherPic will have a non-Nil RGBSurface. I can Paint myPIct on to anotherPic
anotherPic.Graphics.DrawPicture(myPict, 0, 0)
And it will be visible but it does not register on the RGBSurface of anotherPic. The values returned from surf will ignore the pixels of the Picture.
What is the correct procedure to get a picture from disk and analyze its pixels? I want to be able to read the RGB values of various pixels in the Picture and then change other pixels in the same Picture. I don’t see how I can do this without an RGBSurface and I do not know how to get an RGBSurface of a picture that I have gotten from disk.
I do not want a reference to the picture on disk. I want a copy of that picture that I can fool around with.