GTK / GDK算法对所有显示器进行完整截图 [英] GTK/GDK Algorithm to take full screenshots of all monitors
本文介绍了GTK / GDK算法对所有显示器进行完整截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对整个GTK游戏相当陌生,并且想创建一个算法来截取所有显示器的屏幕截图。
我正在考虑以下几点:-
gdk_display_manager_list_displays
- 每个显示可以有多个屏幕(屏幕意味着监视器?),所以使用
gdk_display_get_n_screens
来从1
- 从
2
获取所有屏幕的root gtk窗口 - 为每个屏幕的每个根gtk窗口创建新的Pixbuf从
3
用gdk_pixbuf_new
- 填充每个pixbuf
4
与gdk_pixbuf_get_from_drawable
用于从3
每个相应的根窗口用于从每个相应的屏1
(可能需要gdk_drawable_get_size
code> 2 和gdk_window_get_origin
,其中每个参数都指向pixbuf) -
gd k_pixbuf_get_pixels
对于每个PIXBUF gdk_display_manager_list_displays
- each display can have multiple screens (screens means monitors?) so use
gdk_display_get_n_screens
to get monitors per display from1
- get root gtk window of all screens from
2
- create new Pixbuf for each root gtk window for each screen from
3
withgdk_pixbuf_new
- fill each pixbuf from
4
withgdk_pixbuf_get_from_drawable
for each respective root window from3
for each respective screen from2
for each respective display from1
(may need togdk_drawable_get_size
andgdk_window_get_origin
for each for args to pixbuf) gdk_pixbuf_get_pixels
for each pixbuf
醇>
这是一个可行的解决方案?
解决方案
如果您确信 cRootWin
不是NULL和 cWidth
和 cHeight
大于0,那么你应该检查一下 by the doc 。
疯狂的猜测是你的程序确实没有足够的内存来存储像素图(通常为6 Mb)。我会尝试分配12 Mb来查看是否属于这种情况。
I'm fairly new to the whole GTK game and want to create an algorithm to take screen shot of all monitors.
I was thinking something along these lines:
Is this a workable solution?
解决方案
If you are sure cRootWin
is not NULL and cWidth
and cHeight
are greater than 0 then you should check for some additional problem mentioned by the doc.
A wild guess is your program does not have enough memory to store the pixmap (typically 6 Mb). I would try to allocate the 12 Mb just to see if this is the case.
这篇关于GTK / GDK算法对所有显示器进行完整截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文