1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GtkGradient</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
8 <link rel="up" href="theming.html" title="Part III. Theming in GTK+">
9 <link rel="prev" href="gtk3-GtkSymbolicColor.html" title="GtkSymbolicColor">
10 <link rel="next" href="GtkIconTheme.html" title="GtkIconTheme">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
17 <td><a accesskey="p" href="gtk3-GtkSymbolicColor.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="theming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GTK+ 3 Reference Manual</th>
21 <td><a accesskey="n" href="GtkIconTheme.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gtk3-GtkGradient.synopsis" class="shortcut">Top</a>
26 <a href="#gtk3-GtkGradient.description" class="shortcut">Description</a>
29 <div class="refentry">
30 <a name="gtk3-GtkGradient"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
33 <h2><span class="refentrytitle"><a name="gtk3-GtkGradient.top_of_page"></a>GtkGradient</span></h2>
34 <p>GtkGradient — Gradients</p>
36 <td valign="top" align="right"></td>
38 <div class="refsynopsisdiv">
39 <a name="gtk3-GtkGradient.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">
41 #include <gtk/gtk.h>
43 <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient">GtkGradient</a>;
44 <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-new-linear" title="gtk_gradient_new_linear ()">gtk_gradient_new_linear</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x0</code></em>,
45 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y0</code></em>,
46 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x1</code></em>,
47 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y1</code></em>);
48 <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-new-radial" title="gtk_gradient_new_radial ()">gtk_gradient_new_radial</a> (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x0</code></em>,
49 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y0</code></em>,
50 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> radius0</code></em>,
51 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x1</code></em>,
52 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y1</code></em>,
53 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> radius1</code></em>);
54 <span class="returnvalue">void</span> <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-add-color-stop" title="gtk_gradient_add_color_stop ()">gtk_gradient_add_color_stop</a> (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>,
55 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> offset</code></em>,
56 <em class="parameter"><code><a class="link" href="gtk3-GtkSymbolicColor.html#GtkSymbolicColor" title="GtkSymbolicColor"><span class="type">GtkSymbolicColor</span></a> *color</code></em>);
57 <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-ref" title="gtk_gradient_ref ()">gtk_gradient_ref</a> (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);
58 <span class="returnvalue">void</span> <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-unref" title="gtk_gradient_unref ()">gtk_gradient_unref</a> (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);
59 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-resolve" title="gtk_gradient_resolve ()">gtk_gradient_resolve</a> (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>,
60 <em class="parameter"><code><a class="link" href="gtk3-GtkStyleProperties.html#GtkStyleProperties" title="struct GtkStyleProperties"><span class="type">GtkStyleProperties</span></a> *props</code></em>,
61 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> **resolved_gradient</code></em>);
62 <span class="returnvalue">char</span> * <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-to-string" title="gtk_gradient_to_string ()">gtk_gradient_to_string</a> (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);
65 <div class="refsect1">
66 <a name="gtk3-GtkGradient.description"></a><h2>Description</h2>
68 GtkGradient is a boxed type that represents a gradient.
69 It is the result of parsing a
70 <a class="link" href="GtkCssProvider.html#gtkcssprovider-gradients" title="Gradients">gradient expression</a>.
71 To obtain the gradient represented by a GtkGradient, it has to
72 be resolved with <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-resolve" title="gtk_gradient_resolve ()"><code class="function">gtk_gradient_resolve()</code></a>, which replaces all
73 symbolic color references by the colors they refer to (in a given
74 context) and constructs a <a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> value.
77 It is not normally necessary to deal directly with <a href="gtk3-GtkGradient.html#GtkGradient"><span class="type">GtkGradients</span></a>,
78 since they are mostly used behind the scenes by <a class="link" href="GtkStyleContext.html" title="GtkStyleContext"><span class="type">GtkStyleContext</span></a> and
79 <a class="link" href="GtkCssProvider.html" title="GtkCssProvider"><span class="type">GtkCssProvider</span></a>.
82 <div class="refsect1">
83 <a name="gtk3-GtkGradient.details"></a><h2>Details</h2>
84 <div class="refsect2">
85 <a name="GtkGradient"></a><h3>GtkGradient</h3>
86 <pre class="programlisting">typedef struct _GtkGradient GtkGradient;</pre>
89 <div class="refsect2">
90 <a name="gtk-gradient-new-linear"></a><h3>gtk_gradient_new_linear ()</h3>
91 <pre class="programlisting"><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * gtk_gradient_new_linear (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x0</code></em>,
92 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y0</code></em>,
93 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x1</code></em>,
94 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y1</code></em>);</pre>
96 Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient
97 a number of stop colors must be added through <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-add-color-stop" title="gtk_gradient_add_color_stop ()"><code class="function">gtk_gradient_add_color_stop()</code></a>.
99 <div class="variablelist"><table border="0">
100 <col align="left" valign="top">
103 <td><p><span class="term"><em class="parameter"><code>x0</code></em> :</span></p></td>
104 <td>X coordinate of the starting point</td>
107 <td><p><span class="term"><em class="parameter"><code>y0</code></em> :</span></p></td>
108 <td>Y coordinate of the starting point</td>
111 <td><p><span class="term"><em class="parameter"><code>x1</code></em> :</span></p></td>
112 <td>X coordinate of the end point</td>
115 <td><p><span class="term"><em class="parameter"><code>y1</code></em> :</span></p></td>
116 <td>Y coordinate of the end point</td>
119 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
120 <td>A newly created <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
125 <p class="since">Since 3.0</p>
128 <div class="refsect2">
129 <a name="gtk-gradient-new-radial"></a><h3>gtk_gradient_new_radial ()</h3>
130 <pre class="programlisting"><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * gtk_gradient_new_radial (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x0</code></em>,
131 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y0</code></em>,
132 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> radius0</code></em>,
133 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> x1</code></em>,
134 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> y1</code></em>,
135 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> radius1</code></em>);</pre>
137 Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and
138 (x1, y1, radius1). Before using the gradient a number of stop colors must be added
139 through <a class="link" href="gtk3-GtkGradient.html#gtk-gradient-add-color-stop" title="gtk_gradient_add_color_stop ()"><code class="function">gtk_gradient_add_color_stop()</code></a>.
141 <div class="variablelist"><table border="0">
142 <col align="left" valign="top">
145 <td><p><span class="term"><em class="parameter"><code>x0</code></em> :</span></p></td>
146 <td>X coordinate of the start circle</td>
149 <td><p><span class="term"><em class="parameter"><code>y0</code></em> :</span></p></td>
150 <td>Y coordinate of the start circle</td>
153 <td><p><span class="term"><em class="parameter"><code>radius0</code></em> :</span></p></td>
154 <td>radius of the start circle</td>
157 <td><p><span class="term"><em class="parameter"><code>x1</code></em> :</span></p></td>
158 <td>X coordinate of the end circle</td>
161 <td><p><span class="term"><em class="parameter"><code>y1</code></em> :</span></p></td>
162 <td>Y coordinate of the end circle</td>
165 <td><p><span class="term"><em class="parameter"><code>radius1</code></em> :</span></p></td>
166 <td>radius of the end circle</td>
169 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
170 <td>A newly created <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
175 <p class="since">Since 3.0</p>
178 <div class="refsect2">
179 <a name="gtk-gradient-add-color-stop"></a><h3>gtk_gradient_add_color_stop ()</h3>
180 <pre class="programlisting"><span class="returnvalue">void</span> gtk_gradient_add_color_stop (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>,
181 <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a> offset</code></em>,
182 <em class="parameter"><code><a class="link" href="gtk3-GtkSymbolicColor.html#GtkSymbolicColor" title="GtkSymbolicColor"><span class="type">GtkSymbolicColor</span></a> *color</code></em>);</pre>
184 Adds a stop color to <em class="parameter"><code>gradient</code></em>.
186 <div class="variablelist"><table border="0">
187 <col align="left" valign="top">
190 <td><p><span class="term"><em class="parameter"><code>gradient</code></em> :</span></p></td>
191 <td>a <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
195 <td><p><span class="term"><em class="parameter"><code>offset</code></em> :</span></p></td>
196 <td>offset for the color stop</td>
199 <td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
200 <td>color to use</td>
204 <p class="since">Since 3.0</p>
207 <div class="refsect2">
208 <a name="gtk-gradient-ref"></a><h3>gtk_gradient_ref ()</h3>
209 <pre class="programlisting"><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="returnvalue">GtkGradient</span></a> * gtk_gradient_ref (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);</pre>
211 Increases the reference count of <em class="parameter"><code>gradient</code></em>.
213 <div class="variablelist"><table border="0">
214 <col align="left" valign="top">
217 <td><p><span class="term"><em class="parameter"><code>gradient</code></em> :</span></p></td>
218 <td>a <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
222 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
223 <td>The same <em class="parameter"><code>gradient</code></em>
228 <p class="since">Since 3.0</p>
231 <div class="refsect2">
232 <a name="gtk-gradient-unref"></a><h3>gtk_gradient_unref ()</h3>
233 <pre class="programlisting"><span class="returnvalue">void</span> gtk_gradient_unref (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);</pre>
235 Decreases the reference count of <em class="parameter"><code>gradient</code></em>, freeing its memory
236 if the reference count reaches 0.
238 <div class="variablelist"><table border="0">
239 <col align="left" valign="top">
241 <td><p><span class="term"><em class="parameter"><code>gradient</code></em> :</span></p></td>
242 <td>a <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
246 <p class="since">Since 3.0</p>
249 <div class="refsect2">
250 <a name="gtk-gradient-resolve"></a><h3>gtk_gradient_resolve ()</h3>
251 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gtk_gradient_resolve (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>,
252 <em class="parameter"><code><a class="link" href="gtk3-GtkStyleProperties.html#GtkStyleProperties" title="struct GtkStyleProperties"><span class="type">GtkStyleProperties</span></a> *props</code></em>,
253 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> **resolved_gradient</code></em>);</pre>
255 If <em class="parameter"><code>gradient</code></em> is resolvable, <em class="parameter"><code>resolved_gradient</code></em> will be filled in
256 with the resolved gradient as a cairo_pattern_t, and <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> will
257 be returned. Generally, if <em class="parameter"><code>gradient</code></em> can't be resolved, it is
258 due to it being defined on top of a named color that doesn't
259 exist in <em class="parameter"><code>props</code></em>.
261 <div class="variablelist"><table border="0">
262 <col align="left" valign="top">
265 <td><p><span class="term"><em class="parameter"><code>gradient</code></em> :</span></p></td>
266 <td>a <a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a>
270 <td><p><span class="term"><em class="parameter"><code>props</code></em> :</span></p></td>
272 <a class="link" href="gtk3-GtkStyleProperties.html#GtkStyleProperties" title="struct GtkStyleProperties"><span class="type">GtkStyleProperties</span></a> to use when resolving named colors</td>
275 <td><p><span class="term"><em class="parameter"><code>resolved_gradient</code></em> :</span></p></td>
276 <td>return location for the resolved pattern. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
280 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
282 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the gradient has been resolved</td>
286 <p class="since">Since 3.0</p>
289 <div class="refsect2">
290 <a name="gtk-gradient-to-string"></a><h3>gtk_gradient_to_string ()</h3>
291 <pre class="programlisting"><span class="returnvalue">char</span> * gtk_gradient_to_string (<em class="parameter"><code><a class="link" href="gtk3-GtkGradient.html#GtkGradient" title="GtkGradient"><span class="type">GtkGradient</span></a> *gradient</code></em>);</pre>
293 Creates a string representation for <em class="parameter"><code>gradient</code></em> that is suitable
294 for using in GTK CSS files.
296 <div class="variablelist"><table border="0">
297 <col align="left" valign="top">
300 <td><p><span class="term"><em class="parameter"><code>gradient</code></em> :</span></p></td>
301 <td>the gradient to print</td>
304 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
305 <td>A string representation for <em class="parameter"><code>gradient</code></em>
315 Generated by GTK-Doc V1.18</div>