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
 Loading and showing icons from EXE file

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
PeterPanino Posted - May 29 2023 : 10:56:22
What is the best way to:

1. Load all icons from an EXE file

2. Show them in a MultiView

3. Copy any of them to the clipboard by preserving their transparency

I have looked at the ResourceLoader demo in: Demos\InputOutput\ResourceLoader
I added a Copy button to the ResourceLoader demo:

procedure TMainForm.ButtonCopyClick(Sender: TObject);
begin
  ImageEnView1.Proc.CopyToClipboard();
end;


After having loaded Windows Notepad, I copied its icon and then pasted it into a TImageEnView app:



You can see that the transparency was perfectly preserved.

However, when I paste it into any other Graphics program, the transparency is lost:



I suppose this is because of ImageEnView1.Proc.CopyToClipboard adding the native ImageEn format to the clipboard formats.

So how can I copy the image to the clipboard in a format where any other graphics program recognizes the transparency?

UPDATE: Even when I add the PNG clipboard format by:
IEGlobalSettings().ClipboardCopyFormats := [iefImageEn, iefPNG];
...then several Graphics programs still do not recognize the transparency. Perhaps the Proc Copy clipboard formats should avoid the Bitmap formats and keep only the PNG and ImageEn formats in the clipboard so other programs are not tempted to load the Bitmap formats at pasting?
8   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 02 2023 : 03:18:39
A user has advised me that IrfanView doesn’t keep the alpha channel in memory (merges it). So pasting PNG is not supported.



Nigel
Xequte Software
www.imageen.com
xequte Posted - Jun 01 2023 : 03:56:59
Hi

Have you tested copying content to the clipboard using only PNG format to see whether it changes the way IrfanView supports it. I would be surprised if Irfanview would default to a Bitmap format when a PNG one is supported and available, and if it does you should be reporting it as a bug to the Irfanview developers.

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Jun 01 2023 : 02:46:23
This is not the case with some applications like the popular image viewer IrfanView: When pasting an image copied by TImageEnView, the transparency is not preserved. So please add an overload that EXPLICITLY creates only the clipboard formats specified by the user. This would prevent some programs from using the clipboard bitmap formats created by ImageEn (these Bitmap formats do not contain transparency information).
xequte Posted - May 30 2023 : 12:29:21
Hi Peter

It should not be necessary. The destination application should be iterating through the available formats to use the most compatible one.

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - May 30 2023 : 08:37:37
Hi Nigel

It's not the Ctrl+C handling I'm interested in. It's just a suggestion for Proc.CopyToClipboard: Please add an overload that EXPLICITLY creates only the clipboard formats specified by the user. That would be very helpful.
xequte Posted - May 30 2023 : 02:51:37
Hi Peter

Do those programs support pasting of 8bit alpha images from other applications?

ImageEn's copying functionality cannot be further customized, so you might want to disable the Ctrl+C handling and write your own method for it.

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - May 29 2023 : 15:15:38
So I need to copy ONLY these formats from TImageEnView to the clipboard:

PNG
C4FF IMAGEEN RAW FORMAT

...and NOT these formats:

CF_BITMAP
CF_DIB
CF_DIBV

How can this be done?
PeterPanino Posted - May 29 2023 : 13:56:38
I have now tried this approach:

procedure TMainForm.ButtonCopyClick(Sender: TObject);
begin
  // Save IEBitmap to MemoryStream as PNG:
  var MemoryStream := TMemoryStream.Create;
  try
    ImageEnView1.IEBitmap.Write(MemoryStream, ioPNG);
    MemoryStream.Position := 0;

    // Load MemoryStream into TPngImage:
    var Png := Vcl.Imaging.pngimage.TPngImage.Create;
    try
      Png.LoadFromStream(MemoryStream);

      // Copy PNG to clipboard:
      Clipboard.Assign(Png);
    finally
      Png.Free;
    end;
  finally
    MemoryStream.Free;
  end;
end;


But it does not work - the image pasted from the clipboard has no transparency: