1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = 
27  * outPack = cairo
28  * outFile = MeshPattern
29  * strct   = cairo_pattern_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = MeshPattern
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = cairo_pattern_t
38  * implements:
39  * prefixes:
40  * 	- cairo_mesh_pattern_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module cairo.MeshPattern;
53 
54 public  import cairo.c.types;
55 
56 private import cairo.c.functions;
57 private import glib.ConstructionException;
58 
59 
60 
61 private import cairo.Pattern;
62 
63 /**
64  * cairo_pattern_t is the paint with which cairo draws.
65  * The primary use of patterns is as the source for all cairo drawing
66  * operations, although they can also be used as masks, that is, as the
67  * brush too.
68  *
69  * A cairo pattern is created by using one of the many constructors,
70  * of the form
71  * cairo_pattern_create_type()
72  * or implicitly through
73  * cairo_set_source_type()
74  * functions.
75  */
76 public class MeshPattern : Pattern
77 {
78 	
79 	/** the main Gtk struct */
80 	protected cairo_pattern_t* cairo_pattern;
81 	
82 	
83 	/** Get the main Gtk struct */
84 	public cairo_pattern_t* getMeshPatternStruct()
85 	{
86 		return cairo_pattern;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)cairo_pattern;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (cairo_pattern_t* cairo_pattern)
100 	{
101 		super(cast(cairo_pattern_t*)cairo_pattern);
102 		this.cairo_pattern = cairo_pattern;
103 	}
104 	
105 	/** */
106 	public this()
107 	{
108 		this(cairo_pattern_create_mesh());
109 	}
110 	
111 	/**
112 	 */
113 	
114 	/**
115 	 * Begin a patch in a mesh pattern.
116 	 * After calling this function, the patch shape should be defined with
117 	 * cairo_mesh_pattern_move_to(), cairo_mesh_pattern_line_to() and
118 	 * cairo_mesh_pattern_curve_to().
119 	 * After defining the patch, cairo_mesh_pattern_end_patch() must be
120 	 * called before using pattern as a source or mask.
121 	 * Note: If pattern is not a mesh pattern then pattern will be put
122 	 * into an error status with a status of
123 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern already has a
124 	 * current patch, it will be put into an error status with a status of
125 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
126 	 * Since 1.12
127 	 */
128 	public void beginPatch()
129 	{
130 		// void cairo_mesh_pattern_begin_patch (cairo_pattern_t *pattern);
131 		cairo_mesh_pattern_begin_patch(cairo_pattern);
132 	}
133 	
134 	/**
135 	 * Indicates the end of the current patch in a mesh pattern.
136 	 * If the current patch has less than 4 sides, it is closed with a
137 	 * straight line from the current point to the first point of the
138 	 * patch as if cairo_mesh_pattern_line_to() was used.
139 	 * Note: If pattern is not a mesh pattern then pattern will be put
140 	 * into an error status with a status of
141 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
142 	 * patch or the current patch has no current point, pattern will be
143 	 * put into an error status with a status of
144 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
145 	 * Since 1.12
146 	 */
147 	public void endPatch()
148 	{
149 		// void cairo_mesh_pattern_end_patch (cairo_pattern_t *pattern);
150 		cairo_mesh_pattern_end_patch(cairo_pattern);
151 	}
152 	
153 	/**
154 	 * Define the first point of the current patch in a mesh pattern.
155 	 * After this call the current point will be (x, y).
156 	 * Note: If pattern is not a mesh pattern then pattern will be put
157 	 * into an error status with a status of
158 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
159 	 * patch or the current patch already has at least one side, pattern
160 	 * will be put into an error status with a status of
161 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
162 	 * Since 1.12
163 	 * Params:
164 	 * x = the X coordinate of the new position
165 	 * y = the Y coordinate of the new position
166 	 */
167 	public void moveTo(double x, double y)
168 	{
169 		// void cairo_mesh_pattern_move_to (cairo_pattern_t *pattern,  double x,  double y);
170 		cairo_mesh_pattern_move_to(cairo_pattern, x, y);
171 	}
172 	
173 	/**
174 	 * Adds a line to the current patch from the current point to position
175 	 * (x, y) in pattern-space coordinates.
176 	 * If there is no current point before the call to
177 	 * cairo_mesh_pattern_line_to() this function will behave as
178 	 * cairo_mesh_pattern_move_to(pattern, x, y).
179 	 * After this call the current point will be (x, y).
180 	 * Note: If pattern is not a mesh pattern then pattern will be put
181 	 * into an error status with a status of
182 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
183 	 * patch or the current patch already has 4 sides, pattern will be
184 	 * put into an error status with a status of
185 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
186 	 * Since 1.12
187 	 * Params:
188 	 * x = the X coordinate of the end of the new line
189 	 * y = the Y coordinate of the end of the new line
190 	 */
191 	public void lineTo(double x, double y)
192 	{
193 		// void cairo_mesh_pattern_line_to (cairo_pattern_t *pattern,  double x,  double y);
194 		cairo_mesh_pattern_line_to(cairo_pattern, x, y);
195 	}
196 	
197 	/**
198 	 * Adds a cubic Bézier spline to the current patch from the current
199 	 * point to position (x3, y3) in pattern-space coordinates, using
200 	 * (x1, y1) and (x2, y2) as the control points.
201 	 * If the current patch has no current point before the call to
202 	 * cairo_mesh_pattern_curve_to(), this function will behave as if
203 	 * preceded by a call to cairo_mesh_pattern_move_to(pattern, x1,
204 	 * y1).
205 	 * After this call the current point will be (x3, y3).
206 	 * Note: If pattern is not a mesh pattern then pattern will be put
207 	 * into an error status with a status of
208 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
209 	 * patch or the current patch already has 4 sides, pattern will be
210 	 * put into an error status with a status of
211 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
212 	 * Since 1.12
213 	 * Params:
214 	 * x1 = the X coordinate of the first control point
215 	 * y1 = the Y coordinate of the first control point
216 	 * x2 = the X coordinate of the second control point
217 	 * y2 = the Y coordinate of the second control point
218 	 * x3 = the X coordinate of the end of the curve
219 	 * y3 = the Y coordinate of the end of the curve
220 	 */
221 	public void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
222 	{
223 		// void cairo_mesh_pattern_curve_to (cairo_pattern_t *pattern,  double x1,  double y1,  double x2,  double y2,  double x3,  double y3);
224 		cairo_mesh_pattern_curve_to(cairo_pattern, x1, y1, x2, y2, x3, y3);
225 	}
226 	
227 	/**
228 	 * Set an internal control point of the current patch.
229 	 * Valid values for point_num are from 0 to 3 and identify the
230 	 * control points as explained in cairo_pattern_create_mesh().
231 	 * Note: If pattern is not a mesh pattern then pattern will be put
232 	 * into an error status with a status of
233 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If point_num is not valid,
234 	 * pattern will be put into an error status with a status of
235 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
236 	 * pattern will be put into an error status with a status of
237 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
238 	 * Since 1.12
239 	 * Params:
240 	 * pointNum = the control point to set the position for
241 	 * x = the X coordinate of the control point
242 	 * y = the Y coordinate of the control point
243 	 */
244 	public void setControlPoint(uint pointNum, double x, double y)
245 	{
246 		// void cairo_mesh_pattern_set_control_point  (cairo_pattern_t *pattern,  unsigned int point_num,  double x,  double y);
247 		cairo_mesh_pattern_set_control_point(cairo_pattern, pointNum, x, y);
248 	}
249 	
250 	/**
251 	 * Sets the color of a corner of the current patch in a mesh pattern.
252 	 * The color is specified in the same way as in cairo_set_source_rgb().
253 	 * Valid values for corner_num are from 0 to 3 and identify the
254 	 * corners as explained in cairo_pattern_create_mesh().
255 	 * Note: If pattern is not a mesh pattern then pattern will be put
256 	 * into an error status with a status of
257 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If corner_num is not valid,
258 	 * pattern will be put into an error status with a status of
259 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
260 	 * pattern will be put into an error status with a status of
261 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
262 	 * Since 1.12
263 	 * Params:
264 	 * cornerNum = the corner to set the color for
265 	 * red = red component of color
266 	 * green = green component of color
267 	 * blue = blue component of color
268 	 */
269 	public void setCornerColorRgb(uint cornerNum, double red, double green, double blue)
270 	{
271 		// void cairo_mesh_pattern_set_corner_color_rgb  (cairo_pattern_t *pattern,  unsigned int corner_num,  double red,  double green,  double blue);
272 		cairo_mesh_pattern_set_corner_color_rgb(cairo_pattern, cornerNum, red, green, blue);
273 	}
274 	
275 	/**
276 	 * Sets the color of a corner of the current patch in a mesh pattern.
277 	 * The color is specified in the same way as in cairo_set_source_rgba().
278 	 * Valid values for corner_num are from 0 to 3 and identify the
279 	 * corners as explained in cairo_pattern_create_mesh().
280 	 * Note: If pattern is not a mesh pattern then pattern will be put
281 	 * into an error status with a status of
282 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If corner_num is not valid,
283 	 * pattern will be put into an error status with a status of
284 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
285 	 * pattern will be put into an error status with a status of
286 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
287 	 * Since 1.12
288 	 * Params:
289 	 * cornerNum = the corner to set the color for
290 	 * red = red component of color
291 	 * green = green component of color
292 	 * blue = blue component of color
293 	 * alpha = alpha component of color
294 	 */
295 	public void setCornerColorRgba(uint cornerNum, double red, double green, double blue, double alpha)
296 	{
297 		// void cairo_mesh_pattern_set_corner_color_rgba  (cairo_pattern_t *pattern,  unsigned int corner_num,  double red,  double green,  double blue,  double alpha);
298 		cairo_mesh_pattern_set_corner_color_rgba(cairo_pattern, cornerNum, red, green, blue, alpha);
299 	}
300 	
301 	/**
302 	 * Gets the number of patches specified in the given mesh pattern.
303 	 * The number only includes patches which have been finished by
304 	 * calling cairo_mesh_pattern_end_patch(). For example it will be 0
305 	 * during the definition of the first patch.
306 	 * Since 1.12
307 	 * Params:
308 	 * count = return value for the number patches, or NULL
309 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if pattern is not a mesh pattern.
310 	 */
311 	public cairo_status_t getPatchCount(out uint count)
312 	{
313 		// cairo_status_t cairo_mesh_pattern_get_patch_count (cairo_pattern_t *pattern,  unsigned int *count);
314 		return cairo_mesh_pattern_get_patch_count(cairo_pattern, &count);
315 	}
316 	
317 	/**
318 	 * Gets path defining the patch patch_num for a mesh
319 	 * pattern.
320 	 * patch_num can range 0 to 1 less than the number returned by
321 	 * cairo_mesh_pattern_get_patch_count().
322 	 * Since 1.12
323 	 * Params:
324 	 * patchNum = the patch number to return data for
325 	 * Returns: the path defining the patch, or a path with status CAIRO_STATUS_INVALID_INDEX if patch_num or point_num is not valid for pattern. If pattern is not a mesh pattern, a path with status CAIRO_STATUS_PATTERN_TYPE_MISMATCH is returned.
326 	 */
327 	public cairo_path_t* getPath(uint patchNum)
328 	{
329 		// cairo_path_t * cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,  unsigned int patch_num);
330 		return cairo_mesh_pattern_get_path(cairo_pattern, patchNum);
331 	}
332 	
333 	/**
334 	 * Gets the control point point_num of patch patch_num for a mesh
335 	 * pattern.
336 	 * patch_num can range 0 to 1 less than the number returned by
337 	 * cairo_mesh_pattern_get_patch_count().
338 	 * Valid values for point_num are from 0 to 3 and identify the
339 	 * control points as explained in cairo_pattern_create_mesh().
340 	 * Since 1.12
341 	 * Params:
342 	 * patchNum = the patch number to return data for
343 	 * pointNum = the control point number to return data for
344 	 * x = return value for the x coordinate of the control point, or NULL
345 	 * y = return value for the y coordinate of the control point, or NULL
346 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_INVALID_INDEX if patch_num or point_num is not valid for pattern. If pattern is not a mesh pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH is returned.
347 	 */
348 	public cairo_status_t getControlPoint(uint patchNum, uint pointNum, out double x, out double y)
349 	{
350 		// cairo_status_t cairo_mesh_pattern_get_control_point  (cairo_pattern_t *pattern,  unsigned int patch_num,  unsigned int point_num,  double *x,  double *y);
351 		return cairo_mesh_pattern_get_control_point(cairo_pattern, patchNum, pointNum, &x, &y);
352 	}
353 	
354 	/**
355 	 * Gets the color information in corner corner_num of patch
356 	 * patch_num for a mesh pattern.
357 	 * patch_num can range 0 to 1 less than the number returned by
358 	 * cairo_mesh_pattern_get_patch_count().
359 	 * Valid values for corner_num are from 0 to 3 and identify the
360 	 * corners as explained in cairo_pattern_create_mesh().
361 	 * Since 1.12
362 	 * Params:
363 	 * patchNum = the patch number to return data for
364 	 * cornerNum = the corner number to return data for
365 	 * red = return value for red component of color, or NULL
366 	 * green = return value for green component of color, or NULL
367 	 * blue = return value for blue component of color, or NULL
368 	 * alpha = return value for alpha component of color, or NULL
369 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_INVALID_INDEX if patch_num or corner_num is not valid for pattern. If pattern is not a mesh pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH is returned.
370 	 */
371 	public cairo_status_t getCornerColorRgba(uint patchNum, uint cornerNum, out double red, out double green, out double blue, out double alpha)
372 	{
373 		// cairo_status_t cairo_mesh_pattern_get_corner_color_rgba  (cairo_pattern_t *pattern,  unsigned int patch_num,  unsigned int corner_num,  double *red,  double *green,  double *blue,  double *alpha);
374 		return cairo_mesh_pattern_get_corner_color_rgba(cairo_pattern, patchNum, cornerNum, &red, &green, &blue, &alpha);
375 	}
376 }