ImmutableBitmap = 3

I wanted to know whatkind of object I have in the code below, but the debugger says:

Picture ImmutableBitmap = 3

Used code:

[code]Dim Clip As New Clipboard

If Clip.PictureAvailable Then // Break Point set here
If Clip.RawDataAvailable(“public.png”) Then[/code]

I have searched the LR and found:

But no explanation for the Integer value (here: 3).

I know (because I checked with AppleScrips) I have a png Class in the Clipboard.

Why did I searched ? Because the pasted image holds:

{{TIFF picture, 30022}, {«class 8BPS», 309676}, {GIF picture, 20599}, {«class jp2 », 26308}, {JPEG picture, 15824}, {«class PNGf», 39933}, {«class BMP », 1069034}, {«class TPIC», 240586}}

and I get an UnsupportedOperationException while using RGBSurface (elsewhere in the Project). The file loaded from disk does not behave this Exception. So, I suppose Xojo gets the image’s first Class (a TIFF image), so I directed my code to get the png Class image instead (a bit more complex to get).

The message I get is:

[b]An exception of class UnsupportedOperationException was not handled. The application must shut down.[/b] Exception Message: Cannot modify a read-only image

I seem to recall that pictures loaded from a file are immutable (they cannot be changed directly), hence the Exception when using RGBSurface.

Try creating another picture object, and drawing the loaded picture into that

Documenetation seems screwy - for example the information you want should be here: but the website is redirecting to the home page.

Edit: it’s found here:

I emailed about the URL problems.

Thank you for your answers.
My question was bad written because I do not get the answer I was awaiting.

a. The question is not about an ImmutableBitmap image that can or cannot be changed, but what means a value of 3 (three).

b. Your first URL is not bad, but it does not have the correct casse…
I do not readed yet the text @ provided link, but I do not know what HIDPI Support have to do here.
I’m going to read the page.

In , I was awaiting some explanation for:

ImmutableBitmap = 1 Explanation for integer value 1 ImmutableBitmap = 2 Explanation for integer value 2 ImmutableBitmap = 3 Explanation for integer value 3 ImmutableBitmap = 4 Explanation for integer value 4

These value are what I get in the debugger, so some explanation are needed.

And, in fact, what I was searching is the type of the Picture: png, tiff, jpeg, bmp and so on…

Its JUST the value of the specific value of the enum
there is no “meaning” other than “its an immutable bitmap”

Dim p1 As Picture.Types
Dim p2 As Picture.Types
Dim p3 As Picture.Types
Dim p4 As Picture.Types

p1 = Picture.Types.Image
p2 = Picture.Types.ImmutableBitmap
p3 = Picture.Types.MutableBitmap
p4 = Picture.Types.Vector


the explanation is “this is an image type that you cant change - its immutable”

its NOT the image format (png, jpeg, etc)

Thank you Norman for the explanation. It now is clear on both what Types is and how/why to use it.

BTW: my focus was at 200% in my problem and I do not understand (skip the word) Enum from the page (I printed it to pdf 'cause my internet access is very, very slow).

That is not what I was seeking. I am actually doing something else, I will come back to this when I will have enough of the current things :wink:

Ah ! I remember now what I was doing when I was stopped in my tracks. I will add a note afaic before I forgot ;).

once you have an image In memory there is no “picture format”
its a “picture” and quite generic
but you CAN tell from the file you opened to read it what the image format is as that folderitem has a “type” that should match one of your defined filetypes (

My question was a bit long and complex.

I noticed that when I put with a Paste an image in a Canvas, I get a crash. When I load that very same image, I do not have that crash.

The crash appears in the use of a RGBSurface.

Some days ago, I noticed that the Picture (inside the running application) have to have a Graphics “part”. So, I started to explore what I have in my Clipboard and my clipboard is full of different images Classes (tiff / png / etc. read the original question). So I took the image in the png class (or format or…) from the Clipboard. The problem still arise.

Here the code I use:

[code]Dim Clip As New Clipboard

If Clip.PictureAvailable Then
If Clip.RawDataAvailable(“public.png”) Then
Dim Pict_MB As MemoryBlock
Dim Clip_Pict As Picture

// Paste the PNG available Picture
Pict_MB = Clip.RawData("public.png")
cImage.Backdrop = Picture.FromData(Pict_MB)

Clip_Pict = New Picture(cImage.Backdrop.Width, cImage.Backdrop.Height)
Clip_Pict.Graphics.DrawPicture Picture.FromData(Pict_MB),0,0
cImage.Backdrop = Clip_Pict

// Set a Copy in Offscreen_Pict
Offscreen_Pict = Clip.Picture

// Paste the available Picture
cImage.Backdrop = Clip.Picture

// Set a Copy in Offscreen_Pict
Offscreen_Pict = Clip.Picture

End If
End If

// Close the Clipboard instance

Later, I use RGBSurface (.Pixel) and get a crash as I explained far above (UnsupportedOperationException).

On El Capitan / current Xojo.

I don’t see where you are creating a “mutable” picture

clip.picture is immutable, and setting offscreen=clip does nothing but make a copy of the pointer, it doesn’t change any attributes

I too do not understand…

I’ve added a break point in the first If line of the shared code above and follow step by step. I looked carefully the Debugger and saw ImmutableBitmap = 3; because I do not knew the meaning of the 3 value, I asked here.

Hours after that I wrote:

Clip_Pict.Graphics.DrawPicture Picture.FromData(Pict_MB),0,0

RGBSurface is meant to work on Clip_Pict, but no.