# ImmutableBitmap = 3

**URL:** <https://forum.xojo.com/t/immutablebitmap-3/49875>\
**Category:** General\
**Created:** [August 15, 2019, 1:16pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875 "2019-08-15T13:16:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 1:16pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/1 "2019-08-15T13:16:51Z")

</div>

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

```auto
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:

[http://documentation.xojo.com/api/graphics/picture.html#picture-type](http://documentation.xojo.com/api/graphics/picture.html#picture-type)

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:

```auto
{{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`

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [August 15, 2019, 1:44pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/2 "2019-08-15T13:44:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [August 15, 2019, 1:54pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/3 "2019-08-15T13:54:28Z")

</div>

Documenetation seems screwy - for example the information you want should be here: [http://developer.xojo.com/hidpi-support](http://developer.xojo.com/hidpi-support) but the website is redirecting to the home page.

Edit: it’s found here: [https://documentation.xojo.com/topics/graphics/hidpi\_support.html](https://documentation.xojo.com/topics/graphics/hidpi_support.html)

I emailed [docs@xojo.com](mailto:docs@xojo.com) about the URL problems.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 2:40pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/4 "2019-08-15T14:40:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 2:50pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/5 "2019-08-15T14:50:06Z")

</div>

In [http://documentation.xojo.com/api/graphics/picture.html#picture-type](http://documentation.xojo.com/api/graphics/picture.html#picture-type) , 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

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [August 15, 2019, 2:57pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/6 "2019-08-15T14:57:58Z")

</div>

Its JUST the value of the specific value of the enum  
[http://documentation.xojo.com/api/graphics/picture.html#picture-types](http://documentation.xojo.com/api/graphics/picture.html#picture-types)  
there is no “meaning” other than “its an immutable bitmap”

```auto
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

break
```

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

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

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 4:20pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/7 "2019-08-15T16:20:34Z")

</div>

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 😉

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

---

<div class="post-metadata">

**Author:** ![Norman\_Palardy](https://forum.xojo.com/user_avatar/forum.xojo.com/norman_palardy/32/169_2.png) [@Norman\_Palardy](https://forum.xojo.com/u/Norman_Palardy)\
**Post date:** [August 15, 2019, 4:39pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/8 "2019-08-15T16:39:37Z")

</div>

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 ([http://documentation.xojo.com/api/files/folderitem.html.Type](http://documentation.xojo.com/api/files/folderitem.html.Type))

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 5:37pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/9 "2019-08-15T17:37:53Z")

</div>

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

```

Else  
// 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  
Clip.Close[/code]

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

On El Capitan / current Xojo.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [August 15, 2019, 5:52pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/10 "2019-08-15T17:52:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [August 15, 2019, 6:21pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/11 "2019-08-15T18:21:32Z")

</div>

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:

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

RGBSurface is meant to work on Clip\_Pict, but no.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:03pm UTC](https://forum.xojo.com/t/immutablebitmap-3/49875/12 "2021-04-29T16:03:41Z")

</div>


