perl:tk:一种允许对输出进行像素级控制的方法/小部件

发布于 2024-08-27 03:45:04 字数 204 浏览 5 评论 0原文

我想要像画布这样的东西,但是除了可以在画布上绘制的所有提供的几何形状之外,我还可以轻松地操纵像素。

是否可以将 GD::Image 之类的东西嵌入到画布中?那么我也许可以使图像透明并在其中设置一些像素(GD::Image->setPixel())将其定位在画布上?

ps:好吧,这不一定是 perl,因为大多数脚本(而不仅仅是)语言的所有库似乎都有绑定。

I want something like a canvas, but where i'd be able to manipulate pixels easily in addition to all the provided geometries, that can be drawn on canvas.

Is it possible to embed something like GD::Image into a canvas? So then I maybe could make the image transparent and set some pixels in it (GD::Image->setPixel()) positioning it over the canvas?

ps: well, that doesn't necessarily have to be perl, as there seem to be bindings for all the libs for most scripting (and not only) languages.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2024-09-03 03:45:04

Tk 的画布并非旨在提供像素级控制,但您可以通过放入图像项并操作其中的像素来实现。我不确定 GD::Image,但我知道你可以使用支持透明度的 Tk 照片图像来做到这一点,并且默认情况下已经透明很长时间了。

使用图像进行此操作的另一个优点是,它们可以在项目列表中重新堆叠、隐藏、删除、添加回等等。这为您提供了很大的空间,如果您只是绘制原始图像,这些事情会有点尴尬。

Tk's canvas isn't designed to provide pixel-level control, but you can do it by putting an image item in and manipulating the pixels in that. I'm not sure about the GD::Image, but I know you can do this with the Tk photo image which supports transparency, and has been transparent by default for quite a long time now.

The other advantage of doing it with images is that they can be restacked within the list of items, hidden, removed, added back in, etc. This gives you a lot of scope for things which would be moderately awkward if you just drew raw.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文