gpt4 book ai didi

gtk - 如何在其绘制信号处理程序中获取 GtkDrawingArea 的无效区域

转载 作者:行者123 更新时间:2023-12-03 09:03:23 25 4
gpt4 key购买 nike

the Reference Manual of GtkDrawingArea ,它说

Draw signals are normally delivered when a drawing area first comes onscreen, or when it’s covered by another window and then uncovered. You can also force an expose event by adding to the “damage region” of the drawing area’s window; gtk_widget_queue_draw_area() and gdk_window_invalidate_rect() are equally good ways to do this. You’ll then get a draw signal for the invalid region.

那么如何在绘制信号的处理程序中获取无效区域呢?是剪辑区域吗?

最佳答案

这在the documentation for the draw signal itself中得到了回答:

The signal handler will get a cr with a clip region already set to the widget's dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can get a finer-grained representation of the dirty region with cairo_copy_clip_rectangle_list().

gdk_cairo_get_clip_rectangle()cairo_clip_extents() 的包装器,它使用整数而不是浮点坐标,因此如果您想要 float ,也可以使用后一个函数 -改为点坐标。

关于gtk - 如何在其绘制信号处理程序中获取 GtkDrawingArea 的无效区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48732330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com