My primary graphics tool is Paint.Net, but I have found an inadequacy for what I am doing.
Paint.NET copies data to the clipboard in the following formats
PaintDotNet.MaskedSurface
Format17
System.Drawing.Bitmap
Bitmap
DeviceIndependentBitmap
found by examining data.GetFormats() in C#. I cannot use PaintDotNet.MaskedSurface in my application and the others don't provide full transparency information for PNGs. Is there a way to have Paint.NET copy data to the clipboard using "PNG" format?
In my app, I can copy an image into the clipboard using the following code, and all transparency information is retained.
using (MemoryStream stream = new MemoryStream())
{
_Bitmap.Save(stream, ImageFormat.Png);
var data = new DataObject("PNG", stream);
Clipboard.Clear();
Clipboard.SetDataObject(data, true);
}
and I can read the same from the clipboard using the following
IDataObject data = Clipboard.GetDataObject();
if (data.GetFormats().Contains("PNG")){
MemoryStream ms = (System.IO.MemoryStream)data.GetData("PNG");
_Bitmap = (Bitmap)Bitmap.FromStream(ms, true);
}
Can this be accomplished in Paint.NET, or can an extension be created that will do this?
Thanks in advance...