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 gtkc.cairotypes;
55 
56 private import gtkc.cairo;
57 private import glib.ConstructionException;
58 
59 
60 
61 
62 
63 private import cairo.Pattern;
64 
65 /**
66  * cairo_pattern_t is the paint with which cairo draws.
67  * The primary use of patterns is as the source for all cairo drawing
68  * operations, although they can also be used as masks, that is, as the
69  * brush too.
70  *
71  * A cairo pattern is created by using one of the many constructors,
72  * of the form
73  * cairo_pattern_create_type()
74  * or implicitly through
75  * cairo_set_source_type()
76  * functions.
77  */
78 public class MeshPattern : Pattern
79 {
80 	
81 	/** the main Gtk struct */
82 	protected cairo_pattern_t* cairo_pattern;
83 	
84 	
85 	public cairo_pattern_t* getMeshPatternStruct()
86 	{
87 		return cairo_pattern;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)cairo_pattern;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (cairo_pattern_t* cairo_pattern)
101 	{
102 		super(cast(cairo_pattern_t*)cairo_pattern);
103 		this.cairo_pattern = cairo_pattern;
104 	}
105 	
106 	/** */
107 	public this()
108 	{
109 		this(cairo_pattern_create_mesh());
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Begin a patch in a mesh pattern.
117 	 * After calling this function, the patch shape should be defined with
118 	 * cairo_mesh_pattern_move_to(), cairo_mesh_pattern_line_to() and
119 	 * cairo_mesh_pattern_curve_to().
120 	 * After defining the patch, cairo_mesh_pattern_end_patch() must be
121 	 * called before using pattern as a source or mask.
122 	 * Note: If pattern is not a mesh pattern then pattern will be put
123 	 * into an error status with a status of
124 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern already has a
125 	 * current patch, it will be put into an error status with a status of
126 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
127 	 * Since 1.12
128 	 */
129 	public void beginPatch()
130 	{
131 		// void cairo_mesh_pattern_begin_patch (cairo_pattern_t *pattern);
132 		cairo_mesh_pattern_begin_patch(cairo_pattern);
133 	}
134 	
135 	/**
136 	 * Indicates the end of the current patch in a mesh pattern.
137 	 * If the current patch has less than 4 sides, it is closed with a
138 	 * straight line from the current point to the first point of the
139 	 * patch as if cairo_mesh_pattern_line_to() was used.
140 	 * Note: If pattern is not a mesh pattern then pattern will be put
141 	 * into an error status with a status of
142 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
143 	 * patch or the current patch has no current point, pattern will be
144 	 * put into an error status with a status of
145 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
146 	 * Since 1.12
147 	 */
148 	public void endPatch()
149 	{
150 		// void cairo_mesh_pattern_end_patch (cairo_pattern_t *pattern);
151 		cairo_mesh_pattern_end_patch(cairo_pattern);
152 	}
153 	
154 	/**
155 	 * Define the first point of the current patch in a mesh pattern.
156 	 * After this call the current point will be (x, y).
157 	 * Note: If pattern is not a mesh pattern then pattern will be put
158 	 * into an error status with a status of
159 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
160 	 * patch or the current patch already has at least one side, pattern
161 	 * will be put into an error status with a status of
162 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
163 	 * Since 1.12
164 	 * Params:
165 	 * x = the X coordinate of the new position
166 	 * y = the Y coordinate of the new position
167 	 */
168 	public void moveTo(double x, double y)
169 	{
170 		// void cairo_mesh_pattern_move_to (cairo_pattern_t *pattern,  double x,  double y);
171 		cairo_mesh_pattern_move_to(cairo_pattern, x, y);
172 	}
173 	
174 	/**
175 	 * Adds a line to the current patch from the current point to position
176 	 * (x, y) in pattern-space coordinates.
177 	 * If there is no current point before the call to
178 	 * cairo_mesh_pattern_line_to() this function will behave as
179 	 * cairo_mesh_pattern_move_to(pattern, x, y).
180 	 * After this call the current point will be (x, y).
181 	 * Note: If pattern is not a mesh pattern then pattern will be put
182 	 * into an error status with a status of
183 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
184 	 * patch or the current patch already has 4 sides, pattern will be
185 	 * put into an error status with a status of
186 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
187 	 * Since 1.12
188 	 * Params:
189 	 * x = the X coordinate of the end of the new line
190 	 * y = the Y coordinate of the end of the new line
191 	 */
192 	public void lineTo(double x, double y)
193 	{
194 		// void cairo_mesh_pattern_line_to (cairo_pattern_t *pattern,  double x,  double y);
195 		cairo_mesh_pattern_line_to(cairo_pattern, x, y);
196 	}
197 	
198 	/**
199 	 * Adds a cubic Bézier spline to the current patch from the current
200 	 * point to position (x3, y3) in pattern-space coordinates, using
201 	 * (x1, y1) and (x2, y2) as the control points.
202 	 * If the current patch has no current point before the call to
203 	 * cairo_mesh_pattern_curve_to(), this function will behave as if
204 	 * preceded by a call to cairo_mesh_pattern_move_to(pattern, x1,
205 	 * y1).
206 	 * After this call the current point will be (x3, y3).
207 	 * Note: If pattern is not a mesh pattern then pattern will be put
208 	 * into an error status with a status of
209 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If pattern has no current
210 	 * patch or the current patch already has 4 sides, pattern will be
211 	 * put into an error status with a status of
212 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
213 	 * Since 1.12
214 	 * Params:
215 	 * x1 = the X coordinate of the first control point
216 	 * y1 = the Y coordinate of the first control point
217 	 * x2 = the X coordinate of the second control point
218 	 * y2 = the Y coordinate of the second control point
219 	 * x3 = the X coordinate of the end of the curve
220 	 * y3 = the Y coordinate of the end of the curve
221 	 */
222 	public void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
223 	{
224 		// void cairo_mesh_pattern_curve_to (cairo_pattern_t *pattern,  double x1,  double y1,  double x2,  double y2,  double x3,  double y3);
225 		cairo_mesh_pattern_curve_to(cairo_pattern, x1, y1, x2, y2, x3, y3);
226 	}
227 	
228 	/**
229 	 * Set an internal control point of the current patch.
230 	 * Valid values for point_num are from 0 to 3 and identify the
231 	 * control points as explained in cairo_pattern_create_mesh().
232 	 * Note: If pattern is not a mesh pattern then pattern will be put
233 	 * into an error status with a status of
234 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If point_num is not valid,
235 	 * pattern will be put into an error status with a status of
236 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
237 	 * pattern will be put into an error status with a status of
238 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
239 	 * Since 1.12
240 	 * Params:
241 	 * pointNum = the control point to set the position for
242 	 * x = the X coordinate of the control point
243 	 * y = the Y coordinate of the control point
244 	 */
245 	public void setControlPoint(uint pointNum, double x, double y)
246 	{
247 		// void cairo_mesh_pattern_set_control_point  (cairo_pattern_t *pattern,  unsigned int point_num,  double x,  double y);
248 		cairo_mesh_pattern_set_control_point(cairo_pattern, pointNum, x, y);
249 	}
250 	
251 	/**
252 	 * Sets the color of a corner of the current patch in a mesh pattern.
253 	 * The color is specified in the same way as in cairo_set_source_rgb().
254 	 * Valid values for corner_num are from 0 to 3 and identify the
255 	 * corners as explained in cairo_pattern_create_mesh().
256 	 * Note: If pattern is not a mesh pattern then pattern will be put
257 	 * into an error status with a status of
258 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If corner_num is not valid,
259 	 * pattern will be put into an error status with a status of
260 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
261 	 * pattern will be put into an error status with a status of
262 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
263 	 * Since 1.12
264 	 * Params:
265 	 * cornerNum = the corner to set the color for
266 	 * red = red component of color
267 	 * green = green component of color
268 	 * blue = blue component of color
269 	 */
270 	public void setCornerColorRgb(uint cornerNum, double red, double green, double blue)
271 	{
272 		// void cairo_mesh_pattern_set_corner_color_rgb  (cairo_pattern_t *pattern,  unsigned int corner_num,  double red,  double green,  double blue);
273 		cairo_mesh_pattern_set_corner_color_rgb(cairo_pattern, cornerNum, red, green, blue);
274 	}
275 	
276 	/**
277 	 * Sets the color of a corner of the current patch in a mesh pattern.
278 	 * The color is specified in the same way as in cairo_set_source_rgba().
279 	 * Valid values for corner_num are from 0 to 3 and identify the
280 	 * corners as explained in cairo_pattern_create_mesh().
281 	 * Note: If pattern is not a mesh pattern then pattern will be put
282 	 * into an error status with a status of
283 	 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH. If corner_num is not valid,
284 	 * pattern will be put into an error status with a status of
285 	 * CAIRO_STATUS_INVALID_INDEX. If pattern has no current patch,
286 	 * pattern will be put into an error status with a status of
287 	 * CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
288 	 * Since 1.12
289 	 * Params:
290 	 * cornerNum = the corner to set the color for
291 	 * red = red component of color
292 	 * green = green component of color
293 	 * blue = blue component of color
294 	 * alpha = alpha component of color
295 	 */
296 	public void setCornerColorRgba(uint cornerNum, double red, double green, double blue, double alpha)
297 	{
298 		// void cairo_mesh_pattern_set_corner_color_rgba  (cairo_pattern_t *pattern,  unsigned int corner_num,  double red,  double green,  double blue,  double alpha);
299 		cairo_mesh_pattern_set_corner_color_rgba(cairo_pattern, cornerNum, red, green, blue, alpha);
300 	}
301 	
302 	/**
303 	 * Gets the number of patches specified in the given mesh pattern.
304 	 * The number only includes patches which have been finished by
305 	 * calling cairo_mesh_pattern_end_patch(). For example it will be 0
306 	 * during the definition of the first patch.
307 	 * Since 1.12
308 	 * Params:
309 	 * count = return value for the number patches, or NULL
310 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if pattern is not a mesh pattern.
311 	 */
312 	public cairo_status_t getPatchCount(out uint count)
313 	{
314 		// cairo_status_t cairo_mesh_pattern_get_patch_count (cairo_pattern_t *pattern,  unsigned int *count);
315 		return cairo_mesh_pattern_get_patch_count(cairo_pattern, &count);
316 	}
317 	
318 	/**
319 	 * Gets path defining the patch patch_num for a mesh
320 	 * pattern.
321 	 * patch_num can range 0 to 1 less than the number returned by
322 	 * cairo_mesh_pattern_get_patch_count().
323 	 * Since 1.12
324 	 * Params:
325 	 * patchNum = the patch number to return data for
326 	 * 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.
327 	 */
328 	public cairo_path_t* getPath(uint patchNum)
329 	{
330 		// cairo_path_t * cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,  unsigned int patch_num);
331 		return cairo_mesh_pattern_get_path(cairo_pattern, patchNum);
332 	}
333 	
334 	/**
335 	 * Gets the control point point_num of patch patch_num for a mesh
336 	 * pattern.
337 	 * patch_num can range 0 to 1 less than the number returned by
338 	 * cairo_mesh_pattern_get_patch_count().
339 	 * Valid values for point_num are from 0 to 3 and identify the
340 	 * control points as explained in cairo_pattern_create_mesh().
341 	 * Since 1.12
342 	 * Params:
343 	 * patchNum = the patch number to return data for
344 	 * pointNum = the control point number to return data for
345 	 * x = return value for the x coordinate of the control point, or NULL
346 	 * y = return value for the y coordinate of the control point, or NULL
347 	 * 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.
348 	 */
349 	public cairo_status_t getControlPoint(uint patchNum, uint pointNum, out double x, out double y)
350 	{
351 		// 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);
352 		return cairo_mesh_pattern_get_control_point(cairo_pattern, patchNum, pointNum, &x, &y);
353 	}
354 	
355 	/**
356 	 * Gets the color information in corner corner_num of patch
357 	 * patch_num for a mesh pattern.
358 	 * patch_num can range 0 to 1 less than the number returned by
359 	 * cairo_mesh_pattern_get_patch_count().
360 	 * Valid values for corner_num are from 0 to 3 and identify the
361 	 * corners as explained in cairo_pattern_create_mesh().
362 	 * Since 1.12
363 	 * Params:
364 	 * patchNum = the patch number to return data for
365 	 * cornerNum = the corner number to return data for
366 	 * red = return value for red component of color, or NULL
367 	 * green = return value for green component of color, or NULL
368 	 * blue = return value for blue component of color, or NULL
369 	 * alpha = return value for alpha component of color, or NULL
370 	 * 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.
371 	 */
372 	public cairo_status_t getCornerColorRgba(uint patchNum, uint cornerNum, out double red, out double green, out double blue, out double alpha)
373 	{
374 		// 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);
375 		return cairo_mesh_pattern_get_corner_color_rgba(cairo_pattern, patchNum, cornerNum, &red, &green, &blue, &alpha);
376 	}
377 }