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