⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.83
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
doc
/
libgtk-3-dev
/
gdk3
/
View File Name :
gdk3-Cairo-Interaction.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Cairo Interaction: GDK 3 Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="GDK 3 Reference Manual"> <link rel="up" href="reference.html" title="API Reference"> <link rel="prev" href="gdk3-Pango-Interaction.html" title="Pango Interaction"> <link rel="next" href="gdk3-X-Window-System-Interaction.html" title="X Window System Interaction"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#gdk3-Cairo-Interaction.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="reference.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="gdk3-Pango-Interaction.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="gdk3-X-Window-System-Interaction.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="gdk3-Cairo-Interaction"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="gdk3-Cairo-Interaction.top_of_page"></a>Cairo Interaction</span></h2> <p>Cairo Interaction — Functions to support using cairo</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="gdk3-Cairo-Interaction.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-window-create-similar-surface" title="gdk_window_create_similar_surface ()">gdk_window_create_similar_surface</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-window-create-similar-image-surface" title="gdk_window_create_similar_image_surface ()">gdk_window_create_similar_image_surface</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="returnvalue">cairo_t</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-create" title="gdk_cairo_create ()">gdk_cairo_create</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-get-clip-rectangle" title="gdk_cairo_get_clip_rectangle ()">gdk_cairo_get_clip_rectangle</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="GdkDrawingContext.html" title="GdkDrawingContext"><span class="returnvalue">GdkDrawingContext</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-get-drawing-context" title="gdk_cairo_get_drawing_context ()">gdk_cairo_get_drawing_context</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-set-source-color" title="gdk_cairo_set_source_color ()">gdk_cairo_set_source_color</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-set-source-rgba" title="gdk_cairo_set_source_rgba ()">gdk_cairo_set_source_rgba</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-set-source-pixbuf" title="gdk_cairo_set_source_pixbuf ()">gdk_cairo_set_source_pixbuf</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-set-source-window" title="gdk_cairo_set_source_window ()">gdk_cairo_set_source_window</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-rectangle" title="gdk_cairo_rectangle ()">gdk_cairo_rectangle</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-region" title="gdk_cairo_region ()">gdk_cairo_region</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-t"><span class="returnvalue">cairo_region_t</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-region-create-from-surface" title="gdk_cairo_region_create_from_surface ()">gdk_cairo_region_create_from_surface</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-surface-create-from-pixbuf" title="gdk_cairo_surface_create_from_pixbuf ()">gdk_cairo_surface_create_from_pixbuf</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-draw-from-gl" title="gdk_cairo_draw_from_gl ()">gdk_cairo_draw_from_gl</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="gdk3-Cairo-Interaction.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <gdk/gdk.h> </pre> </div> <div class="refsect1"> <a name="gdk3-Cairo-Interaction.description"></a><h2>Description</h2> <p><a class="ulink" href="http://cairographics.org" target="_top">Cairo</a> is a graphics library that supports vector graphics and image compositing that can be used with GDK. GTK+ does all of its drawing using cairo.</p> <p>GDK does not wrap the cairo API, instead it allows to create cairo contexts which can be used to draw on <a href="gdk3-Windows.html#GdkWindow-struct"><span class="type">GdkWindows</span></a>. Additional functions allow use <span class="type">GdkRectangles</span> with cairo and to use <a href="gdk3-Colors.html#GdkColor"><span class="type">GdkColors</span></a>, <a href="gdk3-RGBA-Colors.html#GdkRGBA"><span class="type">GdkRGBAs</span></a>, <span class="type">GdkPixbufs</span> and <a href="gdk3-Windows.html#GdkWindow-struct"><span class="type">GdkWindows</span></a> as sources for drawing operations.</p> </div> <div class="refsect1"> <a name="gdk3-Cairo-Interaction.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="gdk-window-create-similar-surface"></a><h3>gdk_window_create_similar_surface ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * gdk_window_create_similar_surface (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-content-t"><span class="type">cairo_content_t</span></a> content</code></em>, <em class="parameter"><code><span class="type">int</span> width</code></em>, <em class="parameter"><code><span class="type">int</span> height</code></em>);</pre> <p>Create a new surface that is as compatible as possible with the given <em class="parameter"><code>window</code></em> . For example the new surface will have the same fallback resolution and font options as <em class="parameter"><code>window</code></em> . Generally, the new surface will also use the same backend as <em class="parameter"><code>window</code></em> , unless that is not possible for some reason. The type of the returned surface may be examined with <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-get-type"><code class="function">cairo_surface_get_type()</code></a>.</p> <p>Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)</p> <div class="refsect3"> <a name="gdk-window-create-similar-surface.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>window</p></td> <td class="parameter_description"><p>window to make new surface similar to</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>content</p></td> <td class="parameter_description"><p>the content for the new surface</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>width</p></td> <td class="parameter_description"><p>width of the new surface</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>height</p></td> <td class="parameter_description"><p>height of the new surface</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-window-create-similar-surface.returns"></a><h4>Returns</h4> <p> a pointer to the newly allocated surface. The caller owns the surface and should call <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-destroy"><code class="function">cairo_surface_destroy()</code></a> when done with it.</p> <p>This function always returns a valid pointer, but it will return a pointer to a “nil” surface if <em class="parameter"><code>other</code></em> is already in an error state or any other error occurs.</p> </div> <p class="since">Since: 2.22</p> </div> <hr> <div class="refsect2"> <a name="gdk-window-create-similar-image-surface"></a><h3>gdk_window_create_similar_image_surface ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * gdk_window_create_similar_image_surface (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html#cairo-format-t"><span class="type">cairo_format_t</span></a> format</code></em>, <em class="parameter"><code><span class="type">int</span> width</code></em>, <em class="parameter"><code><span class="type">int</span> height</code></em>, <em class="parameter"><code><span class="type">int</span> scale</code></em>);</pre> <p>Create a new image surface that is efficient to draw on the given <em class="parameter"><code>window</code></em> .</p> <p>Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)</p> <p>The <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> of the new surface are not affected by the scaling factor of the <em class="parameter"><code>window</code></em> , or by the <em class="parameter"><code>scale</code></em> argument; they are the size of the surface in device pixels. If you wish to create an image surface capable of holding the contents of <em class="parameter"><code>window</code></em> you can use:</p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10</pre></td> <td class="listing_code"><pre class="programlisting"><span class="kt">int</span> <span class="n">scale</span> <span class="o">=</span> <span class="n">gdk_window_get_scale_factor</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> <span class="kt">int</span> <span class="n">width</span> <span class="o">=</span> <span class="n">gdk_window_get_width</span> <span class="p">(</span><span class="n">window</span><span class="p">)</span> <span class="o">*</span> <span class="n">scale</span><span class="p">;</span> <span class="kt">int</span> <span class="n">height</span> <span class="o">=</span> <span class="n">gdk_window_get_height</span> <span class="p">(</span><span class="n">window</span><span class="p">)</span> <span class="o">*</span> <span class="n">scale</span><span class="p">;</span> <span class="c1">// format is set elsewhere</span> <span class="n">cairo_surface_t</span> <span class="o">*</span><span class="n">surface</span> <span class="o">=</span> <span class="n">gdk_window_create_similar_image_surface</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">format</span><span class="p">,</span> <span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">scale</span><span class="p">);</span></pre></td> </tr> </tbody> </table> </div> <p></p> <p>Note that unlike <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-create-similar-image"><code class="function">cairo_surface_create_similar_image()</code></a>, the new surface's device scale is set to <em class="parameter"><code>scale</code></em> , or to the scale factor of <em class="parameter"><code>window</code></em> if <em class="parameter"><code>scale</code></em> is 0.</p> <div class="refsect3"> <a name="gdk-window-create-similar-image-surface.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>window</p></td> <td class="parameter_description"><p>window to make new surface similar to, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if none. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>format</p></td> <td class="parameter_description"><p>the format for the new surface. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> int]</span></td> </tr> <tr> <td class="parameter_name"><p>width</p></td> <td class="parameter_description"><p>width of the new surface</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>height</p></td> <td class="parameter_description"><p>height of the new surface</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>scale</p></td> <td class="parameter_description"><p>the scale of the new surface, or 0 to use same as <em class="parameter"><code>window</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-window-create-similar-image-surface.returns"></a><h4>Returns</h4> <p> a pointer to the newly allocated surface. The caller owns the surface and should call <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-destroy"><code class="function">cairo_surface_destroy()</code></a> when done with it.</p> <p>This function always returns a valid pointer, but it will return a pointer to a “nil” surface if <em class="parameter"><code>other</code></em> is already in an error state or any other error occurs.</p> </div> <p class="since">Since: <a class="link" href="api-index-3-10.html#api-index-3.10">3.10</a></p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-create"></a><h3>gdk_cairo_create ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="returnvalue">cairo_t</span></a> * gdk_cairo_create (<em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>);</pre> <div class="warning"> <p><code class="literal">gdk_cairo_create</code> has been deprecated since version 3.22 and should not be used in newly-written code.</p> <p>Use <a class="link" href="gdk3-Windows.html#gdk-window-begin-draw-frame" title="gdk_window_begin_draw_frame ()"><code class="function">gdk_window_begin_draw_frame()</code></a> and <a class="link" href="GdkDrawingContext.html#gdk-drawing-context-get-cairo-context" title="gdk_drawing_context_get_cairo_context ()"><code class="function">gdk_drawing_context_get_cairo_context()</code></a> instead</p> </div> <p>Creates a Cairo context for drawing to <em class="parameter"><code>window</code></em> .</p> <p>Note that calling <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-reset-clip"><code class="function">cairo_reset_clip()</code></a> on the resulting <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> will produce undefined results, so avoid it at all costs.</p> <p>Typically, this function is used to draw on a <a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> out of the paint cycle of the toolkit; this should be avoided, as it breaks various assumptions and optimizations.</p> <p>If you are drawing on a native <a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> in response to a <a class="link" href="gdk3-Events.html#GDK-EXPOSE:CAPS"><code class="literal">GDK_EXPOSE</code></a> event you should use <a class="link" href="gdk3-Windows.html#gdk-window-begin-draw-frame" title="gdk_window_begin_draw_frame ()"><code class="function">gdk_window_begin_draw_frame()</code></a> and <a class="link" href="GdkDrawingContext.html#gdk-drawing-context-get-cairo-context" title="gdk_drawing_context_get_cairo_context ()"><code class="function">gdk_drawing_context_get_cairo_context()</code></a> instead. GTK will automatically do this for you when drawing a widget.</p> <div class="refsect3"> <a name="gdk-cairo-create.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>window</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-cairo-create.returns"></a><h4>Returns</h4> <p> A newly created Cairo context. Free with <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-destroy"><code class="function">cairo_destroy()</code></a> when you are done drawing.</p> </div> <p class="since">Since: 2.8</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-get-clip-rectangle"></a><h3>gdk_cairo_get_clip_rectangle ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gdk_cairo_get_clip_rectangle (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code><a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *rect</code></em>);</pre> <p>This is a convenience function around <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-clip-extents"><code class="function">cairo_clip_extents()</code></a>. It rounds the clip extents to integer coordinates and returns a boolean indicating if a clip area exists.</p> <div class="refsect3"> <a name="gdk-cairo-get-clip-rectangle.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>rect</p></td> <td class="parameter_description"><p>return location for the clip, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-cairo-get-clip-rectangle.returns"></a><h4>Returns</h4> <p> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if a clip rectangle exists, <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if all of <em class="parameter"><code>cr</code></em> is clipped and all drawing can be skipped</p> </div> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-get-drawing-context"></a><h3>gdk_cairo_get_drawing_context ()</h3> <pre class="programlisting"><a class="link" href="GdkDrawingContext.html" title="GdkDrawingContext"><span class="returnvalue">GdkDrawingContext</span></a> * gdk_cairo_get_drawing_context (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>);</pre> <p>Retrieves the <a class="link" href="GdkDrawingContext.html" title="GdkDrawingContext"><span class="type">GdkDrawingContext</span></a> that created the Cairo context <em class="parameter"><code>cr</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-get-drawing-context.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a Cairo context</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-cairo-get-drawing-context.returns"></a><h4>Returns</h4> <p>a <a class="link" href="GdkDrawingContext.html" title="GdkDrawingContext"><span class="type">GdkDrawingContext</span></a>, if any is set. </p> <p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></p> </div> <p class="since">Since: <a class="link" href="api-index-3-22.html#api-index-3.22">3.22</a></p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-set-source-color"></a><h3>gdk_cairo_set_source_color ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_set_source_color (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code>const <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre> <div class="warning"> <p><code class="literal">gdk_cairo_set_source_color</code> has been deprecated since version 3.4 and should not be used in newly-written code.</p> <p>Use <a class="link" href="gdk3-Cairo-Interaction.html#gdk-cairo-set-source-rgba" title="gdk_cairo_set_source_rgba ()"><code class="function">gdk_cairo_set_source_rgba()</code></a> instead</p> </div> <p>Sets the specified <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> as the source color of <em class="parameter"><code>cr</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-set-source-color.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>color</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk3-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: 2.8</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-set-source-rgba"></a><h3>gdk_cairo_set_source_rgba ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_set_source_rgba (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code>const <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a> *rgba</code></em>);</pre> <p>Sets the specified <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a> as the source color of <em class="parameter"><code>cr</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-set-source-rgba.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>rgba</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk3-RGBA-Colors.html#GdkRGBA" title="GdkRGBA"><span class="type">GdkRGBA</span></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-3-0.html#api-index-3.0">3.0</a></p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-set-source-pixbuf"></a><h3>gdk_cairo_set_source_pixbuf ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_set_source_pixbuf (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code>const <span class="type">GdkPixbuf</span> *pixbuf</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> pixbuf_x</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> pixbuf_y</code></em>);</pre> <p>Sets the given pixbuf as the source pattern for <em class="parameter"><code>cr</code></em> .</p> <p>The pattern has an extend mode of <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html#CAIRO-EXTEND-NONE:CAPS"><code class="literal">CAIRO_EXTEND_NONE</code></a> and is aligned so that the origin of <em class="parameter"><code>pixbuf</code></em> is <em class="parameter"><code>pixbuf_x</code></em> , <em class="parameter"><code>pixbuf_y</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-set-source-pixbuf.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <span class="type">GdkPixbuf</span></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>pixbuf_x</p></td> <td class="parameter_description"><p>X coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>pixbuf_y</p></td> <td class="parameter_description"><p>Y coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: 2.8</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-set-source-window"></a><h3>gdk_cairo_set_source_window ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_set_source_window (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x</code></em>, <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y</code></em>);</pre> <p>Sets the given window as the source pattern for <em class="parameter"><code>cr</code></em> .</p> <p>The pattern has an extend mode of <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html#CAIRO-EXTEND-NONE:CAPS"><code class="literal">CAIRO_EXTEND_NONE</code></a> and is aligned so that the origin of <em class="parameter"><code>window</code></em> is <em class="parameter"><code>x</code></em> , <em class="parameter"><code>y</code></em> . The window contains all its subwindows when rendering.</p> <p>Note that the contents of <em class="parameter"><code>window</code></em> are undefined outside of the visible part of <em class="parameter"><code>window</code></em> , so use this function with care.</p> <div class="refsect3"> <a name="gdk-cairo-set-source-window.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>window</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>x</p></td> <td class="parameter_description"><p>X coordinate of location to place upper left corner of <em class="parameter"><code>window</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>y</p></td> <td class="parameter_description"><p>Y coordinate of location to place upper left corner of <em class="parameter"><code>window</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: 2.24</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-rectangle"></a><h3>gdk_cairo_rectangle ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_rectangle (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code>const <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a> *rectangle</code></em>);</pre> <p>Adds the given rectangle to the current path of <em class="parameter"><code>cr</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-rectangle.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>rectangle</p></td> <td class="parameter_description"><p>a <a class="link" href="gdk3-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: 2.8</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-region"></a><h3>gdk_cairo_region ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_region (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-t"><span class="type">cairo_region_t</span></a> *region</code></em>);</pre> <p>Adds the given region to the current path of <em class="parameter"><code>cr</code></em> .</p> <div class="refsect3"> <a name="gdk-cairo-region.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>region</p></td> <td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-t"><span class="type">cairo_region_t</span></a></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: 2.8</p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-region-create-from-surface"></a><h3>gdk_cairo_region_create_from_surface ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-t"><span class="returnvalue">cairo_region_t</span></a> * gdk_cairo_region_create_from_surface (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> *surface</code></em>);</pre> <p>Creates region that describes covers the area where the given <em class="parameter"><code>surface</code></em> is more than 50% opaque.</p> <p>This function takes into account device offsets that might be set with <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-set-device-offset"><code class="function">cairo_surface_set_device_offset()</code></a>.</p> <div class="refsect3"> <a name="gdk-cairo-region-create-from-surface.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>surface</p></td> <td class="parameter_description"><p>a cairo surface</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-cairo-region-create-from-surface.returns"></a><h4>Returns</h4> <p> A <a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-t"><span class="type">cairo_region_t</span></a>; must be freed with <a href="/usr/share/gtk-doc/html/cairo/cairo-Regions.html#cairo-region-destroy"><code class="function">cairo_region_destroy()</code></a></p> </div> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-surface-create-from-pixbuf"></a><h3>gdk_cairo_surface_create_from_pixbuf ()</h3> <pre class="programlisting"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-t"><span class="returnvalue">cairo_surface_t</span></a> * gdk_cairo_surface_create_from_pixbuf (<em class="parameter"><code>const <span class="type">GdkPixbuf</span> *pixbuf</code></em>, <em class="parameter"><code><span class="type">int</span> scale</code></em>, <em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *for_window</code></em>);</pre> <p>Creates an image surface with the same contents as the pixbuf.</p> <div class="refsect3"> <a name="gdk-cairo-surface-create-from-pixbuf.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>pixbuf</p></td> <td class="parameter_description"><p>a <span class="type">GdkPixbuf</span></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>scale</p></td> <td class="parameter_description"><p>the scale of the new surface, or 0 to use same as <em class="parameter"><code>window</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>for_window</p></td> <td class="parameter_description"><p>The window this will be drawn to, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="gdk-cairo-surface-create-from-pixbuf.returns"></a><h4>Returns</h4> <p> a new cairo surface, must be freed with <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html#cairo-surface-destroy"><code class="function">cairo_surface_destroy()</code></a></p> </div> <p class="since">Since: <a class="link" href="api-index-3-10.html#api-index-3.10">3.10</a></p> </div> <hr> <div class="refsect2"> <a name="gdk-cairo-draw-from-gl"></a><h3>gdk_cairo_draw_from_gl ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> gdk_cairo_draw_from_gl (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> *cr</code></em>, <em class="parameter"><code><a class="link" href="gdk3-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> *window</code></em>, <em class="parameter"><code><span class="type">int</span> source</code></em>, <em class="parameter"><code><span class="type">int</span> source_type</code></em>, <em class="parameter"><code><span class="type">int</span> buffer_scale</code></em>, <em class="parameter"><code><span class="type">int</span> x</code></em>, <em class="parameter"><code><span class="type">int</span> y</code></em>, <em class="parameter"><code><span class="type">int</span> width</code></em>, <em class="parameter"><code><span class="type">int</span> height</code></em>);</pre> <p>This is the main way to draw GL content in GTK+. It takes a render buffer ID (<em class="parameter"><code>source_type</code></em> == <span class="type">GL_RENDERBUFFER</span>) or a texture id (<em class="parameter"><code>source_type</code></em> == <span class="type">GL_TEXTURE</span>) and draws it onto <em class="parameter"><code>cr</code></em> with an OVER operation, respecting the current clip. The top left corner of the rectangle specified by <em class="parameter"><code>x</code></em> , <em class="parameter"><code>y</code></em> , <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> will be drawn at the current (0,0) position of the cairo_t.</p> <p>This will work for *all* cairo_t, as long as <em class="parameter"><code>window</code></em> is realized, but the fallback implementation that reads back the pixels from the buffer may be used in the general case. In the case of direct drawing to a window with no special effects applied to <em class="parameter"><code>cr</code></em> it will however use a more efficient approach.</p> <p>For <span class="type">GL_RENDERBUFFER</span> the code will always fall back to software for buffers with alpha components, so make sure you use <span class="type">GL_TEXTURE</span> if using alpha.</p> <p>Calling this may change the current GL context.</p> <div class="refsect3"> <a name="gdk-cairo-draw-from-gl.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>cr</p></td> <td class="parameter_description"><p>a cairo context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>window</p></td> <td class="parameter_description"><p>The window we're rendering for (not necessarily into)</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>source</p></td> <td class="parameter_description"><p>The GL ID of the source buffer</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>source_type</p></td> <td class="parameter_description"><p>The type of the <em class="parameter"><code>source</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>buffer_scale</p></td> <td class="parameter_description"><p>The scale-factor that the <em class="parameter"><code>source</code></em> buffer is allocated for</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>x</p></td> <td class="parameter_description"><p>The source x position in <em class="parameter"><code>source</code></em> to start copying from in GL coordinates</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>y</p></td> <td class="parameter_description"><p>The source y position in <em class="parameter"><code>source</code></em> to start copying from in GL coordinates</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>width</p></td> <td class="parameter_description"><p>The width of the region to draw</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>height</p></td> <td class="parameter_description"><p>The height of the region to draw</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p> </div> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>