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
 Copy TBitmap to clipboard with transparency?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

934 Posts

Posted - Nov 30 2024 :  14:47:39  Show Profile  Reply
I create a TBitmap from an external object (the bitmap is not originally transparent and has a solid non-transparent background):

    ABitmap := AOfficeImage.GetAsBitmap;
    ABitmap.Transparent := True;
    ABitmap.PixelFormat:= pf32bit;
 
    // Copy the Bitmap to the clipboard:
    With TImageEnProc.Create( nil ) do
    begin
      AttachedIEBitmap.Assign(ABitmap);
      AttachedIEBitmap.AlphaChannel;
      AttachedIEBitmap.AlphaFill(0);

      CopyToClipboard(False); // clipboard image is still intransparent
      Free();
    end;

    ABitmap.Free;


*****

Other approach with TBitmap helper function:

    ABitmap := AOfficeImage.GetAsBitmap;
    ABitmap.Transparent := True;
    ABitmap.PixelFormat:= pf32bit;

    ABitmap.Proc.CopyToClipboard(False); // image is still not transparent

    ABitmap.Free;

xequte

38627 Posts

Posted - Dec 01 2024 :  00:41:56  Show Profile  Reply
Hi

Yes, that code should include a PNG clipboard format that includes an alpha channel (in fact the pasted image should be completely blank in applications that support an alpha channel).

What application are you you pasting into?

Also check that AttachedIEBitmap.AlphaChannel.Full = False.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: