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  = cairo-cairo-pattern-t.html
27  * outPack = cairo
28  * outFile = Pattern
29  * strct   = cairo_pattern_t
30  * realStrct=
31  * ctorStrct=
32  * clss    = Pattern
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- cairo_pattern_
41  * omit structs:
42  * omit prefixes:
43  * 	- cairo_mesh_pattern_
44  * omit code:
45  * 	- cairo_pattern_create_mesh
46  * omit signals:
47  * imports:
48  * 	- cairo.Matrix
49  * 	- cairo.Surface
50  * structWrap:
51  * 	- cairo_matrix_t* -> Matrix
52  * 	- cairo_pattern_t* -> Pattern
53  * 	- cairo_surface_t* -> Surface
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module cairo.Pattern;
60 
61 public  import cairo.c.types;
62 
63 private import cairo.c.functions;
64 private import glib.ConstructionException;
65 
66 private import cairo.Matrix;
67 private import cairo.Surface;
68 
69 
70 
71 /**
72  * cairo_pattern_t is the paint with which cairo draws.
73  * The primary use of patterns is as the source for all cairo drawing
74  * operations, although they can also be used as masks, that is, as the
75  * brush too.
76  *
77  * A cairo pattern is created by using one of the many constructors,
78  * of the form
79  * cairo_pattern_create_type()
80  * or implicitly through
81  * cairo_set_source_type()
82  * functions.
83  */
84 public class Pattern
85 {
86 	
87 	/** the main Gtk struct */
88 	protected cairo_pattern_t* cairo_pattern;
89 	
90 	
91 	/** Get the main Gtk struct */
92 	public cairo_pattern_t* getPatternStruct()
93 	{
94 		return cairo_pattern;
95 	}
96 	
97 	
98 	/** the main Gtk struct as a void* */
99 	protected void* getStruct()
100 	{
101 		return cast(void*)cairo_pattern;
102 	}
103 	
104 	/**
105 	 * Sets our main struct and passes it to the parent class
106 	 */
107 	public this (cairo_pattern_t* cairo_pattern)
108 	{
109 		this.cairo_pattern = cairo_pattern;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Adds an opaque color stop to a gradient pattern. The offset
117 	 * specifies the location along the gradient's control vector. For
118 	 * example, a linear gradient's control vector is from (x0,y0) to
119 	 * (x1,y1) while a radial gradient's control vector is from any point
120 	 * on the start circle to the corresponding point on the end circle.
121 	 * The color is specified in the same way as in cairo_set_source_rgb().
122 	 * If two (or more) stops are specified with identical offset values,
123 	 * they will be sorted according to the order in which the stops are
124 	 * added, (stops added earlier will compare less than stops added
125 	 * later). This can be useful for reliably making sharp color
126 	 * transitions instead of the typical blend.
127 	 * Note: If the pattern is not a gradient pattern, (eg. a linear or
128 	 * radial pattern), then the pattern will be put into an error status
129 	 * with a status of CAIRO_STATUS_PATTERN_TYPE_MISMATCH.
130 	 * Since 1.0
131 	 * Params:
132 	 * offset = an offset in the range [0.0 .. 1.0]
133 	 * red = red component of color
134 	 * green = green component of color
135 	 * blue = blue component of color
136 	 */
137 	public void addColorStopRgb(double offset, double red, double green, double blue)
138 	{
139 		// void cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,  double offset,  double red,  double green,  double blue);
140 		cairo_pattern_add_color_stop_rgb(cairo_pattern, offset, red, green, blue);
141 	}
142 	
143 	/**
144 	 * Adds a translucent color stop to a gradient pattern. The offset
145 	 * specifies the location along the gradient's control vector. For
146 	 * example, a linear gradient's control vector is from (x0,y0) to
147 	 * (x1,y1) while a radial gradient's control vector is from any point
148 	 * on the start circle to the corresponding point on the end circle.
149 	 * The color is specified in the same way as in cairo_set_source_rgba().
150 	 * If two (or more) stops are specified with identical offset values,
151 	 * they will be sorted according to the order in which the stops are
152 	 * added, (stops added earlier will compare less than stops added
153 	 * later). This can be useful for reliably making sharp color
154 	 * transitions instead of the typical blend.
155 	 * Note: If the pattern is not a gradient pattern, (eg. a linear or
156 	 * radial pattern), then the pattern will be put into an error status
157 	 * with a status of CAIRO_STATUS_PATTERN_TYPE_MISMATCH.
158 	 * Since 1.0
159 	 * Params:
160 	 * offset = an offset in the range [0.0 .. 1.0]
161 	 * red = red component of color
162 	 * green = green component of color
163 	 * blue = blue component of color
164 	 * alpha = alpha component of color
165 	 */
166 	public void addColorStopRgba(double offset, double red, double green, double blue, double alpha)
167 	{
168 		// void cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,  double offset,  double red,  double green,  double blue,  double alpha);
169 		cairo_pattern_add_color_stop_rgba(cairo_pattern, offset, red, green, blue, alpha);
170 	}
171 	
172 	/**
173 	 * Gets the number of color stops specified in the given gradient
174 	 * pattern.
175 	 * Since 1.4
176 	 * Params:
177 	 * count = return value for the number of color stops, or NULL
178 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if pattern is not a gradient pattern.
179 	 */
180 	public cairo_status_t getColorStopCount(out int count)
181 	{
182 		// cairo_status_t cairo_pattern_get_color_stop_count (cairo_pattern_t *pattern,  int *count);
183 		return cairo_pattern_get_color_stop_count(cairo_pattern, &count);
184 	}
185 	
186 	/**
187 	 * Gets the color and offset information at the given index for a
188 	 * gradient pattern. Values of index are 0 to 1 less than the number
189 	 * returned by cairo_pattern_get_color_stop_count().
190 	 * Since 1.4
191 	 * Params:
192 	 * index = index of the stop to return data for
193 	 * offset = return value for the offset of the stop, or NULL
194 	 * red = return value for red component of color, or NULL
195 	 * green = return value for green component of color, or NULL
196 	 * blue = return value for blue component of color, or NULL
197 	 * alpha = return value for alpha component of color, or NULL
198 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_INVALID_INDEX if index is not valid for the given pattern. If the pattern is not a gradient pattern, CAIRO_STATUS_PATTERN_TYPE_MISMATCH is returned.
199 	 */
200 	public cairo_status_t getColorStopRgba(int index, out double offset, out double red, out double green, out double blue, out double alpha)
201 	{
202 		// cairo_status_t cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,  int index,  double *offset,  double *red,  double *green,  double *blue,  double *alpha);
203 		return cairo_pattern_get_color_stop_rgba(cairo_pattern, index, &offset, &red, &green, &blue, &alpha);
204 	}
205 	
206 	/**
207 	 * Creates a new cairo_pattern_t corresponding to an opaque color. The
208 	 * color components are floating point numbers in the range 0 to 1.
209 	 * If the values passed in are outside that range, they will be
210 	 * clamped.
211 	 * Since 1.0
212 	 * Params:
213 	 * red = red component of the color
214 	 * green = green component of the color
215 	 * blue = blue component of the color
216 	 * Returns: the newly created cairo_pattern_t if successful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().
217 	 */
218 	public static Pattern createRgb(double red, double green, double blue)
219 	{
220 		// cairo_pattern_t * cairo_pattern_create_rgb (double red,  double green,  double blue);
221 		auto p = cairo_pattern_create_rgb(red, green, blue);
222 		
223 		if(p is null)
224 		{
225 			return null;
226 		}
227 		
228 		return new Pattern(cast(cairo_pattern_t*) p);
229 	}
230 	
231 	/**
232 	 * Creates a new cairo_pattern_t corresponding to a translucent color.
233 	 * The color components are floating point numbers in the range 0 to
234 	 * 1. If the values passed in are outside that range, they will be
235 	 * clamped.
236 	 * Since 1.0
237 	 * Params:
238 	 * red = red component of the color
239 	 * green = green component of the color
240 	 * blue = blue component of the color
241 	 * alpha = alpha component of the color
242 	 * Returns: the newly created cairo_pattern_t if successful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().
243 	 */
244 	public static Pattern createRgba(double red, double green, double blue, double alpha)
245 	{
246 		// cairo_pattern_t * cairo_pattern_create_rgba (double red,  double green,  double blue,  double alpha);
247 		auto p = cairo_pattern_create_rgba(red, green, blue, alpha);
248 		
249 		if(p is null)
250 		{
251 			return null;
252 		}
253 		
254 		return new Pattern(cast(cairo_pattern_t*) p);
255 	}
256 	
257 	/**
258 	 * Gets the solid color for a solid color pattern.
259 	 * Since 1.4
260 	 * Params:
261 	 * red = return value for red component of color, or NULL
262 	 * green = return value for green component of color, or NULL
263 	 * blue = return value for blue component of color, or NULL
264 	 * alpha = return value for alpha component of color, or NULL
265 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if the pattern is not a solid color pattern.
266 	 */
267 	public cairo_status_t getRgba(out double red, out double green, out double blue, out double alpha)
268 	{
269 		// cairo_status_t cairo_pattern_get_rgba (cairo_pattern_t *pattern,  double *red,  double *green,  double *blue,  double *alpha);
270 		return cairo_pattern_get_rgba(cairo_pattern, &red, &green, &blue, &alpha);
271 	}
272 	
273 	/**
274 	 * Create a new cairo_pattern_t for the given surface.
275 	 * Since 1.0
276 	 * Params:
277 	 * surface = the surface
278 	 * Returns: the newly created cairo_pattern_t if successful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().
279 	 */
280 	public static Pattern createForSurface(Surface surface)
281 	{
282 		// cairo_pattern_t * cairo_pattern_create_for_surface (cairo_surface_t *surface);
283 		auto p = cairo_pattern_create_for_surface((surface is null) ? null : surface.getSurfaceStruct());
284 		
285 		if(p is null)
286 		{
287 			return null;
288 		}
289 		
290 		return new Pattern(cast(cairo_pattern_t*) p);
291 	}
292 	
293 	/**
294 	 * Gets the surface of a surface pattern. The reference returned in
295 	 * surface is owned by the pattern; the caller should call
296 	 * cairo_surface_reference() if the surface is to be retained.
297 	 * Since 1.4
298 	 * Params:
299 	 * surface = return value for surface of pattern, or NULL
300 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if the pattern is not a surface pattern.
301 	 */
302 	public cairo_status_t getSurface(out Surface surface)
303 	{
304 		// cairo_status_t cairo_pattern_get_surface (cairo_pattern_t *pattern,  cairo_surface_t **surface);
305 		cairo_surface_t* outsurface = null;
306 		
307 		auto p = cairo_pattern_get_surface(cairo_pattern, &outsurface);
308 		
309 		surface = new Surface(outsurface);
310 		return p;
311 	}
312 	
313 	/**
314 	 * Create a new linear gradient cairo_pattern_t along the line defined
315 	 * by (x0, y0) and (x1, y1). Before using the gradient pattern, a
316 	 * number of color stops should be defined using
317 	 * cairo_pattern_add_color_stop_rgb() or
318 	 * cairo_pattern_add_color_stop_rgba().
319 	 * Note: The coordinates here are in pattern space. For a new pattern,
320 	 * pattern space is identical to user space, but the relationship
321 	 * between the spaces can be changed with cairo_pattern_set_matrix().
322 	 * Since 1.0
323 	 * Params:
324 	 * x0 = x coordinate of the start point
325 	 * y0 = y coordinate of the start point
326 	 * x1 = x coordinate of the end point
327 	 * y1 = y coordinate of the end point
328 	 * Returns: the newly created cairo_pattern_t if successful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().
329 	 */
330 	public static Pattern createLinear(double x0, double y0, double x1, double y1)
331 	{
332 		// cairo_pattern_t * cairo_pattern_create_linear (double x0,  double y0,  double x1,  double y1);
333 		auto p = cairo_pattern_create_linear(x0, y0, x1, y1);
334 		
335 		if(p is null)
336 		{
337 			return null;
338 		}
339 		
340 		return new Pattern(cast(cairo_pattern_t*) p);
341 	}
342 	
343 	/**
344 	 * Gets the gradient endpoints for a linear gradient.
345 	 * Since 1.4
346 	 * Params:
347 	 * x0 = return value for the x coordinate of the first point, or NULL
348 	 * y0 = return value for the y coordinate of the first point, or NULL
349 	 * x1 = return value for the x coordinate of the second point, or NULL
350 	 * y1 = return value for the y coordinate of the second point, or NULL
351 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if pattern is not a linear gradient pattern.
352 	 */
353 	public cairo_status_t getLinearPoints(out double x0, out double y0, out double x1, out double y1)
354 	{
355 		// cairo_status_t cairo_pattern_get_linear_points (cairo_pattern_t *pattern,  double *x0,  double *y0,  double *x1,  double *y1);
356 		return cairo_pattern_get_linear_points(cairo_pattern, &x0, &y0, &x1, &y1);
357 	}
358 	
359 	/**
360 	 * Creates a new radial gradient cairo_pattern_t between the two
361 	 * circles defined by (cx0, cy0, radius0) and (cx1, cy1, radius1). Before using the
362 	 * gradient pattern, a number of color stops should be defined using
363 	 * cairo_pattern_add_color_stop_rgb() or
364 	 * cairo_pattern_add_color_stop_rgba().
365 	 * Note: The coordinates here are in pattern space. For a new pattern,
366 	 * pattern space is identical to user space, but the relationship
367 	 * between the spaces can be changed with cairo_pattern_set_matrix().
368 	 * Since 1.0
369 	 * Params:
370 	 * cx0 = x coordinate for the center of the start circle
371 	 * cy0 = y coordinate for the center of the start circle
372 	 * radius0 = radius of the start circle
373 	 * cx1 = x coordinate for the center of the end circle
374 	 * cy1 = y coordinate for the center of the end circle
375 	 * radius1 = radius of the end circle
376 	 * Returns: the newly created cairo_pattern_t if successful, or an error pattern in case of no memory. The caller owns the returned object and should call cairo_pattern_destroy() when finished with it. This function will always return a valid pointer, but if an error occurred the pattern status will be set to an error. To inspect the status of a pattern use cairo_pattern_status().
377 	 */
378 	public static Pattern createRadial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
379 	{
380 		// cairo_pattern_t * cairo_pattern_create_radial (double cx0,  double cy0,  double radius0,  double cx1,  double cy1,  double radius1);
381 		auto p = cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1);
382 		
383 		if(p is null)
384 		{
385 			return null;
386 		}
387 		
388 		return new Pattern(cast(cairo_pattern_t*) p);
389 	}
390 	
391 	/**
392 	 * Gets the gradient endpoint circles for a radial gradient, each
393 	 * specified as a center coordinate and a radius.
394 	 * Since 1.4
395 	 * Params:
396 	 * x0 = return value for the x coordinate of the center of the first circle, or NULL
397 	 * y0 = return value for the y coordinate of the center of the first circle, or NULL
398 	 * r0 = return value for the radius of the first circle, or NULL
399 	 * x1 = return value for the x coordinate of the center of the second circle, or NULL
400 	 * y1 = return value for the y coordinate of the center of the second circle, or NULL
401 	 * r1 = return value for the radius of the second circle, or NULL
402 	 * Returns: CAIRO_STATUS_SUCCESS, or CAIRO_STATUS_PATTERN_TYPE_MISMATCH if pattern is not a radial gradient pattern.
403 	 */
404 	public cairo_status_t getRadialCircles(out double x0, out double y0, out double r0, out double x1, out double y1, out double r1)
405 	{
406 		// cairo_status_t cairo_pattern_get_radial_circles (cairo_pattern_t *pattern,  double *x0,  double *y0,  double *r0,  double *x1,  double *y1,  double *r1);
407 		return cairo_pattern_get_radial_circles(cairo_pattern, &x0, &y0, &r0, &x1, &y1, &r1);
408 	}
409 	
410 	/**
411 	 * Increases the reference count on pattern by one. This prevents
412 	 * pattern from being destroyed until a matching call to
413 	 * cairo_pattern_destroy() is made.
414 	 * The number of references to a cairo_pattern_t can be get using
415 	 * cairo_pattern_get_reference_count().
416 	 * Since 1.0
417 	 * Returns: the referenced cairo_pattern_t.
418 	 */
419 	public Pattern reference()
420 	{
421 		// cairo_pattern_t * cairo_pattern_reference (cairo_pattern_t *pattern);
422 		auto p = cairo_pattern_reference(cairo_pattern);
423 		
424 		if(p is null)
425 		{
426 			return null;
427 		}
428 		
429 		return new Pattern(cast(cairo_pattern_t*) p);
430 	}
431 	
432 	/**
433 	 * Decreases the reference count on pattern by one. If the result is
434 	 * zero, then pattern and all associated resources are freed. See
435 	 * cairo_pattern_reference().
436 	 * Since 1.0
437 	 */
438 	public void destroy()
439 	{
440 		// void cairo_pattern_destroy (cairo_pattern_t *pattern);
441 		cairo_pattern_destroy(cairo_pattern);
442 	}
443 	
444 	/**
445 	 * Checks whether an error has previously occurred for this
446 	 * pattern.
447 	 * Since 1.0
448 	 * Returns: CAIRO_STATUS_SUCCESS, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_INVALID_MATRIX, CAIRO_STATUS_PATTERN_TYPE_MISMATCH, or CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
449 	 */
450 	public cairo_status_t status()
451 	{
452 		// cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern);
453 		return cairo_pattern_status(cairo_pattern);
454 	}
455 	
456 	/**
457 	 * Sets the mode to be used for drawing outside the area of a pattern.
458 	 * See cairo_extend_t for details on the semantics of each extend
459 	 * strategy.
460 	 * The default extend mode is CAIRO_EXTEND_NONE for surface patterns
461 	 * and CAIRO_EXTEND_PAD for gradient patterns.
462 	 * Since 1.0
463 	 * Params:
464 	 * extend = a cairo_extend_t describing how the area outside of the
465 	 * pattern will be drawn
466 	 */
467 	public void setExtend(cairo_extend_t extend)
468 	{
469 		// void cairo_pattern_set_extend (cairo_pattern_t *pattern,  cairo_extend_t extend);
470 		cairo_pattern_set_extend(cairo_pattern, extend);
471 	}
472 	
473 	/**
474 	 * Gets the current extend mode for a pattern. See cairo_extend_t
475 	 * for details on the semantics of each extend strategy.
476 	 * Since 1.0
477 	 * Returns: the current extend strategy used for drawing the pattern.
478 	 */
479 	public cairo_extend_t getExtend()
480 	{
481 		// cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t *pattern);
482 		return cairo_pattern_get_extend(cairo_pattern);
483 	}
484 	
485 	/**
486 	 * Sets the filter to be used for resizing when using this pattern.
487 	 * See cairo_filter_t for details on each filter.
488 	 * * Note that you might want to control filtering even when you do not
489 	 * have an explicit cairo_pattern_t object, (for example when using
490 	 * cairo_set_source_surface()). In these cases, it is convenient to
491 	 * use cairo_get_source() to get access to the pattern that cairo
492 	 * Since 1.0
493 	 * Params:
494 	 * filter = a cairo_filter_t describing the filter to use for resizing
495 	 * the pattern
496 	 */
497 	public void setFilter(cairo_filter_t filter)
498 	{
499 		// void cairo_pattern_set_filter (cairo_pattern_t *pattern,  cairo_filter_t filter);
500 		cairo_pattern_set_filter(cairo_pattern, filter);
501 	}
502 	
503 	/**
504 	 * Gets the current filter for a pattern. See cairo_filter_t
505 	 * for details on each filter.
506 	 * Since 1.0
507 	 * Returns: the current filter used for resizing the pattern.
508 	 */
509 	public cairo_filter_t getFilter()
510 	{
511 		// cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t *pattern);
512 		return cairo_pattern_get_filter(cairo_pattern);
513 	}
514 	
515 	/**
516 	 * Sets the pattern's transformation matrix to matrix. This matrix is
517 	 * a transformation from user space to pattern space.
518 	 * When a pattern is first created it always has the identity matrix
519 	 * for its transformation matrix, which means that pattern space is
520 	 * initially identical to user space.
521 	 * Important: Please note that the direction of this transformation
522 	 * matrix is from user space to pattern space. This means that if you
523 	 * imagine the flow from a pattern to user space (and on to device
524 	 * space), then coordinates in that flow will be transformed by the
525 	 * inverse of the pattern matrix.
526 	 * For example, if you want to make a pattern appear twice as large as
527 	 * Since 1.0
528 	 * Params:
529 	 * matrix = a cairo_matrix_t
530 	 */
531 	public void setMatrix(Matrix matrix)
532 	{
533 		// void cairo_pattern_set_matrix (cairo_pattern_t *pattern,  const cairo_matrix_t *matrix);
534 		cairo_pattern_set_matrix(cairo_pattern, (matrix is null) ? null : matrix.getMatrixStruct());
535 	}
536 	
537 	/**
538 	 * Stores the pattern's transformation matrix into matrix.
539 	 * Since 1.0
540 	 * Params:
541 	 * matrix = return value for the matrix
542 	 */
543 	public void getMatrix(Matrix matrix)
544 	{
545 		// void cairo_pattern_get_matrix (cairo_pattern_t *pattern,  cairo_matrix_t *matrix);
546 		cairo_pattern_get_matrix(cairo_pattern, (matrix is null) ? null : matrix.getMatrixStruct());
547 	}
548 	
549 	/**
550 	 * This function returns the type a pattern.
551 	 * See cairo_pattern_type_t for available types.
552 	 * Since 1.2
553 	 * Params:
554 	 * pattern = a cairo_pattern_t
555 	 * Returns: The type of pattern.
556 	 */
557 	public cairo_pattern_type_t getType()
558 	{
559 		// cairo_pattern_type_t cairo_pattern_get_type (cairo_pattern_t *pattern);
560 		return cairo_pattern_get_type(cairo_pattern);
561 	}
562 	
563 	/**
564 	 * Returns the current reference count of pattern.
565 	 * Since 1.4
566 	 * Returns: the current reference count of pattern. If the object is a nil object, 0 will be returned.
567 	 */
568 	public uint getReferenceCount()
569 	{
570 		// unsigned int cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
571 		return cairo_pattern_get_reference_count(cairo_pattern);
572 	}
573 	
574 	/**
575 	 * Attach user data to pattern. To remove user data from a surface,
576 	 * call this function with the key that was used to set it and NULL
577 	 * for data.
578 	 * Since 1.4
579 	 * Params:
580 	 * key = the address of a cairo_user_data_key_t to attach the user data to
581 	 * userData = the user data to attach to the cairo_pattern_t
582 	 * destroy = a cairo_destroy_func_t which will be called when the
583 	 * cairo_t is destroyed or when new user data is attached using the
584 	 * same key.
585 	 * Returns: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data.
586 	 */
587 	public cairo_status_t setUserData(cairo_user_data_key_t* key, void* userData, cairo_destroy_func_t destroy)
588 	{
589 		// cairo_status_t cairo_pattern_set_user_data (cairo_pattern_t *pattern,  const cairo_user_data_key_t *key,  void *user_data,  cairo_destroy_func_t destroy);
590 		return cairo_pattern_set_user_data(cairo_pattern, key, userData, destroy);
591 	}
592 	
593 	/**
594 	 * Return user data previously attached to pattern using the
595 	 * specified key. If no user data has been attached with the given
596 	 * key this function returns NULL.
597 	 * Since 1.4
598 	 * Params:
599 	 * key = the address of the cairo_user_data_key_t the user data was
600 	 * attached to
601 	 * Returns: the user data previously attached or NULL.
602 	 */
603 	public void* getUserData(cairo_user_data_key_t* key)
604 	{
605 		// void * cairo_pattern_get_user_data (cairo_pattern_t *pattern,  const cairo_user_data_key_t *key);
606 		return cairo_pattern_get_user_data(cairo_pattern, key);
607 	}
608 }