gpt4 book ai didi

delphi - 从 Delphi 2009 图像列表中提取 PNG 图像

转载 作者:行者123 更新时间:2023-12-03 15:58:57 25 4
gpt4 key购买 nike

Delphi 2009 的 TImageList 通过将 PNG 图像添加到图像列表编辑器中来支持它们。有没有办法从 TImagelist 中提取 TPngImage 并保留 alpha channel ?

我想做的实际上是从一个 TImageList 中提取图像,制作它们的禁用版本,然后将它们添加到另一个 TImageList 中。在此操作期间,我当然希望保留 PNG 图像的 Alpha channel 。

最佳答案

我用 Delphi 2006 做了类似的事情。

TImageList 包含一个 protected 方法 GetImages。可以使用“ protected 错误”访问它

type
TGetImageImageList = class (TImageList) // Please use a better name!
end;

您可以将图像列表转换为 TGetImageImageList 以获取 GetImages。

begin
TGetImageList(ImageList).GetImages(index, bitmap, mask);
end;

Bitmap 包含位图,mask 是决定透明部分的黑白位图。

您现在可以更改位图并使用以下方法存储它:

function Add(Image, Mask: TBitmap): Integer;

我希望这能为您提供足够的指导来进一步探索。

关于delphi - 从 Delphi 2009 图像列表中提取 PNG 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/166676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com