<?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-quartz-surface">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-quartz-surface.top_of_page">Quartz Surfaces</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAIRO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Quartz Surfaces</refname>
<refpurpose>Rendering to Quartz surfaces</refpurpose>
</refnamediv>

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

<synopsis>
#define             <link linkend="CAIRO-HAS-QUARTZ-SURFACE--CAPS">CAIRO_HAS_QUARTZ_SURFACE</link>
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-quartz-surface-create">cairo_quartz_surface_create</link>         (<link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         unsigned <link linkend="int">int</link> width,
                                                         unsigned <link linkend="int">int</link> height);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-quartz-surface-create-for-cg-context">cairo_quartz_surface_create_for_cg_context</link>
                                                        (<link linkend="CGContextRef">CGContextRef</link> cgContext,
                                                         unsigned <link linkend="int">int</link> width,
                                                         unsigned <link linkend="int">int</link> height);
<link linkend="CGContextRef">CGContextRef</link>        <link linkend="cairo-quartz-surface-get-cg-context">cairo_quartz_surface_get_cg_context</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
</synopsis>
</refsynopsisdiv>









<refsect1 id="cairo-quartz-surface.description" role="desc">
<title role="desc.title">Description</title>
<para>
The Quartz surface is used to render cairo graphics targeting the
Apple OS X Quartz rendering system.
</para>
</refsect1>

<refsect1 id="cairo-quartz-surface.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CAIRO-HAS-QUARTZ-SURFACE--CAPS" role="macro">
<title>CAIRO_HAS_QUARTZ_SURFACE</title>
<indexterm zone="CAIRO-HAS-QUARTZ-SURFACE--CAPS"><primary sortas="CAIRO_HAS_QUARTZ_SURFACE">CAIRO_HAS_QUARTZ_SURFACE</primary></indexterm><programlisting>#define             CAIRO_HAS_QUARTZ_SURFACE</programlisting>
<para>
Defined if the Quartz surface backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2 id="cairo-quartz-surface-create" role="function" condition="since:1.4">
<title>cairo_quartz_surface_create ()</title>
<indexterm zone="cairo-quartz-surface-create" role="1.4"><primary sortas="cairo_quartz_surface_create">cairo_quartz_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_quartz_surface_create         (<link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         unsigned <link linkend="int">int</link> width,
                                                         unsigned <link linkend="int">int</link> height);</programlisting>
<para>
Creates a Quartz surface backed by a CGBitmap.  The surface is
created using the Device RGB (or Device Gray, for A8) color space.
All Cairo operations, including those that require software
rendering, will succeed on this surface.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> format of pixels in the surface to create
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> width of the surface, in pixels
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> height of the surface, in pixels
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly created surface.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-quartz-surface-create-for-cg-context" role="function" condition="since:1.4">
<title>cairo_quartz_surface_create_for_cg_context ()</title>
<indexterm zone="cairo-quartz-surface-create-for-cg-context" role="1.4"><primary sortas="cairo_quartz_surface_create_for_cg_context">cairo_quartz_surface_create_for_cg_context</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_quartz_surface_create_for_cg_context
                                                        (<link linkend="CGContextRef">CGContextRef</link> cgContext,
                                                         unsigned <link linkend="int">int</link> width,
                                                         unsigned <link linkend="int">int</link> height);</programlisting>
<para>
Creates a Quartz surface that wraps the given CGContext.  The
CGContext is assumed to be in the standard Cairo coordinate space
(that is, with the origin at the upper left and the Y axis
increasing downward).  If the CGContext is in the Quartz coordinate
space (with the origin at the bottom left), then it should be
flipped before this function is called.  The flip can be accomplished
using a translate and a scale; for example:
</para>
<para>
<informalexample><programlisting>
CGContextTranslateCTM (cgContext, 0.0, height);
CGContextScaleCTM (cgContext, 1.0, -1.0);
</programlisting></informalexample>
</para>
<para>
All Cairo operations are implemented in terms of Quartz operations,
as long as Quartz-compatible elements are used (such as Quartz fonts).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cgContext</parameter>&#160;:</term>
<listitem><simpara> the existing CGContext for which to create the surface
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara> width of the surface, in pixels
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>height</parameter>&#160;:</term>
<listitem><simpara> height of the surface, in pixels
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly created Cairo surface.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-quartz-surface-get-cg-context" role="function" condition="since:1.4">
<title>cairo_quartz_surface_get_cg_context ()</title>
<indexterm zone="cairo-quartz-surface-get-cg-context" role="1.4"><primary sortas="cairo_quartz_surface_get_cg_context">cairo_quartz_surface_get_cg_context</primary></indexterm><programlisting><link linkend="CGContextRef">CGContextRef</link>        cairo_quartz_surface_get_cg_context (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
<para>
Returns the CGContextRef that the given Quartz surface is backed
by.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara> the Cairo Quartz surface
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the CGContextRef for the given surface.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>

</refsect1>



<refsect1 id="cairo-quartz-surface.see-also">
<title>See Also</title>
<para>
<itemizedlist>
<listitem><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link></listitem>
</itemizedlist>
</para>
</refsect1>

</refentry>
