If you are the developer of an image editing software and want to support alphachannel for images in the clipboard do the following:
Additional to the image in the gdi format, add a custom format to the clipboard named "SimpleImageWithAlphaChannel". (Call RegisterClipboardFormatW(L"SimpleImageWithAlphaChannel")).
The content of this clipboardformat is as follows:
The first 4 bytes contain the width of the image in pixels.
The next 4 bytes contain the height.
Then follows the imagedata. 4 Bytes per pixel in BGRA format. (the same that gdi uses for 32bit bitmaps)
The following conditions have to be fulfilled in order for Clipboarder to accept the image:
- If the image has the dimensions x * y, the size of this clipboardformat must be 8+x*y*4.
- The dimensions of the gdi image must be the same as the one in the image with alphachannel.
If Clipboarder finds the image with alphachannel in the clipboard, it will ignore the opaque image (it only checks that the dimensions are the same). If an application requests an opaque image from Clipboarder it will just take the image with alphachannel und put it on white background.