我可以以某种方式在GTK2中的expose事件中blit一部分PNG文件吗?我可以在Pixbuf中加载PNG并使用Cairo将Pixbuf用作画笔,但我不知道我怎么只能使用PNG的矩形(1,1,10,10)
作为画笔。有人能指出我正确的方向吗?
答案 0 :(得分:1)
cairo_image_surface_create_from_png
是创建以开罗为中心的PNG曲面的好方法。然后,您可以使用cairo_surface_create_for_rectangle
来限制cairo_surface_t
的大小。然后使用cairo_set_source_surface
将create_for_rectangle
返回的曲面用作源或画笔。