cairo-types.xml   [plain text]


<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-Types">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-Types.top_of_page">Types</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CAIRO Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Types</refname>
<refpurpose>Generic data types</refpurpose>
</refnamediv>

<refsynopsisdiv id="cairo-Types.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>typedef             <link linkend="cairo-bool-t">cairo_bool_t</link>;
                    <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                (<link linkend="cairo-destroy-func-t">*cairo_destroy_func_t</link>)             (<parameter><link linkend="void"><type>void</type></link> *data</parameter>);
                    <link linkend="cairo-rectangle-int-t">cairo_rectangle_int_t</link>;
</synopsis>
</refsynopsisdiv>

<refsect1 id="cairo-Types.description" role="desc">
<title role="desc.title">Description</title>
<para>
This section lists generic data types used in the cairo API.
</para>
</refsect1>
<refsect1 id="cairo-Types.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="cairo-bool-t" role="typedef">
<title>cairo_bool_t</title>
<indexterm zone="cairo-bool-t"><primary sortas="bool_t">cairo_bool_t</primary></indexterm>
<programlisting>typedef int cairo_bool_t;
</programlisting>
<para>
<link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> is used for boolean values. Returns of type
<link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> will always be either 0 or 1, but testing against
these values explicitly is not encouraged; just use the
value as a boolean condition.
</para>
<para>
<informalexample><programlisting>
 if (cairo_in_stroke (cr, x, y)) {
     /<!-- -->* do something *<!-- -->/
 }
</programlisting></informalexample>
</para></refsect2>
<refsect2 id="cairo-user-data-key-t" role="struct">
<title>cairo_user_data_key_t</title>
<indexterm zone="cairo-user-data-key-t"><primary sortas="user_data_key_t">cairo_user_data_key_t</primary></indexterm>
<programlisting>typedef struct {
    int unused;
} cairo_user_data_key_t;
</programlisting>
<para>
<link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> is used for attaching user data to cairo
data structures.  The actual contents of the struct is never used,
and there is no need to initialize the object; only the unique
address of a <link linkend="cairo-data-key-t"><type>cairo_data_key_t</type></link> object is used.  Typically, you
would just use the address of a static <link linkend="cairo-data-key-t"><type>cairo_data_key_t</type></link> object.
</para><variablelist role="struct">
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-user-data-key-t.unused">unused</structfield>;</term>
<listitem><simpara>not used; ignore.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-destroy-func-t" role="function">
<title>cairo_destroy_func_t ()</title>
<indexterm zone="cairo-destroy-func-t"><primary sortas="destroy_func_t">cairo_destroy_func_t</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                (*cairo_destroy_func_t)             (<parameter><link linkend="void"><type>void</type></link> *data</parameter>);</programlisting>
<para>
<link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> the type of function which is called when a
data element is destroyed. It is passed the pointer to the data
element and should free any memory and resources allocated for it.
</para><variablelist role="params">
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara>The data element being destroyed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-rectangle-int-t" role="struct" condition="since:1.10">
<title>cairo_rectangle_int_t</title>
<indexterm zone="cairo-rectangle-int-t" role="1.10"><primary sortas="rectangle_int_t">cairo_rectangle_int_t</primary></indexterm>
<programlisting>typedef struct {
    int x, y;
    int width, height;
} cairo_rectangle_int_t;
</programlisting>
<para>
A data structure for holding a rectangle with integer coordinates.
</para><variablelist role="struct">
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-rectangle-int-t.x">x</structfield>;</term>
<listitem><simpara>X coordinate of the left side of the rectangle
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-rectangle-int-t.y">y</structfield>;</term>
<listitem><simpara>Y coordinate of the the top side of the rectangle
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-rectangle-int-t.width">width</structfield>;</term>
<listitem><simpara>width of the rectangle
</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-rectangle-int-t.height">height</structfield>;</term>
<listitem><simpara>height of the rectangle
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.10</para></refsect2>

</refsect1>

</refentry>