porting gdk -> cairo
- From: Allin Cottrell <cottrell wfu edu>
- To: gtk-app-devel-list gnome org
- Subject: porting gdk -> cairo
- Date: Tue, 10 Aug 2010 10:16:18 -0400 (EDT)
I gather from recent discussion on the gtk-devel list that a good
deal of the old GDK drawing API may be removed for GTK 3 in favor
of use of cairo: in particular GdkGC seems likely to disappear.
There appear to be good arguments for this, but it means some
extra work for people trying to get their apps GTK3-ready.
Benjamin Otte has some notes on porting at
http://blogs.gnome.org/otte/2010/07/27/rendering-cleanup/ but
there's one piece of GDK code I've been using for which I can't
figure out the cairo equivalent and I wonder if anyone can help.
The context is zooming to a selected portion of a graphic
displayed in a GTK window. If the user selects a Zoom menu item
she can then drag out a rectangular outline on the current image,
and when the mouse button is released the view snaps to the chosen
rectangle.
The tricky part is avoiding a horrible mess as the user drags the
rectangle. This is achieved via a cycle of draw-display-erase as
the mouse pointer moves. In GDK, the "erase" part is done by
redrawing the last-shown rectangle using an inverted GdkGC:
gdk_gc_set_function(gc, GDK_INVERT);
How would you do this in cairo? Thanks.
--
Allin Cottrell
Department of Economics
Wake Forest University
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]