1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gdkcairocontext">
<refnamediv>
<refname>gtk.gdk.CairoContext</refname>
<refpurpose>object providing support for drawing using Cairo (new in
PyGTK 2.8)</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.gdk.CairoContext</classname></ooclass>
<ooclass><classname><link
linkend="class-pangocairocairocontext">pangocairo.CairoContext</link></classname></ooclass>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkcairocontext--set-source-color">set_source_color</link></methodname>
<methodparam><parameter role="keyword">color</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkcairocontext--set-source-pixbuf">set_source_pixbuf</link></methodname>
<methodparam><parameter role="keyword">pixbuf</parameter></methodparam>
<methodparam><parameter role="keyword">pixbuf_x</parameter></methodparam>
<methodparam><parameter role="keyword">pixbuf_y</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkcairocontext--rectangle">rectangle</link></methodname>
<methodparam><parameter role="keyword">rectangle</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkcairocontext--region">region</link></methodname>
<methodparam><parameter role="keyword">region</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gdkcairocontext--set-source-pixmap">set_source_pixmap</link></methodname>
<methodparam><parameter role="keyword">pixmap</parameter></methodparam>
<methodparam><parameter role="keyword">pixmap_x</parameter></methodparam>
<methodparam><parameter role="keyword">pixmap_y</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- cairo.Context
+-- <link linkend="class-pangocairocairocontext">pangocairo.CairoContext</link>
+-- <link linkend="class-gdkcairocontext">gtk.gdk.CairoContext</link>
</synopsis>
</refsect1>
<refsect1>
<title>Description</title>
<para>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 <link
linkend="class-pangocairocairocontext"><classname>pangocairo.CairoContext</classname></link>
class. The cairo.Context class provides most of the drawing primitives used
for drawing on Cairo surfaces.</para>
<para>PyGTK (and GTK+ and GDK) does not wrap the Cairo API, instead
<link
linkend="class-gdkcairocontext"><classname>gtk.gdk.CairoContext</classname></link>
objects can be used to draw on <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>
objects. A <link
linkend="class-gdkcairocontext"><classname>gtk.gdk.CairoContext</classname></link>
is created using the <link
linkend="method-gdkdrawable--cairo-create"><methodname>gtk.gdk.Drawable.cairo_create</methodname>()</link>
method. See the <link
linkend="class-pangocairocairocontext"><classname>pangocairo.CairoContext</classname></link>
and Python cairo module documentation for additional methods.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gdkcairocontext--set-source-color">
<title>gtk.gdk.CairoContext.set_source_color</title>
<programlisting><methodsynopsis language="python">
<methodname>set_source_color</methodname>
<methodparam><parameter
role="keyword">color</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">color</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkcolor"><classname>gtk.gdk.Color</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.8 and above.</para>
</note>
<para>The <methodname>set_source_color</methodname>() method sets the
source color of the cairo context to the <link
linkend="class-gdkcolor"><classname>gtk.gdk.Color</classname></link>
specified by <parameter>color</parameter>. See the
cairo.Context.set_source_rgb() method for more information.</para>
</refsect2>
<refsect2 id="method-gdkcairocontext--set-source-pixbuf">
<title>gtk.gdk.CairoContext.set_source_pixbuf</title>
<programlisting><methodsynopsis language="python">
<methodname>set_source_pixbuf</methodname>
<methodparam><parameter
role="keyword">pixbuf</parameter></methodparam>
<methodparam><parameter
role="keyword">pixbuf_x</parameter></methodparam>
<methodparam><parameter
role="keyword">pixbuf_y</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">pixbuf</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">pixbuf_x</parameter> :</term>
<listitem><simpara>the X coordinate of the location to place the
upper left corner of <parameter>pixbuf</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">pixbuf_y</parameter> :</term>
<listitem><simpara>the Y coordinate of the location to place the
upper left corner of <parameter>pixbuf</parameter>.</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.8 and above.</para>
</note>
<para>The <methodname>set_source_pixbuf</methodname>() method sets the
<link linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>
specified by <parameter>pixbuf</parameter> as the source pattern for the
cairo context. The pattern has an extend mode of
<literal>cairo.EXTEND_NONE</literal> and is aligned so that the origin of
<parameter>pixbuf</parameter> is at the location specified by
<parameter>pixbuf_x</parameter>, <parameter>pixbuf_y</parameter>.</para>
</refsect2>
<refsect2 id="method-gdkcairocontext--rectangle">
<title>gtk.gdk.CairoContext.rectangle</title>
<programlisting><methodsynopsis language="python">
<methodname>rectangle</methodname>
<methodparam><parameter
role="keyword">rectangle</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">rectangle</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
or a 4-tuple representing a rectangle</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>rectangle</methodname>() method adds the
rectangle specified by <parameter>rectangle</parameter> to the current
path.</para>
</refsect2>
<refsect2 id="method-gdkcairocontext--region">
<title>gtk.gdk.CairoContext.region</title>
<programlisting><methodsynopsis language="python">
<methodname>region</methodname>
<methodparam><parameter
role="keyword">region</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">region</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>region</methodname>() method adds the
<link linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link> specified by <parameter>region</parameter> to the current
path.</para>
</refsect2>
<refsect2 id="method-gdkcairocontext--set-source-pixmap">
<title>gtk.gdk.CairoContext.set_source_pixmap</title>
<programlisting><methodsynopsis language="python">
<methodname>set_source_pixmap</methodname>
<methodparam><parameter
role="keyword">pixmap</parameter></methodparam>
<methodparam><parameter
role="keyword">pixmap_x</parameter></methodparam>
<methodparam><parameter
role="keyword">pixmap_y</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">pixmap</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">pixmap_x</parameter> :</term>
<listitem><simpara>the X coordinate of the location to place the
upper left corner of <parameter>pixmap</parameter>.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">pixmap_y</parameter> :</term>
<listitem><simpara>the Y coordinate of the location to place the
upper left corner of <parameter>pixmap</parameter>.</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>set_source_pixmap</methodname>() method sets the
<link linkend="class-gdkpixmap"><classname>gtk.gdk.Pixmap</classname></link>
specified by <parameter>pixmap</parameter> as the source pattern for the
cairo context. The pattern has an extend mode of
<literal>cairo.EXTEND_NONE</literal> and is aligned so that the origin of
<parameter>pixmap</parameter> is at the location specified by
<parameter>pixmap_x</parameter>, <parameter>pixmap_y</parameter>.</para>
</refsect2>
</refsect1>
</refentry>
|