gtk.gdk.CairoContext
gtk.gdk.CairoContext — object providing support for drawing using Cairo (new in PyGTK 2.8)
Synopsis
class gtk.gdk.CairoContext(pangocairo.CairoContext): |
Description
Cairo is a graphics library that supports vector graphics and
image compositing that can be used with PyGTK. Since 2.8, GTK+ and Pango do
most of their drawing using Cairo. The Cairo drawing model and primitives
are similar to PostScript which uses an imaging model of painting on a two
dimensional surface. There is a Python module that wraps the Cairo API that
is used by PyGTK via subclassing of the cairo.Context class by the pangocairo.CairoContext
class. The cairo.Context class provides most of the drawing primitives used
for drawing on Cairo surfaces.
PyGTK (and GTK+ and GDK) does not wrap the Cairo API, instead
gtk.gdk.CairoContext
objects can be used to draw on gtk.gdk.Drawable
objects. A gtk.gdk.CairoContext
is created using the gtk.gdk.Drawable.cairo_create
()
method. See the pangocairo.CairoContext
and Python cairo module documentation for additional methods.
Methods
gtk.gdk.CairoContext.set_source_color
def set_source_color(color
)
| a gtk.gdk.Color |
Note
This method is available in PyGTK 2.8 and above.
The set_source_color
() method sets the
source color of the cairo context to the gtk.gdk.Color
specified by color
. See the
cairo.Context.set_source_rgb() method for more information.
gtk.gdk.CairoContext.set_source_pixbuf
def set_source_pixbuf(pixbuf
, pixbuf_x
, pixbuf_y
)
| a gtk.gdk.Pixbuf |
| the X coordinate of the location to place the
upper left corner of pixbuf . |
| the Y coordinate of the location to place the
upper left corner of pixbuf . |
Note
This method is available in PyGTK 2.8 and above.
The set_source_pixbuf
() method sets the
gtk.gdk.Pixbuf
specified by pixbuf
as the source pattern for the
cairo context. The pattern has an extend mode of
cairo.EXTEND_NONE
and is aligned so that the origin of
pixbuf
is at the location specified by
pixbuf_x
, pixbuf_y
.
gtk.gdk.CairoContext.rectangle
def rectangle(rectangle
)
| a gtk.gdk.Rectangle
or a 4-tuple representing a rectangle |
Note
This method is available in PyGTK 2.10 and above.
The rectangle
() method adds the
rectangle specified by rectangle
to the current
path.
gtk.gdk.CairoContext.region
def region(region
)
| a gtk.gdk.Region |
Note
This method is available in PyGTK 2.10 and above.
The region
() method adds the
gtk.gdk.Region
specified by region
to the current
path.
gtk.gdk.CairoContext.set_source_pixmap
def set_source_pixmap(pixmap
, pixmap_x
, pixmap_y
)
| a gtk.gdk.Pixmap |
| the X coordinate of the location to place the
upper left corner of pixmap . |
| the Y coordinate of the location to place the
upper left corner of pixmap . |
Note
This method is available in PyGTK 2.10 and above.
The set_source_pixmap
() method sets the
gtk.gdk.Pixmap
specified by pixmap
as the source pattern for the
cairo context. The pattern has an extend mode of
cairo.EXTEND_NONE
and is aligned so that the origin of
pixmap
is at the location specified by
pixmap_x
, pixmap_y
.