开发者

perl: tk: a way/widget that allows pixel level control over the output

I want something like a canvas, but where i'd be able to manipul开发者_开发知识库ate 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜