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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnView: PasteFromClipboard & Transparency

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AScomp Posted - Dec 31 2020 : 20:49:22
Hello,

first of all, I wish everybody a happy new year! ;-)

And here is my question: I would like to paste an image from the clipboard to a TImageEnView including transparency. Unfortunately, the image loses its transparency once pasted.


           if ImageEnViewClipboard.Proc.CanPasteFromClipboard() then begin
              ImageEnViewClipboard.EnableAlphaChannel := true;
              ImageEnViewClipboard.IEBitmap.AlphaChannel.Location := ietbitmap;
              ImageEnViewClipboard.IO.Params.Bmp_HandleTransparency := True;
              if ImageEnViewClipboard.Proc.PasteFromClipboard() then
                 ImageEnViewClipboard.IO.SaveToFilePNG('C:\Ascomp\Programme\Delphi\ImageFormer\ImgFormerV1.0\test.png');
           end;


Here the copied image in Photoshop with transparency (on the upper left side, just for demonstrating). Copied using Ctrl + C.



Here what has been generated by ImageEnViewClipboard.IO.SaveToFilePNG call (be not irritated: the picture has no transparency at the top left, but is white).



Any ideas?

Thank you in advance!

Kind regards

Andreas
4   L A T E S T    R E P L I E S    (Newest First)
AScomp Posted - Jan 03 2021 : 14:53:32
Hi Nigel,

great, thank you very much for the excellent support!

Kind regards

Andreas
xequte Posted - Jan 03 2021 : 14:32:24
Hi Andreas

Those two options won't affect pasting. One that you will need is:

ImageEnView1.EnableAlphaChannel := True;

or

ImageEnView1.IEBitmap.AlphaChannel; // Create an alpha channel if it does not exist

Nigel
Xequte Software
www.imageen.com
AScomp Posted - Jan 02 2021 : 08:03:24
Hi Nigel,

thank you for getting back.

I tried copying with Adobe Photoshop Elements and with Windows 10 Paint, both resulted in non-transparent images.

Now I tried with GIMP and it works properly.

Would you suggest to add

ImageEnViewClipboard.IEBitmap.AlphaChannel.Location := ietbitmap;
ImageEnViewClipboard.IO.Params.Bmp_HandleTransparency := true;

Because I recognized that it works without these lines properly as well.

Thank you very much!

Kind regards

Andreas
xequte Posted - Jan 01 2021 : 22:31:08
Hi Andreas

What application are you copying from? To include the alpha channel when pasting, the source application needs to support the PNG clipboard format. The standard Windows bitmap clipboard format does not support alpha.

Also, in v9.2.6 and older you need to be pasting the whole image to ImageEn, not pasting to an existing selection. From 9.3.0, pasting to a rect will support the alpha channel.



Nigel
Xequte Software
www.imageen.com