2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = cairo-Patterns.html
28 * strct = cairo_pattern_t
49 module cairoLib
.Pattern
;
55 import tango
.io
.Stdout
; // use the tango loging?
59 private import gtkc
.cairoLibtypes
;
61 private import gtkc
.cairoLib
;
74 /** the main Gtk struct */
75 protected cairo_pattern_t
* cairo_pattern
;
78 public cairo_pattern_t
* getPatternStruct()
84 /** the main Gtk struct as a void* */
85 protected void* getStruct()
87 return cast(void*)cairo_pattern
;
91 * Sets our main struct and passes it to the parent class
93 public this (cairo_pattern_t
* cairo_pattern
)
97 if ( cairo_pattern
is null )
102 Stdout("struct cairo_pattern is null on constructor").newline
;
106 printf("struct cairo_pattern is null on constructor");
113 assert(cairo_pattern
!is null, "struct cairo_pattern is null on constructor");
115 this.cairo_pattern
= cairo_pattern
;
123 * Adds an opaque color stop to a gradient pattern. The offset
124 * specifies the location along the gradient's control vector. For
125 * example, a linear gradient's control vector is from (x0,y0) to
126 * (x1,y1) while a radial gradient's control vector is from any point
127 * on the start circle to the corresponding point on the end circle.
128 * The color is specified in the same way as in cairo_set_source_rgb().
129 * Note: If the pattern is not a gradient pattern, (eg. a linear or
130 * radial pattern), then the pattern will be put into an error status
131 * with a status of CAIRO_STATUS_PATTERN_TYPE_MISMATCH.
135 * an offset in the range [0.0 .. 1.0]
137 * red component of color
139 * green component of color
141 * blue component of color
143 public void addColorStopRgb(double offset
, double red
, double green
, double blue
)
145 // void cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, double offset, double red, double green, double blue);
146 cairo_pattern_add_color_stop_rgb(cairo_pattern
, offset
, red
, green
, blue
);
150 * Adds a translucent color stop to a gradient pattern. The offset
151 * specifies the location along the gradient's control vector. For
152 * example, a linear gradient's control vector is from (x0,y0) to
153 * (x1,y1) while a radial gradient's control vector is from any point
154 * on the start circle to the corresponding point on the end circle.
155 * The color is specified in the same way as in cairo_set_source_rgba().
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.
162 * an offset in the range [0.0 .. 1.0]
164 * red component of color
166 * green component of color
168 * blue component of color
170 * alpha component of color
172 public void addColorStopRgba(double offset
, double red
, double green
, double blue
, double alpha
)
174 // void cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern, double offset, double red, double green, double blue, double alpha);
175 cairo_pattern_add_color_stop_rgba(cairo_pattern
, offset
, red
, green
, blue
, alpha
);
179 * Creates a new cairo_pattern_t corresponding to an opaque color. The
180 * color components are floating point numbers in the range 0 to 1.
181 * If the values passed in are outside that range, they will be
184 * red component of the color
186 * green component of the color
188 * blue component of the color
190 * the newly created cairo_pattern_t if succesful, or
191 * an error pattern in case of no memory. The caller owns the
192 * returned object and should call cairo_pattern_destroy() when
194 * This function will always return a valid pointer, but if an error
195 * occurred the pattern status will be set to an error. To inspect
196 * the status of a pattern use cairo_pattern_status().
198 public static cairo_pattern_t
* createRgb(double red
, double green
, double blue
)
200 // cairo_pattern_t* cairo_pattern_create_rgb (double red, double green, double blue);
201 return cairo_pattern_create_rgb(red
, green
, blue
);
205 * Creates a new cairo_pattern_t corresponding to a translucent color.
206 * The color components are floating point numbers in the range 0 to
207 * 1. If the values passed in are outside that range, they will be
210 * red component of the color
212 * green component of the color
214 * blue component of the color
216 * alpha component of the color
218 * the newly created cairo_pattern_t if succesful, or
219 * an error pattern in case of no memory. The caller owns the
220 * returned object and should call cairo_pattern_destroy() when
222 * This function will always return a valid pointer, but if an error
223 * occurred the pattern status will be set to an error. To inspect
224 * the status of a pattern use cairo_pattern_status().
226 public static cairo_pattern_t
* createRgba(double red
, double green
, double blue
, double alpha
)
228 // cairo_pattern_t* cairo_pattern_create_rgba (double red, double green, double blue, double alpha);
229 return cairo_pattern_create_rgba(red
, green
, blue
, alpha
);
233 * Create a new cairo_pattern_t for the given surface.
237 * the newly created cairo_pattern_t if succesful, or
238 * an error pattern in case of no memory. The caller owns the
239 * returned object and should call cairo_pattern_destroy() when
241 * This function will always return a valid pointer, but if an error
242 * occurred the pattern status will be set to an error. To inspect
243 * the status of a pattern use cairo_pattern_status().
245 public static cairo_pattern_t
* createForSurface(cairo_surface_t
* surface
)
247 // cairo_pattern_t* cairo_pattern_create_for_surface (cairo_surface_t *surface);
248 return cairo_pattern_create_for_surface(surface
);
252 * Create a new linear gradient cairo_pattern_t along the line defined
253 * by (x0, y0) and (x1, y1). Before using the gradient pattern, a
254 * number of color stops should be defined using
255 * cairo_pattern_add_color_stop_rgb() or
256 * cairo_pattern_add_color_stop_rgba().
257 * Note: The coordinates here are in pattern space. For a new pattern,
258 * pattern space is identical to user space, but the relationship
259 * between the spaces can be changed with cairo_pattern_set_matrix().
261 * x coordinate of the start point
263 * y coordinate of the start point
265 * x coordinate of the end point
267 * y coordinate of the end point
269 * the newly created cairo_pattern_t if succesful, or
270 * an error pattern in case of no memory. The caller owns the
271 * returned object and should call cairo_pattern_destroy() when
273 * This function will always return a valid pointer, but if an error
274 * occurred the pattern status will be set to an error. To inspect
275 * the status of a pattern use cairo_pattern_status().
277 public static cairo_pattern_t
* createLinear(double x0
, double y0
, double x1
, double y1
)
279 // cairo_pattern_t* cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
280 return cairo_pattern_create_linear(x0
, y0
, x1
, y1
);
284 * Creates a new radial gradient cairo_pattern_t between the two
285 * circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the
286 * gradient pattern, a number of color stops should be defined using
287 * cairo_pattern_add_color_stop_rgb() or
288 * cairo_pattern_add_color_stop_rgba().
289 * Note: The coordinates here are in pattern space. For a new pattern,
290 * pattern space is identical to user space, but the relationship
291 * between the spaces can be changed with cairo_pattern_set_matrix().
293 * x coordinate for the center of the start circle
295 * y coordinate for the center of the start circle
297 * radius of the start cirle
299 * x coordinate for the center of the end circle
301 * y coordinate for the center of the end circle
303 * radius of the end cirle
305 * the newly created cairo_pattern_t if succesful, or
306 * an error pattern in case of no memory. The caller owns the
307 * returned object and should call cairo_pattern_destroy() when
309 * This function will always return a valid pointer, but if an error
310 * occurred the pattern status will be set to an error. To inspect
311 * the status of a pattern use cairo_pattern_status().
313 public static cairo_pattern_t
* createRadial(double cx0
, double cy0
, double radius0
, double cx1
, double cy1
, double radius1
)
315 // cairo_pattern_t* cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
316 return cairo_pattern_create_radial(cx0
, cy0
, radius0
, cx1
, cy1
, radius1
);
320 * Decreases the reference count on pattern by one. If the result is
321 * zero, then pattern and all associated resources are freed. See
322 * cairo_pattern_reference().
326 public void destroy()
328 // void cairo_pattern_destroy (cairo_pattern_t *pattern);
329 cairo_pattern_destroy(cairo_pattern
);
333 * Increases the reference count on pattern by one. This prevents
334 * pattern from being destroyed until a matching call to
335 * cairo_pattern_destroy() is made.
339 * the referenced cairo_pattern_t.
341 public cairo_pattern_t
* reference()
343 // cairo_pattern_t* cairo_pattern_reference (cairo_pattern_t *pattern);
344 return cairo_pattern_reference(cairo_pattern
);
348 * Checks whether an error has previously occurred for this
353 * CAIRO_STATUS_SUCCESS, CAIRO_STATUS_NO_MEMORY, or
354 * CAIRO_STATUS_PATTERN_TYPE_MISMATCH.
356 public cairo_status_t
status()
358 // cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern);
359 return cairo_pattern_status(cairo_pattern
);
364 * Sets the mode to be used for drawing outside the area of a pattern.
365 * See cairo_extend_t for details on the semantics of each extend
370 * a cairo_extend_t describing how the area outside of the
371 * pattern will be drawn
373 public void setExtend(cairo_extend_t extend
)
375 // void cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
376 cairo_pattern_set_extend(cairo_pattern
, extend
);
380 * Gets the current extend mode for a pattern. See cairo_extend_t
381 * for details on the semantics of each extend strategy.
385 * the current extend strategy used for drawing the
388 public cairo_extend_t
getExtend()
390 // cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t *pattern);
391 return cairo_pattern_get_extend(cairo_pattern
);
399 public void setFilter(cairo_filter_t filter
)
401 // void cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
402 cairo_pattern_set_filter(cairo_pattern
, filter
);
409 public cairo_filter_t
getFilter()
411 // cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t *pattern);
412 return cairo_pattern_get_filter(cairo_pattern
);
416 * Sets the pattern's transformation matrix to matrix. This matrix is
417 * a transformation from user space to pattern space.
418 * When a pattern is first created it always has the identity matrix
419 * for its transformation matrix, which means that pattern space is
420 * initially identical to user space.
421 * Important: Please note that the direction of this transformation
422 * matrix is from user space to pattern space. This means that if you
423 * imagine the flow from a pattern to user space (and on to device
424 * space), then coordinates in that flow will be transformed by the
425 * inverse of the pattern matrix.
426 * For example, if you want to make a pattern appear twice as large as
427 * it does by default the correct code to use is:
428 * cairo_matrix_init_scale (matrix, 0.5, 0.5);
429 * cairo_pattern_set_matrix (pattern, matrix);
430 * Meanwhile, using values of 2.0 rather than 0.5 in the code above
431 * would cause the pattern to appear at half of its default size.
432 * Also, please note the discussion of the user-space locking
433 * semantics of cairo_set_source().
439 public void setMatrix(cairo_matrix_t
* matrix
)
441 // void cairo_pattern_set_matrix (cairo_pattern_t *pattern, const cairo_matrix_t *matrix);
442 cairo_pattern_set_matrix(cairo_pattern
, matrix
);
446 * Stores the pattern's transformation matrix into matrix.
450 * return value for the matrix
452 public void getMatrix(cairo_matrix_t
* matrix
)
454 // void cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
455 cairo_pattern_get_matrix(cairo_pattern
, matrix
);
460 * This function returns the type a pattern.
461 * See cairo_pattern_type_t for available types.
465 * The type of pattern.
468 public cairo_pattern_type_t
getType()
470 // cairo_pattern_type_t cairo_pattern_get_type (cairo_pattern_t *pattern);
471 return cairo_pattern_get_type(cairo_pattern
);