Image Transparency Lost in Clipboard Copy

When copying an image with transparencies, the image copies to the clipboard successfully. But when pasting the image into a Xojo canvas, all transparencies are lost. I’ve even tried

Dim xClip as new Clipboard If xClip.PictureAvailable then Dim npic as new Picture(xClip.Picture.Width, xClip.Picture.Height,32) npic = xClip.Picture Window1.Canvas.Backdrop = npic end if

ensuring that the new Picture class object was created with the ability to handle transparencies, before dumping the clipboard into it.

The issue does not appear in Windows systems, transparencies are preserved. Is this a Mac OS bug? or the Mac clipboard has always flattened images? I thought about using a mask to ‘re-create’ the original images, although using color based masks (i.e. at pixel 1x1) is very inefficient since sometimes solid white will want to be preserved in the image itself (not made transparent).

Looking for some input to implement an efficient workaround for this issue. The problem doesn’t lie in Xojo, nor the framework. This is definitely a Mac OSX clipboard issue.

Mac?

I would suggest you try NSPasteboard, e.g. with MBS Plugin.
Put a NSImage inside which contains the image.

The clipboard can do transparency, but maybe Xojo’s implementation doesn’t support it.

The OS X clipboard does indeed support transparency. It’s most likely that the representation which Xojo is obtaining doesn’t. On OS X you can obtain the clipboard image data in many formats.