2018r3: RGBSurface.Transform(map) Crash

The last code example in RGBSurface crash with Unsupported… (the Picture is locked.

a. Testing:
Create with Xojo 2018r3 an example and use the code example. Ayyempys with an already (not 2018r3) created example seems to work (there certainly is a difference somewhere).

b. Code example that runs:

[code]// Creative way to invert the Graphics
Const kMaxMapOffset = 255
Dim map(kMaxMapOffset) As Integer
For i As Integer = 0 To kMaxMapOffset
map(i) = kMaxMapOffset - i

Dim somePicture As New Picture(Me.Width, Me.Height)
somePicture.Graphics.DrawPicture Me.Backdrop,0,0

// Display the picture
Me.Backdrop = somePicture

// Ask the image update

I put that in Canvas1.MouseEnter and Canvas1.MouseExit (yes a method ans two calls are better).

before I added the two lines below, the error was in the .Transform(map) line:

Dim somePicture As New Picture(Me.Width, Me.Height) somePicture.Graphics.DrawPicture Me.Backdrop,0,0


I just wrote a Feedback bug report:

53921 - RGBSurface.Transform(map) Crash in 2018r3

Does it work if you add ,32 to the NewPicture call?

Hi Christian,

No change, good catch, but I tested it before adding a temporary Picture.

I tried:

somePicture = Me.Backdrop

but it also crashed.

One thing I do not tested was the presence of a Picture in the Canvas Backdrop (I set one in the .Open Event), so no crash because of that.

Edit: I had the idea to add a Picture because of what I saw in the Debugger (something that Locked Picture error or so).

I tried it and it doesn’t crash here.

Brand new project created with Xojo 2018r3 ?

I ask because it does not crash on a project that was not created with Xojo 2018r3, even if I set the project to 64Bits.
I do not really understand, but since I have a project who crash… and it was created with 2018r3 (he says that to me and refused to be opened with 2015r1).

OK: I will (later today) will create a brand new project with Xojo 2018r3 and check.

You missed to describe if this is Mac/Win/Linux, 32/64 bit?

Did you make sample project for Feedback?
I see above you reference Backdrop. Is that set?

No sample project: I modified a project created on 2018r3 * by a reader of this forum by a simple paste (after testing the code in one of my project also with a simple paste).

As far as I can say, using somePicture = Canvas1.Backdrop create a locked copy of the Backdrop Picture and so Transform(map) crash (check the explanation in the Feedback entry). Using somePicture.Graphics.DrawPicture Me.Backdrop,0,0 does not do that and the Picture colors are inverted without crash.

Ask if you need more testings from me and eventually a brand new example shared here (the example where it crash is not mine).

That example was not openable by Xojo 2015r1 thus my other talk about 2018r3 project not openable with (some) older versions.

As far as i see you just get an exception as you edit a read only picture.

Please only transform editable pictures.

OK. Be it.

But, where in the documentation is that information ?

This is the first time that I read about a Read only Picture.

Worst: I am able to set a Picture to the Canvas Backdrop. How this is R/O but “editable” (replace a Picture with another) ?

PS: All I wanted was to warn about that. Now, I think I will go back in “second millenium mode”.

The read only picture can be used for canvas without problem.
The canvas only reads backdrop to put it on screen.

Since we got HiDPI, we have read only pictures in projects.

We did have read only pictures before, but it was not said explicit.
e.g. 10 years ago a PICT file loaded on Mac with vector graphics was read only.

You find the important stuff distilled in your Xojo folder, Documentation/DesktopHiDPISupport.PDF.
EDIT: And, of course, under http://developer.xojo.com/hidpi-support where Picture links to.