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