Mojave and Transparent images

From the documentation:

To create a Picture with an alpha channel, use the new constructor that omits the depth parameter:

In theory it’s still possible to create images with those bit depths (with some declares and memory blocks), however I’m not sure how much I trust that documentation as it talks about using CGLayers, which have been deprecated for many years (after they got broken in 10.10 and never fixed).

This is yet another gripe I have with the annual macOS releases, not only is there simply not enough time to ship a rock solid and reliable version, there isn’t time to test that OS update and there sure isn’t time to make sure the documentation is up to date.

[quote]From the documentation:
To create a Picture with an alpha channel, use the new constructor that omits the depth parameter:
[/quote]

Not sure why you quoted that , Emile.
I wasn’t using alpha channel, because in theory I didn’t need to.
And I have now already worked around the issue in that way.

ALSO from the documentation, (which I guess now needs to be amended in a hurry to say it’s the only game in town under Mojave)

[quote]Picture.Transparent Property (As Integer )
aPicture.Transparent = newIntegerValue
Controls the transparency of the white ‘layer’ of the picture.

Transparent can take on either of the following values:
0 - Not transparent.
1 - White is transparent.[/quote]

After checking my code I have lots and lots of legacy code with bit depth 32. And nowhere I can see black blobs. Example:

dim p as new Picture(Size * 2, Size * 2, 32) p.Graphics.ForeColor = theColor p.Graphics.FillRoundRect(0, 0, Size * 2, Size * 2, theCorner, theCorner) 'some more code g.drawpicture p, (Size + Gap) * currentColor, 0, Size, Size, 0, 0, p.Width, p.Height

This is the only change I saw from ,32 (Mask) to nothing (Transparency).

I can be wrong of course and do not saw (or forgot) another change in Picture.

[code]dim p as new Picture(Size * 2, Size * 2, 32)

p.transparent = 1
//this is the problem … your sample code is a white rect with a color roundrect on it.
//And very little white - only a couple of pixels in the corners
//but it wasnt transparent

p.Graphics.ForeColor = theColor
p.Graphics.FillRoundRect(0, 0, Size * 2, Size * 2, theCorner, theCorner)
'some more code
g.drawpicture p, (Size + Gap) * currentColor, 0, Size, Size, 0, 0, p.Width, p.Height[/code]

Its the transparent = 1 thing that caused the issue for me in Mojave.
Where white should be transparent (and is in High Sierra and earlier), under Mojave the ‘transparent’ areas show up solid black.

So removing the ,32 parameter gets us an ‘initially transparent’ picture.
Then anything drawn on it using the 3 RGB values is assumed to be not transparent.
(I expect that colors using RGBA can have varying degrees of transparency but haven’t made use of that yet.)

I added transparent = 1 and there is no difference: no black blobs.

What I found since Retina was added to Xojo is that the debugger doesn’t show the a good representation of the drawn code anymore (see <https://xojo.com/issue/53114>). Transparency is handled in most cases automatically.

I use many Picture with depth but never used the transparent setting, just create a mask picture and apply that mask to the picture.
Seems to continue working fine in Mojave.

If I remember well I had some issues with transparency settings years ago and was recommended also to work with depth pictures if color management is needed.