<?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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>&nbsp;:</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>
