Linux Pictures with Alpha channel

I got a strange issue…

If I create picture in a plugin with alpha channel on Linux (desktop, not console), and populate it then I get blank screen unless I “touch” the image that was returned then it suddenly is fine.

By touch then I mean like this:
returnedImage.Graphics.ForeColor = &cFF0000CC
returnedImage.Graphics.ForeColor Graphics.FillOval 0,0, 1, 1

So what is happening that I need to do in the plugin so that its “updated” ?

Linux creating and populating picture from plugin:

  1. No mask or alpha = fine
  2. Mask = fine
  3. Alpha = Behaves like this where I need to “touch” the image to get it to contain something.

Is there something I should be calling to refresh something that is cached ?

The least destructive way to make the picture valid I found, that does not destroy the picture:

Dim old as Color = p2.Graphics.Pixel(0,0) 
p2.Graphics.Pixel(0,0) = &cFF0000
p2.Graphics.Pixel(0,0) = old

Every single graphics call that actually draws something that is not out of bounds makes it valid.

So what is Xojo doing to the Cairo context in every single graphics call that makes the picture valid ?

Did you call REALpicture Clear Cache function? (in the SDK)

Its Deprecated and I found no documentation of what on earth it does, not a single letter. Nor did I find any replacement of it in Xojo, so imagining its some legacy functionality for some platform ?

Should I be using it for this ?

I just found this one here, its probably this one we need to be calling:


Will test later on when I am by Linux machine.

REALPictureClearCache is needed to tell Xojo that the bitmap changed and anything it made to cache can be thrown away.
e.g. on Cocoa, the picture is a CGBitmapContext and any CGImage derived for drawing is the cache.

On Linux you normally have to tell the system you modified bitmap, because you may only have modified a local copy.

Thank you for the notice on cairo_surface_mark_dirty. I will add that to my plugin.

Confirmed, cairo_surface_mark_dirty fixes the problem.

I don’t know why we see this though now first when tampering with new style alpha channels. But I suspect the Xojo’s DrawPicture method “touches” the other ones in some way, so we did not see it happen there.

But in any case, then its probably safest bet to always use cairo_surface_mark_dirty if actually changing the pixels.