问题标签 [timagelist]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
218 浏览

delphi - 在 GrayScale 中绘制来自 TPngImageList 的位图图像

TImageListFalse允许您使用作为最后一个参数将其中一个图像绘制到处于禁用状态的位图。

我想这样做,也想灰度目标位图。

我有以下代码:

这样做的问题是生成的图像具有白色背景。

在此处输入图像描述

如何让背景透明?

我正在使用 TPngImageList,因为它比常规 TImageList 更好地处理 Png 图像。(在 XE4 中)

0 投票
1 回答
481 浏览

delphi - When using styles, bitmaps of imagelists on toolbars get masked in an unexpected way

Description:

I am using PNG loaded imagelists to allow transparency in my menu's and speed buttons. Also using runtime themes to allow user defind GUI experiance.

If no style is selected, a.k.a. the "Windows" style, nice masks are generated for my toolbar, and everything works as expected. However, when I activate a style (no matter which one) a very strange rendering of the masks is performed, where some buttons appear to be empty (first and prior buttons) when disabled , and some (post and cancel buttons) actually do show a minimal mask of the original image.

Research: I have created a VCL style testing app, and am prying into the VCL to find out exactly how the drawing process proceeds. My research on SO here came with this more or less related topic, but id dint really help to get around my problem.

Meanwhile I can imagine someone else has bumbed into this and can point me in the rioght direction.

The question:

I am looking for a way to have these masks displayed correctly, or auto generated (like this link) which allows the work it as expected even when using VCL styles. This could by creating masks automatically in my imagelists, or , preferably, by changing the behavior that generates masks for the styles custom drawing.

Standard style shows toolbar fine: Standard style shows toolbar fine

Using custom style, no images on buttons: using custom style, no images on buttons

Another custom style, and you will even miss the buttons Another custom style, and you will even miss the buttons

BTW: "Dont use styles" would not be the answer I am looking for.

0 投票
1 回答
796 浏览

delphi - 从 TImageList 保存透明(alpha 通道)PNG

我有一个TImageList包含透明图标(32 位,带 alpha 通道)。我想要做的是将基于图像索引的单个图标保存为 PNG 文件,同时保留 alpha 通道透明度。使用 RAD Studio 2010 所以它有TPngImage支持,不需要第三方库。使用此处的方法将图像从 PNG“sprite”图像加载到 TImageList -使用 Delphi XE 在运行时将 png 图像添加到图像列表- 因此在加载时会保留透明度。现在我需要单独保存它们,换句话说,从已经加载到 TImageList 中的精灵图像中提取单个图像。

到目前为止我的代码:

上述方法有效,但它以白色背景保存(保存后不保留透明度)。我可能错过了一个简单的步骤,但无法弄清楚。

Delphi 代码也很受欢迎,应该不难翻译。

0 投票
1 回答
614 浏览

delphi - 使用 PNG 图标缩放 TImageList 以实现高 DPI 模式

我想让 HeidiSQL 具有高 dpi 意识,其中包括升级我的一个 TImageList ,其中包含许多 alpha 透明的 PNG 图标。

我已经烘焙了一个程序,但是它破坏了正常的透明度和 alpha 透明度,所以图标看起来很破碎,特别是在它们的边缘:

在此处输入图像描述

这是代码:

我还尝试了来自 Žarko Gajić 的一些代码,但这确实只是消除了图像的透明度,即使没有实际缩放。

Paint.net 对其图标进行了很好的缩放,但它是用 C# 编写的,所以这无济于事:

在此处输入图像描述

0 投票
1 回答
358 浏览

delphi - TImagelist 不添加位图

我已经走到了尽头......试图让一个自定义的图片列表、一个 TImageList 和一个 TListView 一起工作。原问题:列表中不显示动态添加的图片。缩小范围,问题出在 TImagelist 中。代码如下。ilMain 是 TImagelist(在别处定义)。将位图添加到列表中,立即检索它,首先“绘制”工作正常,但 sedond 失败......我在这里错过了什么?

编辑:

对此做了一些进一步的测试;结果非常混乱和不一致。

结果实际上很大程度上取决于输入文件的大小(感谢那个指针,kobik!);似乎小于 256x256 的所有内容都没有导入到图像列表中,而沿 X 轴的较大图片(有时??)分布在多个项目上。

ilMain 设置为 256x256 像素。

下面是几个输入尺寸(X x Y,以像素为单位)的输出: 950x414 第一次绘制显示整个图像,第二次在左上角绘制 256x256 像素。但是,填充了 TImagelist 的三个项目,具有 3x 256x256 像素:可以从主图片“切出”的三张图片仍然是 256x256 像素。所有小于 256x256 的边缘(垂直或水平)都将丢失。

1600x1600 导入六张图片;第一行完整的 256x256 块,可以从图片顶部切割。tp 右侧的不完整块被省略,Y 大小 256 以下的所有行也被省略。

1500x1000 同上一张;现在进口五件。

638x376 再次相似;现在只有两个项目“适合”。

197x256(我的原始测试文件,在上面的帖子中描述)没有导入项目(X-size 小于 TImaglist X-size?)

再次 256x256,未导入数据

257x257 仍然没有数据导入

260x260 仍然没有导入数据

300x300 仍然没有导入数据

512x256 非常奇怪的一个。导入一张图片;但是它的尺寸减小了,因此大约 70% 的原始图片适合(新的)256 X 尺寸。图片下方添加了一个黑条,以弥补由于这种收缩而丢失的空间。

所以这就是我现在停止测试的地方,想知道是否有人可以在这里阐明......?

编辑:设计部分移至新问题(请参阅评论 kobik 中的请求,谢谢!)

0 投票
1 回答
131 浏览

delphi - TImageList/TListview:正确的设计选择?

这是一个关于选择正确的 Delphi 组件的问题。

使用 Delphi 开发新应用程序。

我希望让我的用户有一个(他自己的,在硬盘上)图片列表(现在只是 jpg,但将来应该支持不同的格式),将它们导入我的应用程序,然后将它们显示给他一个 TListView。我打算将 TListView 绑定到 TImageList (因为这是开箱即用的)......但是当我尝试时,我遇到了一系列关于将 jpg 导入 TImageList 的奇怪问题,报告如下:

TImagelist 不添加位图

所以我想知道,我是否将组件用于它们不打算用于的东西?具体来说,TImageList(即使在导入时进行了一些预格式化)对于这种自由式所有尺寸和格式允许的东西有用吗?

任何建议表示赞赏!

0 投票
0 回答
167 浏览

delphi - 使用抗锯齿调整 TImageList 中的图像大小

我下载图像,调整它们的大小并使用 StackOverFlow 上的以下代码插入它们:

虽然这可行,但我的 ListView 中的图像最终会被像素化。它们如何出现抗锯齿?我使用 Delphi 10.2 Rio 并使用 FMX。

0 投票
1 回答
133 浏览

delphi - 如何将动态文本写入导航栏使用的 TImageList 中的图像?

我最近遇到了一种情况,我需要为用于导航栏的图像编写计数器,其中图像来自 imagelist 组件。

在绞尽脑汁看了几个小时后,查看了其他文章,例如:

如何从 ImageList 加载透明图像?

如果使用 v6 ImageList 控件,*.bmp 会丢失透明背景

http://codeverge.com/embarcadero.delphi.graphics/timage-is-not-transparent-after-a/1080826

http://www.efg2.com/Lab/Library/Delphi/Graphics/ICOtoBMP.pas.txt

我选择了一个解决方案,从图像列表中复制位图,将文本写入位图画布,然后将位图放回图像列表中。

唯一的问题是我失去了透明度,我一生都无法弄清楚如何找回它。

如果我使用 GetIcon 而不是 GetBitmap,我可以提取并重新分配图像,包括透明度,但是我没有 Canvas 来使用 TextOut。

如果我设置颜色以使图像在链接到图像列表的组件中看起来正确,比如我的导航栏,那么当您使用 GetBitmap 提取图像时,透明度会丢失,并且在直接应用于TImage时看起来是白色的。

好的。没问题。只需使用白色作为透明色...

没有。即使将 16777215 显示为颜色,与clWhiteCanvas.Pixels[0, 31]的值相同,但将其用于TransparentColour没有任何效果。

要明白我的意思,请在 Delphi 中创建一个新的 VCL 表单应用程序,放置几个TButtons和一个TImageList ,然后通过在设计器中设置按钮Images属性将第二个按钮链接到图像列表。双击第一个按钮并将事件代码设置为:

现在在图像列表中添加一个不透明的位图(根据需要更改大小。我使用 32x32 像素位图)。默认情况下,组件将透明颜色显示为左下角的像素。保持原样并确定图像列表更改。将第二个按钮的ImageIndex更改为 0。

您现在应该看到添加到第二个按钮上显示的图像列表的位图,透明颜色是透明的。

现在单击第一个按钮。第二个按钮上的图像更改为显示“100”,但透明的现在变成了白色。

0 投票
1 回答
893 浏览

delphi - 如何用 ImageList 中的另一个图像替换 TSpeedButton 中的图像?

在我的程序中,SpeenButton 的图像由 imagelist 设置。当我单击速度按钮时,我需要用图像列表中的另一个图像更改图像。我怎样才能做到这一点?

0 投票
0 回答
103 浏览

android - 适用于 Android / iOS 的最佳图标大小

我正在使用 TImageList 为 android/iOS 手机/平板电脑编写 Delphi 应用程序。

我可用的最大图标大小为 96x96。我应该提供 3 种尺寸 24x24、48x48、72x72、96x96 还是应该提供 3 种尺寸:32x32、64x64、96x96 或 24x24、48x48、96x96(3 是否足够?)

在 TImageList 中。

谢谢。