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

<refnamediv>
<refname>Win32 Surfaces</refname>
<refpurpose>Microsoft Windows surface support</refpurpose>
</refnamediv>

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

<synopsis>
#define             <link linkend="CAIRO-HAS-WIN32-SURFACE--CAPS">CAIRO_HAS_WIN32_SURFACE</link>
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-win32-surface-create">cairo_win32_surface_create</link>          (<link linkend="HDC--CAPS">HDC</link> hdc);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-win32-surface-create-with-dib">cairo_win32_surface_create_with_dib</link> (<link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-win32-surface-create-with-ddb">cairo_win32_surface_create_with_ddb</link> (<link linkend="HDC--CAPS">HDC</link> hdc,
                                                         <link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-win32-printing-surface-create">cairo_win32_printing_surface_create</link> (<link linkend="HDC--CAPS">HDC</link> hdc);
<link linkend="HDC--CAPS">HDC</link>                 <link linkend="cairo-win32-surface-get-dc">cairo_win32_surface_get_dc</link>          (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
<link linkend="cairo-surface-t">cairo_surface_t</link> *   <link linkend="cairo-win32-surface-get-image">cairo_win32_surface_get_image</link>       (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
</synopsis>
</refsynopsisdiv>









<refsect1 id="cairo-win32-surface.description" role="desc">
<title role="desc.title">Description</title>
<para>
The Microsoft Windows surface is used to render cairo graphics to
Microsoft Windows windows, bitmaps, and printing device contexts.
</para>
<para>
The surface returned by <link linkend="cairo-win32-printing-surface-create"><function>cairo_win32_printing_surface_create()</function></link> is of surface
type <link linkend="CAIRO-SURFACE-TYPE-WIN32-PRINTING--CAPS"><literal>CAIRO_SURFACE_TYPE_WIN32_PRINTING</literal></link> and is a multi-page vector surface
type.
</para>
<para>
The surface returned by the other win32 constructors is of surface type
<link linkend="CAIRO-SURFACE-TYPE-WIN32--CAPS"><literal>CAIRO_SURFACE_TYPE_WIN32</literal></link> and is a raster surface type.
</para>
</refsect1>

<refsect1 id="cairo-win32-surface.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CAIRO-HAS-WIN32-SURFACE--CAPS" role="macro">
<title>CAIRO_HAS_WIN32_SURFACE</title>
<indexterm zone="CAIRO-HAS-WIN32-SURFACE--CAPS"><primary sortas="CAIRO_HAS_WIN32_SURFACE">CAIRO_HAS_WIN32_SURFACE</primary></indexterm><programlisting>#define             CAIRO_HAS_WIN32_SURFACE</programlisting>
<para>
Defined if the Microsoft Windows surface backend is available.
This macro can be used to conditionally compile backend-specific code.
</para></refsect2>
<refsect2 id="cairo-win32-surface-create" role="function">
<title>cairo_win32_surface_create ()</title>
<indexterm zone="cairo-win32-surface-create"><primary sortas="cairo_win32_surface_create">cairo_win32_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_win32_surface_create          (<link linkend="HDC--CAPS">HDC</link> hdc);</programlisting>
<para>
Creates a cairo surface that targets the given DC.  The DC will be
queried for its initial clip extents, and this will be used as the
size of the cairo surface.  The resulting surface will always be of
format <link linkend="CAIRO-FORMAT-RGB24--CAPS"><literal>CAIRO_FORMAT_RGB24</literal></link>; should you need another surface format,
you will need to create one through
<link linkend="cairo-win32-surface-create-with-dib"><function>cairo_win32_surface_create_with_dib()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>hdc</parameter>&#160;:</term>
<listitem><simpara> the DC to create a surface for
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly created surface
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="cairo-win32-surface-create-with-dib" role="function" condition="since:1.2">
<title>cairo_win32_surface_create_with_dib ()</title>
<indexterm zone="cairo-win32-surface-create-with-dib" role="1.2"><primary sortas="cairo_win32_surface_create_with_dib">cairo_win32_surface_create_with_dib</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_win32_surface_create_with_dib (<link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);</programlisting>
<para>
Creates a device-independent-bitmap surface not associated with
any particular existing surface or device context. The created
bitmap will be uninitialized.</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.2</para></refsect2>
<refsect2 id="cairo-win32-surface-create-with-ddb" role="function" condition="since:1.4">
<title>cairo_win32_surface_create_with_ddb ()</title>
<indexterm zone="cairo-win32-surface-create-with-ddb" role="1.4"><primary sortas="cairo_win32_surface_create_with_ddb">cairo_win32_surface_create_with_ddb</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_win32_surface_create_with_ddb (<link linkend="HDC--CAPS">HDC</link> hdc,
                                                         <link linkend="cairo-format-t">cairo_format_t</link> format,
                                                         <link linkend="int">int</link> width,
                                                         <link linkend="int">int</link> height);</programlisting>
<para>
Creates a device-independent-bitmap surface not associated with
any particular existing surface or device context. The created
bitmap will be uninitialized.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>hdc</parameter>&#160;:</term>
<listitem><simpara> the DC to create a surface for
</simpara></listitem></varlistentry>
<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-win32-printing-surface-create" role="function" condition="since:1.6">
<title>cairo_win32_printing_surface_create ()</title>
<indexterm zone="cairo-win32-printing-surface-create" role="1.6"><primary sortas="cairo_win32_printing_surface_create">cairo_win32_printing_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_win32_printing_surface_create (<link linkend="HDC--CAPS">HDC</link> hdc);</programlisting>
<para>
Creates a cairo surface that targets the given DC.  The DC will be
queried for its initial clip extents, and this will be used as the
size of the cairo surface.  The DC should be a printing DC;
antialiasing will be ignored, and GDI will be used as much as
possible to draw to the surface.
</para>
<para>
The returned surface will be wrapped using the paginated surface to
provide correct complex rendering behaviour; <link linkend="show-page"><function>show_page()</function></link> and
associated methods must be used for correct output.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>hdc</parameter>&#160;:</term>
<listitem><simpara> the DC to create a surface for
</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.6</para></refsect2>
<refsect2 id="cairo-win32-surface-get-dc" role="function" condition="since:1.2">
<title>cairo_win32_surface_get_dc ()</title>
<indexterm zone="cairo-win32-surface-get-dc" role="1.2"><primary sortas="cairo_win32_surface_get_dc">cairo_win32_surface_get_dc</primary></indexterm><programlisting><link linkend="HDC--CAPS">HDC</link>                 cairo_win32_surface_get_dc          (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
<para>
Returns the HDC associated with this surface, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if none.
Also returns <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the surface is not a win32 surface.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> HDC or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if no HDC available.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-win32-surface-get-image" role="function" condition="since:1.4">
<title>cairo_win32_surface_get_image ()</title>
<indexterm zone="cairo-win32-surface-get-image" role="1.4"><primary sortas="cairo_win32_surface_get_image">cairo_win32_surface_get_image</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link> *   cairo_win32_surface_get_image       (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
<para>
Returns a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> image surface that refers to the same bits
as the DIB of the Win32 surface.  If the passed-in win32 surface
is not a DIB surface, <link linkend="NULL--CAPS"><literal>NULL</literal></link> is returned.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> (owned by the win32 <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>),
or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the win32 surface is not a DIB.

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

</refsect1>



<refsect1 id="cairo-win32-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>
