gdk_pixbuf_composite用法

发布于 2024-08-20 08:40:05 字数 410 浏览 2 评论 0原文

我有两个 png 图像,第一个图像的 Width1 2247 Height1 190,第二个图像的 Width2 155 Height2 36。我不想将第二个图像(src)放置在第一个图像(dest)的中心。我创建了两者的像素缓冲区并使用 gdk_pixbuf_composite ,如下所示。

gdk_pixbuf_composite( srcpixbuf, dstpixbuf, 1000, 100, width2, height2, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 255);

我在第一张图像上得到了 width2 和 height2 的模糊窗口。

如果我将 width2 和 height2 替换为 1.0,那么我不会在 dstimage 上获取 srcimage。我哪里出错了?

I have two png images First one with Width1 2247 Height1 190 and second one with Width2 155 Height2 36. I wan't the second image(src) to be placed in the center of first image(dest). I created pixel buf of both and used gdk_pixbuf_composite as follows.

gdk_pixbuf_composite( srcpixbuf, dstpixbuf, 1000, 100, width2, height2, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 255);

I get a hazy window of width2 and height2 on the first image.

If I replace width2 and height2 with 1.0 then I don't get the srcimage on the dstimage. Where am I going wrong?

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

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

发布评论

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

评论(1

世态炎凉 2024-08-27 08:40:05

gdk_pixbuf_composite( srcpixbuf, dstpixbuf, 1000, 100, width2, height2, 1000, 100, 1, 1, GDK_INTERP_BILINEAR, 255);

这解决了。对offset参数的理解错误。基本上创建了一个中间缩放图像,并且仅合成由目标宽度、高度表示的部分。因此,就我而言,我们需要将整个未缩放的图像移动到目标偏移量,这是由 offset 参数完成的。

gdk_pixbuf_composite( srcpixbuf, dstpixbuf, 1000, 100, width2, height2, 1000, 100, 1, 1, GDK_INTERP_BILINEAR, 255);

This solved. Wrongly understood the offset parameter. Basically an intermediate scaled image is created and only the part represented by the dest wid, height is composited. So in my case we need to move the entire unscaled image to the destination offset which is done by the offset parameter.

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