问题标签 [gdkpixbuf]

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 投票
3 回答
3052 浏览

c# - 将位图转换为 GDK# PixBuff

如何将 a 转换System.Drawing.BitmapGDK# Image以便可以设置为图像小部件。

我试过这个...

更新:

例外:

0 投票
1 回答
167 浏览

python - Clutter actor content does not blend like it should

As ClutterTexture is now marked as deprecated, I followed the recommendation and replaced it with a ClutterActor that has it's content set to a pixbuf.

Everything works but when I change the actors opacity to 127, it darkens the background even where it's white.

Here is a git repo with code and screenshot of the problem

When I set the opacity to 255 everything looks like it should, white is then white.

0 投票
1 回答
2823 浏览

c++ - GTKMM :: 在 GTk::Drawing 区域中使用单个 Gdk::PixBuf 绘制多个图像

大家好,我正在尝试在 Gtk::DrawingArea 中绘制实时图像,其方式与它们在火车站、机场、地铁等的监视器中显示的方式相同。

为了当前的测试目的,我已经硬编码了我的代码。

这里是

Gtk::绘图区域宽度=720,高度=640。我有 first.pgm 和 second.pgm 图像,每个图像都有 360*640 尺寸。(是的,我为了测试目的旋转了它。)这些图像每个像素包含一个字节。

1)绘制单个图像时绘制良好。我只是将图像读入大小为 360*640*3 的unsigned char* 缓冲区。我是这样读的

这和我预期的一样,但是当我尝试绘制两个图像时出现了问题。为此,我在缓冲区中读取 first.pgm ,然后读取 second.pgm (意味着总 [360*640*3]*2 字节)现在我绘制它,如代码所示。

在两半中,都会打印 first.pgm。

0 投票
1 回答
1177 浏览

python - 如何在 GdkPixbuf.Pixbuf 上呈现文本

我正在尝试使用 Python 和 Gdk 3 将文本添加到 Pixbuf。

几个小时以来,我一直在网上搜索有关此主题的信息,看来我需要从 pixbuf 创建一个 cairo 上下文。不幸的是,我对 cairo 的经验为零,但我已经能够将这段代码放在一起:

这至少不会导致我的程序崩溃。但是,它生成的 pixbuf 是完全透明的。谁能告诉我我做错了什么,或者是否有更好的方法来做到这一点?

0 投票
1 回答
165 浏览

image - 函数“GdkPixbuf.from_file”不能正常工作

我使用 Lablgtk,除函数“GdkPixbuf.from_file”外的所有函数都运行良好。我可以编译包括函数“GdkPixbuf.from_file”的代码,但我无法执行它。当我输入命令“./programname”来执行它时,我得到一个错误:

可以执行不包含函数“GdkPixbuf.from_file”的代码。我应该怎么做才能使“GdkPixbuf.from_file”功能正常工作?

0 投票
3 回答
2976 浏览

python - GdkPixbuf 返回“gi._glib.GError:无法识别图像文件格式”

我在 Gtk3 中加载 PNG 图像时遇到问题。我在我的 ToolButtons 中损坏了图像符号,经过一番调查,它似乎来自 GdkPixbuf 无法读取 PNG 文件。

我已经用 python 控制台重现了这个问题

我在最后几天遇到的许多问题是由于我们必须编译 Gtk3、pygobject 及其所有依赖项并将它们安装在非标准目录中。我怀疑 gobject 内省存在问题(长列表中的最后一个)。

0 投票
1 回答
479 浏览

memory-leaks - gstreamer 和 gdkpixbuf 接收器占用大量内存 - 可能泄漏

我有一个简单的程序,它逐帧从视频流中读取 GdkPixbufs。问题是内存使用量以每秒大约 300-400MB 的速度增长!这样我的 8GB RAM 很快就用完了。Valgrind / Cachegrind 没有指向我任何地方,所以也许这是 gstreamer 中的错误?

0 投票
2 回答
1794 浏览

c - Memory leak in gdk_pixbuf_new_from_file()

Valgrind reports a memory leak when I run this simple test program:

I'm aware of the issues regarding Valgrind and GLib/GDK/GTK, and of the several StackOverflow answers (such as this one, this other one, and others) regarding this issue.

For GLib it's enough to prefix the valgrind command with G_DEBUG=gc-friendly G_SLICE=always-malloc (though I still have some "still reacheable" leaks, which I ignore if they come from GLib).

However, with this small program I get a lot of "possibly lost" leaks. I have also tried other prefixes, such as G_DEBUG=resident-modules (suggested here) and G_SLICE=debug-blocks (suggested here), but the "possibly lost" leaks remain. I also tried several of the GNOME suppressions, namely the GDK one, but to no avail.

My question is: is my only alternative to create a suppression file for this case or is something wrong with the code?

The program was compiled with:

I'm using GDK-Pixbuf 2.30.7 (Ubuntu 14.04).

Thanks in advance.

0 投票
1 回答
42 浏览

memory-management - Gtk2, Gdk2 内存使用量每帧更新越来越大

我一直在尝试制作一个使用活动窗口并将其显示在其窗口中的程序。我已经成功地超出了我的目标。但问题是,它使用了大量的内存,并且每帧更新(20fps)不断使用更多的内存。这是源代码:

我还制作了一段视频,展示了这个问题: https ://www.youtube.com/watch?v=GNCwNetLLBM

0 投票
1 回答
2393 浏览

python - Change the colour of pixels in a GdkPixbuf (GTK3)

I'm using Gtk.StatusIcon, and want to change the colour of some pixels; I have a working piece of code, this loads a 1x1 pixel PNG file with the colour I want to set, and then copies that to thhe icon Pixbuf.
While this works, it has the obvious drawback of having to create a 1x1 pixel for every colour, so I can't use an arbitrary colour, only the predefined colours I created images for.

How do I set a pixel to an arbitrary RGBA colour?

The code I'm using now (simplified for demonstration purposes):

I tried creating a new Pixbuf object with GdkPixbuf.PixbufLoader, but this seems to expect a PNG image, not a bytes object, so this isn't very helpful:

My next try was to use GdkPixbuf.Pixbuf.new_from_data, which looked promossing:

However, this doesn't work either. It not only sets the pixels to the wrong colour, it also sets it to different colours on multiple invocations of set_icon(); print(fill.get_pixels()) gives me b'\x00\x00\x00'... Am I using this wrong? I tied various different parameters, but all give the same result...

I also found a C example which modified the result of gdk_pixbuf_get_pixels(), since this returns a pointer to the image data. But this is not something you can do in Python (AFAIK).

A little background of what I'm trying to accomplish:
I have a little tray application to show my laptop's battery status; it fills up the battery icon to give an indication of how much battery power is left. Below a certain percentage the colour changes from green to red (this works with the above example), but I would like to have more flexibility in this; eg. allowing other people to set their own shade of green, or use purple, or whatever.