man-pages/man3/Cairo.3pm.html
2021-03-31 01:06:50 +01:00

3825 lines
45 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Cairo</TITLE>
</HEAD><BODY>
<H1>Cairo</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-10-12<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Cairo - Perl interface to the cairo 2d vector graphics library
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use Cairo;
my $surface = Cairo::ImageSurface-&gt;create ('argb32', 100, 100);
my $cr = Cairo::Context-&gt;create ($surface);
$cr-&gt;rectangle (10, 10, 40, 40);
$cr-&gt;set_source_rgb (0, 0, 0);
$cr-&gt;fill;
$cr-&gt;rectangle (50, 50, 40, 40);
$cr-&gt;set_source_rgb (1, 1, 1);
$cr-&gt;fill;
$cr-&gt;show_page;
$surface-&gt;write_to_png ('output.png');
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>ABSTRACT</H2>
Cairo provides Perl bindings for the vector graphics library cairo. It
supports multiple output targets, including <FONT SIZE="-1">PNG, PDF</FONT> and <FONT SIZE="-1">SVG.</FONT> Cairo produces
identical output on all those targets.
<A NAME="lbAE">&nbsp;</A>
<H2>API DOCUMENTATION</H2>
This is a listing of the <FONT SIZE="-1">API</FONT> Cairo provides. For more verbose information,
refer to the cairo manual at &lt;<A HREF="http://cairographics.org/manual/">http://cairographics.org/manual/</A>&gt;.
<A NAME="lbAF">&nbsp;</A>
<H3>Drawing</H3>
<I>Cairo::Context --- The cairo drawing context</I>
<P>
<I>Cairo::Context</I> is the main object used when drawing with Cairo. To draw with
Cairo, you create a <I>Cairo::Context</I>, set the target surface, and drawing
options for the <I>Cairo::Context</I>, create shapes with methods like
<TT>&quot;$cr-&gt;move_to&quot;</TT> and <TT>&quot;$cr-&gt;line_to&quot;</TT>, and then draw shapes with
<TT>&quot;$cr-&gt;stroke&quot;</TT> or <TT>&quot;$cr-&gt;fill&quot;</TT>.
<P>
<I>Cairo::Context</I>'s can be pushed to a stack via <TT>&quot;$cr-&gt;save&quot;</TT>. They may
then safely be changed, without loosing the current state. Use
<TT>&quot;$cr-&gt;restore&quot;</TT> to restore to the saved state.
<DL COMPACT>
<DT id="1">$cr = Cairo::Context-&gt;create ($surface)<DD>
<DL COMPACT><DT id="2"><DD>
<DL COMPACT>
<DT id="3">$surface: <I>Cairo::Surface</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="4"><DD>
</DL>
<DT id="5">$cr-&gt;save<DD>
<DT id="6">$cr-&gt;restore<DD>
<DT id="7">$status = $cr-&gt;status<DD>
<DT id="8">$surface = $cr-&gt;get_target<DD>
<DT id="9">$cr-&gt;push_group [1.2]<DD>
<DT id="10">$cr-&gt;push_group_with_content ($content) [1.2]<DD>
<DL COMPACT><DT id="11"><DD>
<DL COMPACT>
<DT id="12">$content: <I>Cairo::Content</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="13"><DD>
</DL>
<DT id="14">$pattern = $cr-&gt;pop_group [1.2]<DD>
<DT id="15">$cr-&gt;pop_group_to_source [1.2]<DD>
<DT id="16">$surface = $cr-&gt;get_group_target [1.2]<DD>
<DT id="17">$cr-&gt;set_source_rgb ($red, $green, $blue)<DD>
<DL COMPACT><DT id="18"><DD>
<DL COMPACT>
<DT id="19">$red: double<DD>
<DT id="20">$green: double<DD>
<DT id="21">$blue: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="22"><DD>
</DL>
<DT id="23">$cr-&gt;set_source_rgba ($red, $green, $blue, $alpha)<DD>
<DL COMPACT><DT id="24"><DD>
<DL COMPACT>
<DT id="25">$red: double<DD>
<DT id="26">$green: double<DD>
<DT id="27">$blue: double<DD>
<DT id="28">$alpha: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="29"><DD>
</DL>
<DT id="30">$cr-&gt;set_source ($source)<DD>
<DL COMPACT><DT id="31"><DD>
<DL COMPACT>
<DT id="32">$source: <I>Cairo::Pattern</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="33"><DD>
</DL>
<DT id="34">$cr-&gt;set_source_surface ($surface, $x, $y)<DD>
<DL COMPACT><DT id="35"><DD>
<DL COMPACT>
<DT id="36">$surface: <I>Cairo::Surface</I><DD>
<DT id="37">$x: double<DD>
<DT id="38">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="39"><DD>
</DL>
<DT id="40">$source = $cr-&gt;get_source<DD>
<DT id="41">$cr-&gt;set_antialias ($antialias)<DD>
<DL COMPACT><DT id="42"><DD>
<DL COMPACT>
<DT id="43">$antialias: <I>Cairo::Antialias</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="44"><DD>
</DL>
<DT id="45">$antialias = $cr-&gt;get_antialias<DD>
<DT id="46">$cr-&gt;set_dash ($offset, ...)<DD>
<DL COMPACT><DT id="47"><DD>
<DL COMPACT>
<DT id="48">$offset: double<DD>
<DT id="49">...: list of doubles<DD>
</DL>
</DL>
<DL COMPACT><DT id="50"><DD>
</DL>
<DT id="51">$cr-&gt;set_fill_rule ($fill_rule)<DD>
<DL COMPACT><DT id="52"><DD>
<DL COMPACT>
<DT id="53">$fill_rule: <I>Cairo::FillRule</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="54"><DD>
</DL>
<DT id="55">$fill_rule = $cr-&gt;get_fill_rule<DD>
<DT id="56">$cr-&gt;set_line_cap ($line_cap)<DD>
<DL COMPACT><DT id="57"><DD>
<DL COMPACT>
<DT id="58">$line_cap: <I>Cairo::LineCap</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="59"><DD>
</DL>
<DT id="60">$line_cap = $cr-&gt;get_line_cap<DD>
<DT id="61">$cr-&gt;set_line_join ($line_join)<DD>
<DL COMPACT><DT id="62"><DD>
<DL COMPACT>
<DT id="63">$line_join: <I>Cairo::LineJoin</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="64"><DD>
</DL>
<DT id="65">$line_join = $cr-&gt;get_line_join<DD>
<DT id="66">$cr-&gt;set_line_width ($width)<DD>
<DL COMPACT><DT id="67"><DD>
<DL COMPACT>
<DT id="68">$width: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="69"><DD>
</DL>
<DT id="70">$width = $cr-&gt;get_line_width<DD>
<DT id="71">$cr-&gt;set_miter_limit ($limit)<DD>
<DL COMPACT><DT id="72"><DD>
<DL COMPACT>
<DT id="73">$limit: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="74"><DD>
</DL>
<DT id="75">($offset, @dashes) = $cr-&gt;get_dash [1.4]<DD>
<DT id="76">$limit = $cr-&gt;get_miter_limit<DD>
<DT id="77">$cr-&gt;set_operator ($op)<DD>
<DL COMPACT><DT id="78"><DD>
<DL COMPACT>
<DT id="79">$op: <I>Cairo::Operator</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="80"><DD>
</DL>
<DT id="81">$op = $cr-&gt;get_operator<DD>
<DT id="82">$cr-&gt;set_tolerance ($tolerance)<DD>
<DL COMPACT><DT id="83"><DD>
<DL COMPACT>
<DT id="84">$tolerance: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="85"><DD>
</DL>
<DT id="86">$tolerance = $cr-&gt;get_tolerance<DD>
<DT id="87">$cr-&gt;clip<DD>
<DT id="88">$cr-&gt;clip_preserve<DD>
<DT id="89">($x1, $y1, $x2, $y2) = $cr-&gt;clip_extents [1.4]<DD>
<DT id="90">$bool = $cr-&gt;in_clip ($x, $y) [1.10]<DD>
<DL COMPACT><DT id="91"><DD>
<DL COMPACT>
<DT id="92">$x: double<DD>
<DT id="93">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="94"><DD>
</DL>
<DT id="95">@rectangles = $cr-&gt;copy_clip_rectangle_list [1.4]<DD>
<DT id="96">$cr-&gt;reset_clip<DD>
<DT id="97">$cr-&gt;fill<DD>
<DT id="98">$cr-&gt;fill_preserve<DD>
<DT id="99">($x1, $y1, $x2, $y2) = $cr-&gt;fill_extents<DD>
<DT id="100">$bool = $cr-&gt;in_fill ($x, $y)<DD>
<DL COMPACT><DT id="101"><DD>
<DL COMPACT>
<DT id="102">$x: double<DD>
<DT id="103">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="104"><DD>
</DL>
<DT id="105">$cr-&gt;mask ($pattern)<DD>
<DL COMPACT><DT id="106"><DD>
<DL COMPACT>
<DT id="107">$pattern: <I>Cairo::Pattern</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="108"><DD>
</DL>
<DT id="109">$cr-&gt;mask_surface ($surface, $surface_x, $surface_y)<DD>
<DL COMPACT><DT id="110"><DD>
<DL COMPACT>
<DT id="111">$surface: <I>Cairo::Surface</I><DD>
<DT id="112">$surface_x: double<DD>
<DT id="113">$surface_y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="114"><DD>
</DL>
<DT id="115">$cr-&gt;paint<DD>
<DT id="116">$cr-&gt;paint_with_alpha ($alpha)<DD>
<DL COMPACT><DT id="117"><DD>
<DL COMPACT>
<DT id="118">$alpha: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="119"><DD>
</DL>
<DT id="120">$cr-&gt;stroke<DD>
<DT id="121">$cr-&gt;stroke_preserve<DD>
<DT id="122">($x1, $y1, $x2, $y2) = $cr-&gt;stroke_extents<DD>
<DT id="123">$bool = $cr-&gt;in_stroke ($x, $y)<DD>
<DL COMPACT><DT id="124"><DD>
<DL COMPACT>
<DT id="125">$x: double<DD>
<DT id="126">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="127"><DD>
</DL>
<DT id="128">$cr-&gt;tag_begin($name, $atts) [1.16]<DD>
<DL COMPACT><DT id="129"><DD>
<DL COMPACT>
<DT id="130">$name: string<DD>
<DT id="131">$atts: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="132"><DD>
</DL>
<DT id="133">$cr-&gt;tag_end($name) [1.16]<DD>
<DL COMPACT><DT id="134"><DD>
<DL COMPACT>
<DT id="135">$name: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="136"><DD>
</DL>
<DT id="137">$cr-&gt;copy_page<DD>
<DT id="138">$cr-&gt;show_page<DD>
</DL>
<P>
<I>Paths --- Creating paths and manipulating path data</I>
<P>
<PRE>
$path = [
{ type =&gt; &quot;move-to&quot;, points =&gt; [[1, 2]] },
{ type =&gt; &quot;line-to&quot;, points =&gt; [[3, 4]] },
{ type =&gt; &quot;curve-to&quot;, points =&gt; [[5, 6], [7, 8], [9, 10]] },
...
{ type =&gt; &quot;close-path&quot;, points =&gt; [] },
];
</PRE>
<P>
<I>Cairo::Path</I> is a data structure for holding a path. This data structure
serves as the return value for <TT>&quot;$cr-&gt;copy_path&quot;</TT> and
<TT>&quot;$cr-&gt;copy_path_flat&quot;</TT> as well the input value for
<TT>&quot;$cr-&gt;append_path&quot;</TT>.
<P>
<I>Cairo::Path</I> is represented as an array reference that contains path
elements, represented by hash references with two keys: <I>type</I> and <I>points</I>.
The value for <I>type</I> can be either of the following:
<DL COMPACT>
<DT id="139">&quot;move-to&quot;<DD>
<DT id="140">&quot;line-to&quot;<DD>
<DT id="141">&quot;curve-to&quot;<DD>
<DT id="142">&quot;close-path&quot;<DD>
</DL>
<P>
The value for <I>points</I> is an array reference which contains zero or more
points. Points are represented as array references that contain two doubles:
<I>x</I> and <I>y</I>. The necessary number of points depends on the <I>type</I> of the
path element:
<DL COMPACT>
<DT id="143">&quot;move-to&quot;: 1 point<DD>
<DT id="144">&quot;line_to&quot;: 1 point<DD>
<DT id="145">&quot;curve-to&quot;: 3 points<DD>
<DT id="146">&quot;close-path&quot;: 0 points<DD>
</DL>
<P>
The semantics and ordering of the coordinate values are consistent with
<TT>&quot;$cr-&gt;move_to&quot;</TT>, <TT>&quot;$cr-&gt;line_to&quot;</TT>, <TT>&quot;$cr-&gt;curve_to&quot;</TT>, and
<TT>&quot;$cr-&gt;close_path&quot;</TT>.
<P>
Note that the paths returned by Cairo are implemented as tied array references
which do <B>not</B> support adding, removing or shuffling of path segments. For
these operations, you need to make a shallow copy first:
<P>
<PRE>
my @path_clone = @{$path};
# now you can alter @path_clone which ever way you want
</PRE>
<P>
The points of a single path element can be changed directly, however, without
the need for a shallow copy:
<P>
<PRE>
$path-&gt;[$i]{points} = [[3, 4], [5, 6], [7, 8]];
</PRE>
<DL COMPACT>
<DT id="147">$path = $cr-&gt;copy_path<DD>
<DT id="148">$path = $cr-&gt;copy_path_flat<DD>
<DT id="149">$cr-&gt;append_path ($path)<DD>
<DL COMPACT><DT id="150"><DD>
<DL COMPACT>
<DT id="151">$path: <I>Cairo::Path</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="152"><DD>
</DL>
<DT id="153">$bool = $cr-&gt;has_current_point [1.6]<DD>
<DT id="154">($x, $y) = $cr-&gt;get_current_point<DD>
<DT id="155">$cr-&gt;new_path<DD>
<DT id="156">$cr-&gt;new_sub_path [1.2]<DD>
<DT id="157">$cr-&gt;close_path<DD>
<DT id="158">($x1, $y1, $x2, $y2) = $cr-&gt;path_extents [1.6]<DD>
<DT id="159">$cr-&gt;arc ($xc, $yc, $radius, $angle1, $angle2)<DD>
<DL COMPACT><DT id="160"><DD>
<DL COMPACT>
<DT id="161">$xc: double<DD>
<DT id="162">$yc: double<DD>
<DT id="163">$radius: double<DD>
<DT id="164">$angle1: double<DD>
<DT id="165">$angle2: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="166"><DD>
</DL>
<DT id="167">$cr-&gt;arc_negative ($xc, $yc, $radius, $angle1, $angle2)<DD>
<DL COMPACT><DT id="168"><DD>
<DL COMPACT>
<DT id="169">$xc: double<DD>
<DT id="170">$yc: double<DD>
<DT id="171">$radius: double<DD>
<DT id="172">$angle1: double<DD>
<DT id="173">$angle2: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="174"><DD>
</DL>
<DT id="175">$cr-&gt;curve_to ($x1, $y1, $x2, $y2, $x3, $y3)<DD>
<DL COMPACT><DT id="176"><DD>
<DL COMPACT>
<DT id="177">$x1: double<DD>
<DT id="178">$y1: double<DD>
<DT id="179">$x2: double<DD>
<DT id="180">$y2: double<DD>
<DT id="181">$x3: double<DD>
<DT id="182">$y3: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="183"><DD>
</DL>
<DT id="184">$cr-&gt;line_to ($x, $y)<DD>
<DL COMPACT><DT id="185"><DD>
<DL COMPACT>
<DT id="186">$x: double<DD>
<DT id="187">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="188"><DD>
</DL>
<DT id="189">$cr-&gt;move_to ($x, $y)<DD>
<DL COMPACT><DT id="190"><DD>
<DL COMPACT>
<DT id="191">$x: double<DD>
<DT id="192">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="193"><DD>
</DL>
<DT id="194">$cr-&gt;rectangle ($x, $y, $width, $height)<DD>
<DL COMPACT><DT id="195"><DD>
<DL COMPACT>
<DT id="196">$x: double<DD>
<DT id="197">$y: double<DD>
<DT id="198">$width: double<DD>
<DT id="199">$height: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="200"><DD>
</DL>
<DT id="201">$cr-&gt;glyph_path (...)<DD>
<DL COMPACT><DT id="202"><DD>
<DL COMPACT>
<DT id="203">...: list of <I>Cairo::Glyph</I>'s<DD>
</DL>
</DL>
<DL COMPACT><DT id="204"><DD>
</DL>
<DT id="205">$cr-&gt;text_path ($utf8)<DD>
<DL COMPACT><DT id="206"><DD>
<DL COMPACT>
<DT id="207">$utf8: string in utf8 encoding<DD>
</DL>
</DL>
<DL COMPACT><DT id="208"><DD>
</DL>
<DT id="209">$cr-&gt;rel_curve_to ($dx1, $dy1, $dx2, $dy2, $dx3, $dy3)<DD>
<DL COMPACT><DT id="210"><DD>
<DL COMPACT>
<DT id="211">$dx1: double<DD>
<DT id="212">$dy1: double<DD>
<DT id="213">$dx2: double<DD>
<DT id="214">$dy2: double<DD>
<DT id="215">$dx3: double<DD>
<DT id="216">$dy3: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="217"><DD>
</DL>
<DT id="218">$cr-&gt;rel_line_to ($dx, $dy)<DD>
<DL COMPACT><DT id="219"><DD>
<DL COMPACT>
<DT id="220">$dx: double<DD>
<DT id="221">$dy: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="222"><DD>
</DL>
<DT id="223">$cr-&gt;rel_move_to ($dx, $dy)<DD>
<DL COMPACT><DT id="224"><DD>
<DL COMPACT>
<DT id="225">$dx: double<DD>
<DT id="226">$dy: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="227"><DD>
</DL>
</DL>
<P>
<I>Patterns --- Gradients and filtered sources</I>
<DL COMPACT>
<DT id="228">$status = $pattern-&gt;status<DD>
<DT id="229">$type = $pattern-&gt;get_type [1.2]<DD>
<DT id="230">$pattern-&gt;set_extend ($extend)<DD>
<DL COMPACT><DT id="231"><DD>
<DL COMPACT>
<DT id="232">$extend: <I>Cairo::Extend</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="233"><DD>
</DL>
<DT id="234">$extend = $pattern-&gt;get_extend<DD>
<DT id="235">$pattern-&gt;set_filter ($filter)<DD>
<DL COMPACT><DT id="236"><DD>
<DL COMPACT>
<DT id="237">$filter: <I>Cairo::Filter</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="238"><DD>
</DL>
<DT id="239">$filter = $pattern-&gt;get_filter<DD>
<DT id="240">$pattern-&gt;set_matrix ($matrix)<DD>
<DL COMPACT><DT id="241"><DD>
<DL COMPACT>
<DT id="242">$matrix: <I>Cairo::Matrix</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="243"><DD>
</DL>
<DT id="244">$matrix = $pattern-&gt;get_matrix<DD>
<DT id="245">$pattern = Cairo::SolidPattern-&gt;create_rgb ($red, $green, $blue)<DD>
<DL COMPACT><DT id="246"><DD>
<DL COMPACT>
<DT id="247">$red: double<DD>
<DT id="248">$green: double<DD>
<DT id="249">$blue: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="250"><DD>
</DL>
<DT id="251">$pattern = Cairo::SolidPattern-&gt;create_rgba ($red, $green, $blue, $alpha)<DD>
<DL COMPACT><DT id="252"><DD>
<DL COMPACT>
<DT id="253">$red: double<DD>
<DT id="254">$green: double<DD>
<DT id="255">$blue: double<DD>
<DT id="256">$alpha: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="257"><DD>
</DL>
<DT id="258">($r, $g, $b, $a) = $pattern-&gt;get_rgba [1.4]<DD>
<DT id="259">$pattern = Cairo::SurfacePattern-&gt;create ($surface)<DD>
<DL COMPACT><DT id="260"><DD>
<DL COMPACT>
<DT id="261">$surface: <I>Cairo::Surface</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="262"><DD>
</DL>
<DT id="263">$surface = $pattern-&gt;get_surface [1.4]<DD>
<DT id="264">$pattern = Cairo::LinearGradient-&gt;create ($x0, $y0, $x1, $y1)<DD>
<DL COMPACT><DT id="265"><DD>
<DL COMPACT>
<DT id="266">$x0: double<DD>
<DT id="267">$y0: double<DD>
<DT id="268">$x1: double<DD>
<DT id="269">$y1: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="270"><DD>
</DL>
<DT id="271">($x0, $y0, $x1, $y1) = $pattern-&gt;get_points [1.4]<DD>
<DT id="272">$pattern = Cairo::RadialGradient-&gt;create ($cx0, $cy0, $radius0, $cx1, $cy1, $radius1)<DD>
<DL COMPACT><DT id="273"><DD>
<DL COMPACT>
<DT id="274">$cx0: double<DD>
<DT id="275">$cy0: double<DD>
<DT id="276">$radius0: double<DD>
<DT id="277">$cx1: double<DD>
<DT id="278">$cy1: double<DD>
<DT id="279">$radius1: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="280"><DD>
</DL>
<DT id="281">($x0, $y0, $r0, $x1, $y1, $r1) = $pattern-&gt;get_circles [1.4]<DD>
<DT id="282">$pattern-&gt;add_color_stop_rgb ($offset, $red, $green, $blue)<DD>
<DL COMPACT><DT id="283"><DD>
<DL COMPACT>
<DT id="284">$offset: double<DD>
<DT id="285">$red: double<DD>
<DT id="286">$green: double<DD>
<DT id="287">$blue: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="288"><DD>
</DL>
<DT id="289">$pattern-&gt;add_color_stop_rgba ($offset, $red, $green, $blue, $alpha)<DD>
<DL COMPACT><DT id="290"><DD>
<DL COMPACT>
<DT id="291">$offset: double<DD>
<DT id="292">$red: double<DD>
<DT id="293">$green: double<DD>
<DT id="294">$blue: double<DD>
<DT id="295">$alpha: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="296"><DD>
</DL>
<DT id="297">@stops = $pattern-&gt;get_color_stops [1.4]<DD>
A color stop is represented as an array reference with five elements: offset,
red, green, blue, and alpha.
</DL>
<P>
<I>Regions --- Representing a pixel-aligned area</I>
<DL COMPACT>
<DT id="298">$region = Cairo::Region-&gt;create (...) [1.10]<DD>
<DL COMPACT><DT id="299"><DD>
<DL COMPACT>
<DT id="300">...: zero or more <I>Cairo::RectangleInt</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="301"><DD>
</DL>
<DT id="302">$status = $region-&gt;status [1.10]<DD>
<DT id="303">$num = $region-&gt;num_rectangles [1.10]<DD>
<DT id="304">$rect = $region-&gt;get_rectangle ($i) [1.10]<DD>
<DL COMPACT><DT id="305"><DD>
<DL COMPACT>
<DT id="306">$i: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="307"><DD>
</DL>
<DT id="308">$bool = $region-&gt;is_empty [1.10]<DD>
<DT id="309">$bool = $region-&gt;contains_point ($x, $y) [1.10]<DD>
<DL COMPACT><DT id="310"><DD>
<DL COMPACT>
<DT id="311">$x: integer<DD>
<DT id="312">$y: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="313"><DD>
</DL>
<DT id="314">$bool = $region_one-&gt;equal ($region_two) [1.10]<DD>
<DL COMPACT><DT id="315"><DD>
<DL COMPACT>
<DT id="316">$region_two: <I>Cairo::Region</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="317"><DD>
</DL>
<DT id="318">$region-&gt;translate ($dx, $dy) [1.10]<DD>
<DL COMPACT><DT id="319"><DD>
<DL COMPACT>
<DT id="320">$dx: integer<DD>
<DT id="321">$dy: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="322"><DD>
</DL>
<DT id="323">$status = $dst-&gt;intersect ($other) [1.10]<DD>
<DT id="324">$status = $dst-&gt;intersect_rectangle ($rect) [1.10]<DD>
<DT id="325">$status = $dst-&gt;subtract ($other) [1.10]<DD>
<DT id="326">$status = $dst-&gt;subtract_rectangle ($rect) [1.10]<DD>
<DT id="327">$status = $dst-&gt;union ($other) [1.10]<DD>
<DT id="328">$status = $dst-&gt;union_rectangle ($rect) [1.10]<DD>
<DT id="329">$status = $dst-&gt;xor ($other) [1.10]<DD>
<DT id="330">$status = $dst-&gt;xor_rectangle ($rect) [1.10]<DD>
<DL COMPACT><DT id="331"><DD>
<DL COMPACT>
<DT id="332">$other: <I>Cairo::Region</I><DD>
<DT id="333">$rect: <I>Cairo::RectangleInt</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="334"><DD>
</DL>
</DL>
<P>
<I>Transformations --- Manipulating the current transformation matrix</I>
<DL COMPACT>
<DT id="335">$cr-&gt;translate ($tx, $ty)<DD>
<DL COMPACT><DT id="336"><DD>
<DL COMPACT>
<DT id="337">$tx: double<DD>
<DT id="338">$ty: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="339"><DD>
</DL>
<DT id="340">$cr-&gt;scale ($sx, $sy)<DD>
<DL COMPACT><DT id="341"><DD>
<DL COMPACT>
<DT id="342">$sx: double<DD>
<DT id="343">$sy: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="344"><DD>
</DL>
<DT id="345">$cr-&gt;rotate ($angle)<DD>
<DL COMPACT><DT id="346"><DD>
<DL COMPACT>
<DT id="347">$angle: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="348"><DD>
</DL>
<DT id="349">$cr-&gt;transform ($matrix)<DD>
<DL COMPACT><DT id="350"><DD>
<DL COMPACT>
<DT id="351">$matrix: <I>Cairo::Matrix</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="352"><DD>
</DL>
<DT id="353">$cr-&gt;set_matrix ($matrix)<DD>
<DL COMPACT><DT id="354"><DD>
<DL COMPACT>
<DT id="355">$matrix: <I>Cairo::Matrix</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="356"><DD>
</DL>
<DT id="357">$matrix = $cr-&gt;get_matrix<DD>
<DT id="358">$cr-&gt;identity_matrix<DD>
<DT id="359">($x, $y) = $cr-&gt;user_to_device ($x, $y)<DD>
<DL COMPACT><DT id="360"><DD>
<DL COMPACT>
<DT id="361">$x: double<DD>
<DT id="362">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="363"><DD>
</DL>
<DT id="364">($dx, $dy) = $cr-&gt;user_to_device_distance ($dx, $dy)<DD>
<DL COMPACT><DT id="365"><DD>
<DL COMPACT>
<DT id="366">$dx: double<DD>
<DT id="367">$dy: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="368"><DD>
</DL>
<DT id="369">($x, $y) = $cr-&gt;device_to_user ($x, $y)<DD>
<DL COMPACT><DT id="370"><DD>
<DL COMPACT>
<DT id="371">$x: double<DD>
<DT id="372">$y: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="373"><DD>
</DL>
<DT id="374">($dx, $dy) = $cr-&gt;device_to_user_distance ($dx, $dy)<DD>
<DL COMPACT><DT id="375"><DD>
<DL COMPACT>
<DT id="376">$dx: double<DD>
<DT id="377">$dy: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="378"><DD>
</DL>
</DL>
<P>
<I>Text --- Rendering text and sets of glyphs</I>
<P>
Glyphs are represented as anonymous hash references with three keys: <I>index</I>,
<I>x</I> and <I>y</I>. Example:
<P>
<PRE>
my @glyphs = ({ index =&gt; 1, x =&gt; 2, y =&gt; 3 },
{ index =&gt; 2, x =&gt; 3, y =&gt; 4 },
{ index =&gt; 3, x =&gt; 4, y =&gt; 5 });
</PRE>
<DL COMPACT>
<DT id="379">$cr-&gt;select_font_face ($family, $slant, $weight)<DD>
<DL COMPACT><DT id="380"><DD>
<DL COMPACT>
<DT id="381">$family: string<DD>
<DT id="382">$slant: <I>Cairo::FontSlant</I><DD>
<DT id="383">$weight: <I>Cairo::FontWeight</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="384"><DD>
</DL>
<DT id="385">$cr-&gt;set_font_size ($size)<DD>
<DL COMPACT><DT id="386"><DD>
<DL COMPACT>
<DT id="387">$size: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="388"><DD>
</DL>
<DT id="389">$cr-&gt;set_font_matrix ($matrix)<DD>
<DL COMPACT><DT id="390"><DD>
<DL COMPACT>
<DT id="391">$matrix: <I>Cairo::Matrix</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="392"><DD>
</DL>
<DT id="393">$matrix = $cr-&gt;get_font_matrix<DD>
<DT id="394">$cr-&gt;set_font_options ($options)<DD>
<DL COMPACT><DT id="395"><DD>
<DL COMPACT>
<DT id="396">$options: <I>Cairo::FontOptions</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="397"><DD>
</DL>
<DT id="398">$options = $cr-&gt;get_font_options<DD>
<DT id="399">$cr-&gt;set_scaled_font ($scaled_font) [1.2]<DD>
<DL COMPACT><DT id="400"><DD>
<DL COMPACT>
<DT id="401">$scaled_font: <I>Cairo::ScaledFont</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="402"><DD>
</DL>
<DT id="403">$scaled_font = $cr-&gt;get_scaled_font [1.4]<DD>
<DT id="404">$cr-&gt;show_text ($utf8)<DD>
<DL COMPACT><DT id="405"><DD>
<DL COMPACT>
<DT id="406">$utf8: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="407"><DD>
</DL>
<DT id="408">$cr-&gt;show_glyphs (...)<DD>
<DL COMPACT><DT id="409"><DD>
<DL COMPACT>
<DT id="410">...: list of glyphs<DD>
</DL>
</DL>
<DL COMPACT><DT id="411"><DD>
</DL>
<DT id="412">$cr-&gt;show_text_glyphs ($utf8, $glyphs, $clusters, $cluster_flags) [1.8]<DD>
<DL COMPACT><DT id="413"><DD>
<DL COMPACT>
<DT id="414">$utf8: string<DD>
<DT id="415">$glyphs: array ref of glyphs<DD>
<DT id="416">$clusters: array ref of clusters<DD>
<DT id="417">$cluster_flags: <I>Cairo::TextClusterFlags</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="418"><DD>
</DL>
<DT id="419">$face = $cr-&gt;get_font_face<DD>
<DT id="420">$extents = $cr-&gt;font_extents<DD>
<DT id="421">$cr-&gt;set_font_face ($font_face)<DD>
<DL COMPACT><DT id="422"><DD>
<DL COMPACT>
<DT id="423">$font_face: <I>Cairo::FontFace</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="424"><DD>
</DL>
<DT id="425">$cr-&gt;set_scaled_font ($scaled_font)<DD>
<DL COMPACT><DT id="426"><DD>
<DL COMPACT>
<DT id="427">$scaled_font: <I>Cairo::ScaledFont</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="428"><DD>
</DL>
<DT id="429">$extents = $cr-&gt;text_extents ($utf8)<DD>
<DL COMPACT><DT id="430"><DD>
<DL COMPACT>
<DT id="431">$utf8: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="432"><DD>
</DL>
<DT id="433">$extents = $cr-&gt;glyph_extents (...)<DD>
<DL COMPACT><DT id="434"><DD>
<DL COMPACT>
<DT id="435">...: list of glyphs<DD>
</DL>
</DL>
<DL COMPACT><DT id="436"><DD>
</DL>
<DT id="437">$face = Cairo::ToyFontFace-&gt;create ($family, $slant, $weight) [1.8]<DD>
<DL COMPACT><DT id="438"><DD>
<DL COMPACT>
<DT id="439">$family: string<DD>
<DT id="440">$slant: <I>Cairo::FontSlant</I><DD>
<DT id="441">$weight: <I>Cairo::FontWeight</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="442"><DD>
</DL>
<DT id="443">$family = $face-&gt;get_family [1.8]<DD>
<DT id="444">$slang = $face-&gt;get_slant [1.8]<DD>
<DT id="445">$weight = $face-&gt;get_weight [1.8]<DD>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H3>Fonts</H3>
<I>Cairo::FontFace --- Base class for fonts</I>
<DL COMPACT>
<DT id="446">$status = $font_face-&gt;status<DD>
<DT id="447">$type = $font_face-&gt;get_type [1.2]<DD>
</DL>
<P>
<I>Scaled Fonts --- Caching metrics for a particular font size</I>
<DL COMPACT>
<DT id="448">$scaled_font = Cairo::ScaledFont-&gt;create ($font_face, $font_matrix, $ctm, $options)<DD>
<DL COMPACT><DT id="449"><DD>
<DL COMPACT>
<DT id="450">$font_face: <I>Cairo::FontFace</I><DD>
<DT id="451">$font_matrix: <I>Cairo::Matrix</I><DD>
<DT id="452">$ctm: <I>Cairo::Matrix</I><DD>
<DT id="453">$options: <I>Cairo::FontOptions</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="454"><DD>
</DL>
<DT id="455">$status = $scaled_font-&gt;status<DD>
<DT id="456">$extents = $scaled_font-&gt;extents<DD>
<DT id="457">$extents = $scaled_font-&gt;text_extents ($utf8) [1.2]<DD>
<DL COMPACT><DT id="458"><DD>
<DL COMPACT>
<DT id="459">$utf8: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="460"><DD>
</DL>
<DT id="461">$extents = $scaled_font-&gt;glyph_extents (...)<DD>
<DL COMPACT><DT id="462"><DD>
<DL COMPACT>
<DT id="463">...: list of glyphs<DD>
</DL>
</DL>
<DL COMPACT><DT id="464"><DD>
</DL>
<DT id="465">($status, $glyphs, $clusters, $cluster_flags) = $scaled_font-&gt;text_to_glyphs ($x, $y, $utf8) [1.8]<DD>
<DL COMPACT><DT id="466"><DD>
<DL COMPACT>
<DT id="467">$x: double<DD>
<DT id="468">$y: double<DD>
<DT id="469">$utf8: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="470"><DD>
</DL>
<DT id="471">$font_face = $scaled_font-&gt;get_font_face [1.2]<DD>
<DT id="472">$options = $scaled_font-&gt;get_font_options [1.2]<DD>
<DT id="473">$font_matrix = $scaled_font-&gt;get_font_matrix [1.2]<DD>
<DT id="474">$ctm = $scaled_font-&gt;get_ctm [1.2]<DD>
<DT id="475">$scale_matrix = $scaled_font-&gt;get_scale_matrix [1.8]<DD>
<DT id="476">$type = $scaled_font-&gt;get_type [1.2]<DD>
</DL>
<P>
<I>Font Options --- How a font should be rendered</I>
<DL COMPACT>
<DT id="477">$font_options = Cairo::FontOptions-&gt;create<DD>
<DT id="478">$status = $font_options-&gt;status<DD>
<DT id="479">$font_options-&gt;merge ($other)<DD>
<DL COMPACT><DT id="480"><DD>
<DL COMPACT>
<DT id="481">$other: <I>Cairo::FontOptions</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="482"><DD>
</DL>
<DT id="483">$hash = $font_options-&gt;hash<DD>
<DT id="484">$bools = $font_options-&gt;equal ($other)<DD>
<DL COMPACT><DT id="485"><DD>
<DL COMPACT>
<DT id="486">$other: <I>Cairo::FontOptions</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="487"><DD>
</DL>
<DT id="488">$font_options-&gt;set_antialias ($antialias)<DD>
<DL COMPACT><DT id="489"><DD>
<DL COMPACT>
<DT id="490">$antialias: <I>Cairo::AntiAlias</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="491"><DD>
</DL>
<DT id="492">$antialias = $font_options-&gt;get_antialias<DD>
<DT id="493">$font_options-&gt;set_subpixel_order ($subpixel_order)<DD>
<DL COMPACT><DT id="494"><DD>
<DL COMPACT>
<DT id="495">$subpixel_order: <I>Cairo::SubpixelOrder</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="496"><DD>
</DL>
<DT id="497">$subpixel_order = $font_options-&gt;get_subpixel_order<DD>
<DT id="498">$font_options-&gt;set_hint_style ($hint_style)<DD>
<DL COMPACT><DT id="499"><DD>
<DL COMPACT>
<DT id="500">$hint_style: <I>Cairo::HintStyle</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="501"><DD>
</DL>
<DT id="502">$hint_style = $font_options-&gt;get_hint_style<DD>
<DT id="503">$font_options-&gt;set_hint_metrics ($hint_metrics)<DD>
<DL COMPACT><DT id="504"><DD>
<DL COMPACT>
<DT id="505">$hint_metrics: <I>Cairo::HintMetrics</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="506"><DD>
</DL>
<DT id="507">$hint_metrics = $font_options-&gt;get_hint_metrics<DD>
</DL>
<P>
<I>FreeType Fonts --- Font support for FreeType</I>
<P>
If your cairo library supports it, the FreeType integration allows you to load
font faces from font files. You can query for this capability with
<TT>&quot;Cairo::HAS_FT_FONT&quot;</TT>. To actually use this, you'll need the Font::FreeType
module.
<DL COMPACT>
<DT id="508">my $face = Cairo::FtFontFace-&gt;create ($ft_face, $load_flags=0)<DD>
<DL COMPACT><DT id="509"><DD>
<DL COMPACT>
<DT id="510">$ft_face: <I>Font::FreeType::Face</I><DD>
<DT id="511">$load_flags: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="512"><DD>
<P>
This method allows you to create a <I>Cairo::FontFace</I> from a
<I>Font::FreeType::Face</I>. To obtain the latter, you can for example load it
from a file:
<P>
<PRE>
my $file = '/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf';
my $ft_face = Font::FreeType-&gt;new-&gt;face ($file);
my $face = Cairo::FtFontFace-&gt;create ($ft_face);
</PRE>
</DL>
</DL>
<A NAME="lbAH">&nbsp;</A>
<H3>Surfaces</H3>
<I>Cairo::Surface --- Base class for surfaces</I>
<DL COMPACT>
<DT id="513">$similar = Cairo::Surface-&gt;create_similar ($other, $content, $width, $height)<DD>
<DL COMPACT><DT id="514"><DD>
<DL COMPACT>
<DT id="515">$other: <I>Cairo::Surface</I><DD>
<DT id="516">$content: <I>Cairo::Content</I><DD>
<DT id="517">$width: integer<DD>
<DT id="518">$height: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="519"><DD>
<P>
For hysterical reasons, you can also use the following syntax:
<P>
<PRE>
$similar = $other-&gt;create_similar ($content, $width, $height)
</PRE>
</DL>
<DT id="520">$new = Cairo::Surface-&gt;create_for_rectangle ($target, $x, $y, $width, $height) [1.10]<DD>
<DL COMPACT><DT id="521"><DD>
<DL COMPACT>
<DT id="522">$target: <I>Cairo::Surface</I><DD>
<DT id="523">$x: double<DD>
<DT id="524">$y: double<DD>
<DT id="525">$width: double<DD>
<DT id="526">$height: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="527"><DD>
</DL>
<DT id="528">$status = $surface-&gt;status<DD>
<DT id="529">$surface-&gt;finish<DD>
<DT id="530">$surface-&gt;flush<DD>
<DT id="531">$font_options = $surface-&gt;get_font_options<DD>
<DT id="532">$content = $surface-&gt;get_content [1.2]<DD>
<DT id="533">$surface-&gt;mark_dirty<DD>
<DT id="534">$surface-&gt;mark_dirty_rectangle ($x, $y, $width, $height)<DD>
<DL COMPACT><DT id="535"><DD>
<DL COMPACT>
<DT id="536">$x: integer<DD>
<DT id="537">$y: integer<DD>
<DT id="538">$width: integer<DD>
<DT id="539">$height: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="540"><DD>
</DL>
<DT id="541">$surface-&gt;set_device_offset ($x_offset, $y_offset)<DD>
<DL COMPACT><DT id="542"><DD>
<DL COMPACT>
<DT id="543">$x_offset: integer<DD>
<DT id="544">$y_offset: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="545"><DD>
</DL>
<DT id="546">($x_offset, $y_offset) = $surface-&gt;get_device_offset [1.2]<DD>
<DT id="547">$surface-&gt;set_fallback_resolution ($x_pixels_per_inch, $y_pixels_per_inch) [1.2]<DD>
<DL COMPACT><DT id="548"><DD>
<DL COMPACT>
<DT id="549">$x_pixels_per_inch: double<DD>
<DT id="550">$y_pixels_per_inch: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="551"><DD>
</DL>
<DT id="552">($x_pixels_per_inch, $y_pixels_per_inch) = $surface-&gt;get_fallback_resolution [1.8]<DD>
<DT id="553">$type = $surface-&gt;get_type [1.2]<DD>
<DT id="554">$status = $surface-&gt;copy_page [1.6]<DD>
<DL COMPACT><DT id="555"><DD>
<DL COMPACT>
<DT id="556">$status: <I>Cairo::Status</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="557"><DD>
</DL>
<DT id="558">$status = $surface-&gt;show_page [1.6]<DD>
<DL COMPACT><DT id="559"><DD>
<DL COMPACT>
<DT id="560">$status: <I>Cairo::Status</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="561"><DD>
</DL>
<DT id="562">$boolean = $surface-&gt;has_show_text_glyphs [1.8]<DD>
</DL>
<P>
<I>Image Surfaces --- Rendering to memory buffers</I>
<DL COMPACT>
<DT id="563">$surface = Cairo::ImageSurface-&gt;create ($format, $width, $height)<DD>
<DL COMPACT><DT id="564"><DD>
<DL COMPACT>
<DT id="565">$format: <I>Cairo::Format</I><DD>
<DT id="566">$width: integer<DD>
<DT id="567">$height: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="568"><DD>
</DL>
<DT id="569">$surface = Cairo::ImageSurface-&gt;create_for_data ($data, $format, $width, $height, $stride)<DD>
<DL COMPACT><DT id="570"><DD>
<DL COMPACT>
<DT id="571">$data: image data<DD>
<DT id="572">$format: <I>Cairo::Format</I><DD>
<DT id="573">$width: integer<DD>
<DT id="574">$height: integer<DD>
<DT id="575">$stride: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="576"><DD>
</DL>
<DT id="577">$data = $surface-&gt;get_data [1.2]<DD>
<DT id="578">$format = $surface-&gt;get_format [1.2]<DD>
<DT id="579">$width = $surface-&gt;get_width<DD>
<DT id="580">$height = $surface-&gt;get_height<DD>
<DT id="581">$stride = $surface-&gt;get_stride [1.2]<DD>
<DT id="582">$stride = Cairo::Format::stride_for_width ($format, $width) [1.6]<DD>
<DL COMPACT><DT id="583"><DD>
<DL COMPACT>
<DT id="584">$format: <I>Cairo::Format</I><DD>
<DT id="585">$width: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="586"><DD>
</DL>
</DL>
<P>
<I></I><FONT SIZE="-1"><I>PDF</I></FONT><I> Surfaces --- Rendering </I><FONT SIZE="-1"><I>PDF</I></FONT><I> documents</I>
<DL COMPACT>
<DT id="587">$surface = Cairo::PdfSurface-&gt;create ($filename, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="588"><DD>
<DL COMPACT>
<DT id="589">$filename: string<DD>
<DT id="590">$width_in_points: double<DD>
<DT id="591">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="592"><DD>
</DL>
<DT id="593">$surface = Cairo::PdfSurface-&gt;create_for_stream ($callback, $callback_data, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="594"><DD>
<DL COMPACT>
<DT id="595">$callback: <I>Cairo::WriteFunc</I><DD>
<DT id="596">$callback_data: scalar<DD>
<DT id="597">$width_in_points: double<DD>
<DT id="598">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="599"><DD>
</DL>
<DT id="600">$surface-&gt;set_size ($width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="601"><DD>
<DL COMPACT>
<DT id="602">$width_in_points: double<DD>
<DT id="603">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="604"><DD>
</DL>
<DT id="605">$surface-&gt;restrict_to_version ($version) [1.10]<DD>
<DL COMPACT><DT id="606"><DD>
<DL COMPACT>
<DT id="607">$version: <I>Cairo::PdfVersion</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="608"><DD>
</DL>
<DT id="609">@versions = Cairo::PdfSurface::get_versions [1.10]<DD>
<DT id="610">$string = Cairo::PdfSurface::version_to_string ($version) [1.10]<DD>
<DL COMPACT><DT id="611"><DD>
<DL COMPACT>
<DT id="612">$version: <I>Cairo::PdfVersion</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="613"><DD>
</DL>
<DT id="614">$surface-&gt;set_metadata($name, $value) [1.16]<DD>
<DL COMPACT><DT id="615"><DD>
<DL COMPACT>
<DT id="616">$name: string<DD>
<DT id="617">$value: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="618"><DD>
</DL>
</DL>
<P>
<I></I><FONT SIZE="-1"><I>PNG</I></FONT><I> Support --- Reading and writing </I><FONT SIZE="-1"><I>PNG</I></FONT><I> images</I>
<DL COMPACT>
<DT id="619">$surface = Cairo::ImageSurface-&gt;create_from_png ($filename)<DD>
<DL COMPACT><DT id="620"><DD>
<DL COMPACT>
<DT id="621">$filename: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="622"><DD>
</DL>
<DT id="623">Cairo::ReadFunc: $data = sub { my ($callback_data, $length) = @_; }<DD>
<DL COMPACT><DT id="624"><DD>
<DL COMPACT>
<DT id="625">$data: binary image data, of length $length<DD>
<DT id="626">$callback_data: scalar, user data<DD>
<DT id="627">$length: integer, bytes to read<DD>
</DL>
</DL>
<DL COMPACT><DT id="628"><DD>
</DL>
<DT id="629">$surface = Cairo::ImageSurface-&gt;create_from_png_stream ($callback, $callback_data)<DD>
<DL COMPACT><DT id="630"><DD>
<DL COMPACT>
<DT id="631">$callback: <I>Cairo::ReadFunc</I><DD>
<DT id="632">$callback_data: scalar<DD>
</DL>
</DL>
<DL COMPACT><DT id="633"><DD>
</DL>
<DT id="634">$status = $surface-&gt;write_to_png ($filename)<DD>
<DL COMPACT><DT id="635"><DD>
<DL COMPACT>
<DT id="636">$filename: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="637"><DD>
</DL>
<DT id="638">Cairo::WriteFunc: sub { my ($callback_data, $data) = @_; }<DD>
<DL COMPACT><DT id="639"><DD>
<DL COMPACT>
<DT id="640">$callback_data: scalar, user data<DD>
<DT id="641">$data: binary image data, to be written<DD>
</DL>
</DL>
<DL COMPACT><DT id="642"><DD>
</DL>
<DT id="643">$status = $surface-&gt;write_to_png_stream ($callback, $callback_data)<DD>
<DL COMPACT><DT id="644"><DD>
<DL COMPACT>
<DT id="645">$callback: <I>Cairo::WriteFunc</I><DD>
<DT id="646">$callback_data: scalar<DD>
</DL>
</DL>
<DL COMPACT><DT id="647"><DD>
</DL>
</DL>
<P>
<I>PostScript Surfaces --- Rendering PostScript documents</I>
<DL COMPACT>
<DT id="648">$surface = Cairo::PsSurface-&gt;create ($filename, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="649"><DD>
<DL COMPACT>
<DT id="650">$filename: string<DD>
<DT id="651">$width_in_points: double<DD>
<DT id="652">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="653"><DD>
</DL>
<DT id="654">$surface = Cairo::PsSurface-&gt;create_for_stream ($callback, $callback_data, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="655"><DD>
<DL COMPACT>
<DT id="656">$callback: <I>Cairo::WriteFunc</I><DD>
<DT id="657">$callback_data: scalar<DD>
<DT id="658">$width_in_points: double<DD>
<DT id="659">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="660"><DD>
</DL>
<DT id="661">$surface-&gt;set_size ($width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="662"><DD>
<DL COMPACT>
<DT id="663">$width_in_points: double<DD>
<DT id="664">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="665"><DD>
</DL>
<DT id="666">$surface-&gt;dsc_begin_setup [1.2]<DD>
<DT id="667">$surface-&gt;dsc_begin_page_setup [1.2]<DD>
<DT id="668">$surface-&gt;dsc_comment ($comment) [1.2]<DD>
<DL COMPACT><DT id="669"><DD>
<DL COMPACT>
<DT id="670">$comment: string<DD>
</DL>
</DL>
<DL COMPACT><DT id="671"><DD>
</DL>
<DT id="672">$surface-&gt;restrict_to_level ($level) [1.6]<DD>
<DL COMPACT><DT id="673"><DD>
<DL COMPACT>
<DT id="674">$level: <I>Cairo::PsLevel</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="675"><DD>
</DL>
<DT id="676">@levels = Cairo::PsSurface::get_levels [1.6]<DD>
<DT id="677">$string = Cairo::PsSurface::level_to_string ($level) [1.6]<DD>
<DL COMPACT><DT id="678"><DD>
<DL COMPACT>
<DT id="679">$level: <I>Cairo::PsLevel</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="680"><DD>
</DL>
<DT id="681">$surface-&gt;set_eps ($eps) [1.6]<DD>
<DL COMPACT><DT id="682"><DD>
<DL COMPACT>
<DT id="683">$eps: boolean<DD>
</DL>
</DL>
<DL COMPACT><DT id="684"><DD>
</DL>
<DT id="685">$eps = $surface-&gt;get_eps [1.6]<DD>
</DL>
<P>
<I>Recording Surfaces --- Records all drawing operations</I>
<DL COMPACT>
<DT id="686">$surface = Cairo::RecordingSurface-&gt;create ($content, $extents) [1.10]<DD>
<DL COMPACT><DT id="687"><DD>
<DL COMPACT>
<DT id="688">$content: <I>Cairo::Content</I><DD>
<DT id="689">$extents: <I>Cairo::Rectangle</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="690"><DD>
</DL>
<DT id="691">($x0, $y0, $width, $height) = $surface-&gt;ink_extents [1.10]<DD>
</DL>
<P>
<I></I><FONT SIZE="-1"><I>SVG</I></FONT><I> Surfaces --- Rendering </I><FONT SIZE="-1"><I>SVG</I></FONT><I> documents</I>
<DL COMPACT>
<DT id="692">$surface = Cairo::SvgSurface-&gt;create ($filename, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="693"><DD>
<DL COMPACT>
<DT id="694">$filename: string<DD>
<DT id="695">$width_in_points: double<DD>
<DT id="696">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="697"><DD>
</DL>
<DT id="698">$surface = Cairo::SvgSurface-&gt;create_for_stream ($callback, $callback_data, $width_in_points, $height_in_points) [1.2]<DD>
<DL COMPACT><DT id="699"><DD>
<DL COMPACT>
<DT id="700">$callback: <I>Cairo::WriteFunc</I><DD>
<DT id="701">$callback_data: scalar<DD>
<DT id="702">$width_in_points: double<DD>
<DT id="703">$height_in_points: double<DD>
</DL>
</DL>
<DL COMPACT><DT id="704"><DD>
</DL>
<DT id="705">$surface-&gt;restrict_to_version ($version) [1.2]<DD>
<DL COMPACT><DT id="706"><DD>
<DL COMPACT>
<DT id="707">$version: <I>Cairo::SvgVersion</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="708"><DD>
</DL>
<DT id="709">@versions = Cairo::SvgSurface::get_versions [1.2]<DD>
<DT id="710">$string = Cairo::SvgSurface::version_to_string ($version) [1.2]<DD>
<DL COMPACT><DT id="711"><DD>
<DL COMPACT>
<DT id="712">$version: <I>Cairo::SvgVersion</I><DD>
</DL>
</DL>
<DL COMPACT><DT id="713"><DD>
</DL>
</DL>
<A NAME="lbAI">&nbsp;</A>
<H3>Utilities</H3>
<I>Version Information --- Run-time and compile-time version checks.</I>
<DL COMPACT>
<DT id="714">$version_code = Cairo-&gt;lib_version<DD>
<DT id="715">$version_string = Cairo-&gt;lib_version_string<DD>
These two functions return the version of libcairo that the program is
currently running against.
<DT id="716">$version_code = Cairo-&gt;<FONT SIZE="-1">LIB_VERSION</FONT><DD>
Returns the version of libcairo that Cairo was compiled against.
<DT id="717">$version_code = Cairo-&gt;<FONT SIZE="-1">LIB_VERSION_ENCODE</FONT> ($major, $minor, $micro)<DD>
<DL COMPACT><DT id="718"><DD>
<DL COMPACT>
<DT id="719">$major: integer<DD>
<DT id="720">$minor: integer<DD>
<DT id="721">$micro: integer<DD>
</DL>
</DL>
<DL COMPACT><DT id="722"><DD>
<P>
Encodes the version <TT>&quot;$major.$minor.$micro&quot;</TT> as an integer suitable for
comparison against <TT>&quot;Cairo-&gt;lib_version&quot;</TT> and <TT>&quot;Cairo-&gt;LIB_VERSION&quot;</TT>.
</DL>
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<DL COMPACT>
<DT id="723">&lt;<A HREF="http://cairographics.org/documentation">http://cairographics.org/documentation</A>&gt;<DD>
Lists many available resources including tutorials and examples
<DT id="724">&lt;<A HREF="http://cairographics.org/manual/">http://cairographics.org/manual/</A>&gt;<DD>
Contains the reference manual
</DL>
<A NAME="lbAK">&nbsp;</A>
<H2>AUTHORS</H2>
<DL COMPACT>
<DT id="725">Ross McFarland &lt;rwmcfa1 at neces dot com&gt;<DD>
<DT id="726">Torsten Schoenfeld &lt;kaffeetisch at gmx dot de&gt;<DD>
</DL>
<A NAME="lbAL">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (C) 2004-2013 by the cairo perl team
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="727"><A HREF="#lbAB">NAME</A><DD>
<DT id="728"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="729"><A HREF="#lbAD">ABSTRACT</A><DD>
<DT id="730"><A HREF="#lbAE">API DOCUMENTATION</A><DD>
<DL>
<DT id="731"><A HREF="#lbAF">Drawing</A><DD>
<DT id="732"><A HREF="#lbAG">Fonts</A><DD>
<DT id="733"><A HREF="#lbAH">Surfaces</A><DD>
<DT id="734"><A HREF="#lbAI">Utilities</A><DD>
</DL>
<DT id="735"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="736"><A HREF="#lbAK">AUTHORS</A><DD>
<DT id="737"><A HREF="#lbAL">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:37 GMT, March 31, 2021
</BODY>
</HTML>