The new HasAlphaChannel - Plugins Cocoa

Is there some gotcha that I may be missing regarding the new alpha channel, in Cocoa, similar to the 7bit gotcha in Console mode for the alpha channel.

So here is what is happening…

I create new picture using the 2 param constructor, to get it with alpha channel. (The returned image has HasAlphaChannel = true)

But I consistently get all sorts of artifacts on Cocoa

With this test setting it to 50% alpha:

rowPtr[0] = (unsigned char)128; // We set the alpha to half
rowPtr[1] = rowBuffer[(x4)+2]; // Red
rowPtr[2] = rowBuffer[(x
4)+1]; // Green
rowPtr[3] = rowBuffer[(x*4)]; // Blue

Then we get this on cocoa:

Now if I just set rowPtr[0] = 255 (No alpha) then the image has no errors.

If I return it the old way, having mask, then also the image is just fine, and if I convert the returned just fine picture inside Xojo to new style
If input.HasAlphaChannel Then Return input

Dim result As New Picture( input.Width, input.Height )
result.Graphics.DrawPicture( input, 0, 0 )
Return result

Then its also just fine.

So question is…Is there something else behind the scenes that a plugin can’t do or something I need to think differently about ? (Like the awfulness of the 7bit masks on Console) ??

The lower number I put in the alpha channel the more messed the picture gets.

I am guessing its the Pre-multiply thing that is getting me there

Yes, please premultiply.
Or just return masked images…