ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Preserve transparency when copying to clipboard?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

986 Posts

Posted - Jan 14 2014 :  17:37:51  Show Profile  Reply
Hi! How can I COPY an image (previously loaded PNG image with alpha transparency) to the clipboard so that the transparency is preserved when I paste it in any graphics program?

w2m

USA
1990 Posts

Posted - Jan 14 2014 :  18:17:56  Show Profile  Reply
I guess that depends on the graphics program and if the graphic program can handle a image with an alpha channel. There is no way that I know of to guarantee that because you can not change how paste works or even know how paste is handled unless you write the app.

Within ImageEn- Copy preserves PNG transparency:
if ImageEnView1.Selected then
  ImageEnView1.Proc.SelCopyToClip(True)
else
  ImageEnView1.Proc.CopyToClipboard(True);

And Within ImageEn- Paste maintains the PNG transparency:
if ImageEnView1.Proc.IsClipboardAvailable then
begin
  ImageEnView1.Proc.SaveUndoCaptioned
          ('Paste ' + IntToStr(ImageEnView1.Proc.UndoCount));
  if ImageEnView1.Selected then
  begin
    ImageEnView1.Proc.SelPasteFromClip(True);
    ImageEnView1.Update;
  end
  else
    ImageEnView1.Proc.PasteFromClipboard;
end;

I tested Paste with Windows 8.1 Paint and the transparency was not maintained, but with ImageEn itself and with Adobe Photoshop Elements transparency was maintained.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: