2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 = gdk-Graphics-Contexts.html
54 * - GdkBitmap* -> Bitmap
55 * - GdkColor* -> Color
56 * - GdkColormap* -> Colormap
57 * - GdkDrawable* -> Drawable
60 * - GdkPixmap* -> Pixmap
61 * - GdkRegion* -> Region
62 * - GdkScreen* -> Screen
68 private import gdk
.gdktypes
;
70 private import lib
.gdk
;
72 private import gdk
.Drawable
;
73 private import gdk
.Screen
;
74 private import gdk
.GC
;
75 private import gdk
.Color
;
76 private import gdk
.Font
;
77 private import gdk
.Pixmap
;
78 private import gdk
.Bitmap
;
79 private import gdk
.Region
;
80 private import gdk
.Colormap
;
84 * All drawing operations in GDK take a
85 * graphics context (GC) argument.
86 * A graphics context encapsulates information about
87 * the way things are drawn, such as the foreground
88 * color or line width. By using graphics contexts,
89 * the number of arguments to each drawing call is
90 * greatly reduced, and communication overhead is
91 * minimized, since identical arguments do not need
92 * to be passed repeatedly.
93 * Most values of a graphics context can be set at
94 * creation time by using gdk_gc_new_with_values(),
95 * or can be set one-by-one using functions such
96 * as gdk_gc_set_foreground(). A few of the values
97 * in the GC, such as the dash pattern, can only
98 * be set by the latter method.
100 private import gobject
.ObjectG
;
101 public class GC
: ObjectG
104 /** the main Gtk struct */
105 protected GdkGC
* gdkGC
;
108 public GdkGC
* getGCStruct()
114 /** the main Gtk struct as a void* */
115 protected void* getStruct()
117 return cast(void*)gdkGC
;
121 * Sets our main struct and passes it to the parent class
123 public this (GdkGC
* gdkGC
)
125 super(cast(GObject
*)gdkGC
);
137 * Create a new graphics context with default values.
139 * a GdkDrawable. The created GC must always be used
140 * with drawables of the same depth as this one.
142 * the new graphics context.
144 public this (Drawable drawable
)
146 // GdkGC* gdk_gc_new (GdkDrawable *drawable);
147 this(cast(GdkGC
*)gdk_gc_new((drawable
is null) ?
null : drawable
.getDrawableStruct()) );
151 * Create a new GC with the given initial values.
153 * a GdkDrawable. The created GC must always be used
154 * with drawables of the same depth as this one.
156 * a structure containing initial values for the GC.
158 * a bit mask indicating which fields in values
161 * the new graphics context.
163 public this (Drawable drawable
, GdkGCValues
* values
, GdkGCValuesMask valuesMask
)
165 // GdkGC* gdk_gc_new_with_values (GdkDrawable *drawable, GdkGCValues *values, GdkGCValuesMask values_mask);
166 this(cast(GdkGC
*)gdk_gc_new_with_values((drawable
is null) ?
null : drawable
.getDrawableStruct(), values
, valuesMask
) );
170 * Gets the GdkScreen for which gc was created
174 * the GdkScreen for gc.
177 public Screen
getScreen()
179 // GdkScreen* gdk_gc_get_screen (GdkGC *gc);
180 return new Screen( gdk_gc_get_screen(gdkGC
) );
185 * gdk_gc_ref is deprecated and should not be used in newly-written code.
186 * Deprecated function; use g_object_ref() instead.
194 // GdkGC* gdk_gc_ref (GdkGC *gc);
195 return new GC( gdk_gc_ref(gdkGC
) );
200 * gdk_gc_unref is deprecated and should not be used in newly-written code. Use g_object_unref() instead.
201 * Decrement the reference count of gc.
207 // void gdk_gc_unref (GdkGC *gc);
213 * Sets attributes of a graphics context in bulk. For each flag set in
214 * values_mask, the corresponding field will be read from values and
215 * set as the new value for gc. If you're only setting a few values
216 * on gc, calling individual "setter" functions is likely more
221 * struct containing the new values
223 * mask indicating which struct fields are to be used
225 public void setValues(GdkGCValues
* values
, GdkGCValuesMask valuesMask
)
227 // void gdk_gc_set_values (GdkGC *gc, GdkGCValues *values, GdkGCValuesMask values_mask);
228 gdk_gc_set_values(gdkGC
, values
, valuesMask
);
232 * Retrieves the current values from a graphics context. Note that
233 * only the pixel values of the values->foreground and values->background
234 * are filled, use gdk_colormap_query_color() to obtain the rgb values
239 * the GdkGCValues structure in which to store the results.
241 public void getValues(GdkGCValues
* values
)
243 // void gdk_gc_get_values (GdkGC *gc, GdkGCValues *values);
244 gdk_gc_get_values(gdkGC
, values
);
248 * Sets the foreground color for a graphics context.
249 * Note that this function uses color->pixel, use
250 * gdk_gc_set_rgb_fg_color() to specify the foreground
251 * color as red, green, blue components.
255 * the new foreground color.
257 public void setForeground(Color color
)
259 // void gdk_gc_set_foreground (GdkGC *gc, const GdkColor *color);
260 gdk_gc_set_foreground(gdkGC
, (color
is null) ?
null : color
.getColorStruct());
264 * Sets the background color for a graphics context.
265 * Note that this function uses color->pixel, use
266 * gdk_gc_set_rgb_bg_color() to specify the background
267 * color as red, green, blue components.
271 * the new background color.
273 public void setBackground(Color color
)
275 // void gdk_gc_set_background (GdkGC *gc, const GdkColor *color);
276 gdk_gc_set_background(gdkGC
, (color
is null) ?
null : color
.getColorStruct());
280 * Set the foreground color of a GC using an unallocated color. The
281 * pixel value for the color will be determined using GdkRGB. If the
282 * colormap for the GC has not previously been initialized for GdkRGB,
283 * then for pseudo-color colormaps (colormaps with a small modifiable
284 * number of colors), a colorcube will be allocated in the colormap.
285 * Calling this function for a GC without a colormap is an error.
289 * an unallocated GdkColor.
291 public void setRgbFgColor(Color color
)
293 // void gdk_gc_set_rgb_fg_color (GdkGC *gc, const GdkColor *color);
294 gdk_gc_set_rgb_fg_color(gdkGC
, (color
is null) ?
null : color
.getColorStruct());
298 * Set the background color of a GC using an unallocated color. The
299 * pixel value for the color will be determined using GdkRGB. If the
300 * colormap for the GC has not previously been initialized for GdkRGB,
301 * then for pseudo-color colormaps (colormaps with a small modifiable
302 * number of colors), a colorcube will be allocated in the colormap.
303 * Calling this function for a GC without a colormap is an error.
307 * an unallocated GdkColor.
309 public void setRgbBgColor(Color color
)
311 // void gdk_gc_set_rgb_bg_color (GdkGC *gc, const GdkColor *color);
312 gdk_gc_set_rgb_bg_color(gdkGC
, (color
is null) ?
null : color
.getColorStruct());
317 * gdk_gc_set_font is deprecated and should not be used in newly-written code.
318 * Sets the font for a graphics context. (Note that
319 * all text-drawing functions in GDK take a font
320 * argument; the value set here is used when that
327 public void setFont(Font font
)
329 // void gdk_gc_set_font (GdkGC *gc, GdkFont *font);
330 gdk_gc_set_font(gdkGC
, (font
is null) ?
null : font
.getFontStruct());
334 * Determines how the current pixel values and the
335 * pixel values being drawn are combined to produce
336 * the final pixel values.
340 * the GdkFunction to use
342 public void setFunction(GdkFunction funct
)
344 // void gdk_gc_set_function (GdkGC *gc, GdkFunction function);
345 gdk_gc_set_function(gdkGC
, funct
);
349 * Set the fill mode for a graphics context.
355 public void setFill(GdkFill fill
)
357 // void gdk_gc_set_fill (GdkGC *gc, GdkFill fill);
358 gdk_gc_set_fill(gdkGC
, fill
);
363 * Set a tile pixmap for a graphics context.
364 * This will only be used if the fill mode
369 * the new tile pixmap.
371 public void setTile(Pixmap tile
)
373 // void gdk_gc_set_tile (GdkGC *gc, GdkPixmap *tile);
374 gdk_gc_set_tile(gdkGC
, (tile
is null) ?
null : tile
.getPixmapStruct());
378 * Set the stipple bitmap for a graphics context. The
379 * stipple will only be used if the fill mode is
380 * GDK_STIPPLED or GDK_OPAQUE_STIPPLED.
384 * the new stipple bitmap.
386 public void setStipple(Pixmap stipple
)
388 // void gdk_gc_set_stipple (GdkGC *gc, GdkPixmap *stipple);
389 gdk_gc_set_stipple(gdkGC
, (stipple
is null) ?
null : stipple
.getPixmapStruct());
393 * Set the origin when using tiles or stipples with
394 * the GC. The tile or stipple will be aligned such
395 * that the upper left corner of the tile or stipple
396 * will coincide with this point.
400 * the x-coordinate of the origin.
402 * the y-coordinate of the origin.
404 public void setTsOrigin(int x
, int y
)
406 // void gdk_gc_set_ts_origin (GdkGC *gc, gint x, gint y);
407 gdk_gc_set_ts_origin(gdkGC
, x
, y
);
411 * Sets the origin of the clip mask. The coordinates are
412 * interpreted relative to the upper-left corner of
413 * the destination drawable of the current operation.
417 * the x-coordinate of the origin.
419 * the y-coordinate of the origin.
421 public void setClipOrigin(int x
, int y
)
423 // void gdk_gc_set_clip_origin (GdkGC *gc, gint x, gint y);
424 gdk_gc_set_clip_origin(gdkGC
, x
, y
);
428 * Sets the clip mask for a graphics context from a bitmap.
429 * The clip mask is interpreted relative to the clip
430 * origin. (See gdk_gc_set_clip_origin()).
436 public void setClipMask(Bitmap mask
)
438 // void gdk_gc_set_clip_mask (GdkGC *gc, GdkBitmap *mask);
439 gdk_gc_set_clip_mask(gdkGC
, (mask
is null) ?
null : mask
.getBitmapStruct());
443 * Sets the clip mask for a graphics context from a
444 * rectangle. The clip mask is interpreted relative to the clip
445 * origin. (See gdk_gc_set_clip_origin()).
449 * the rectangle to clip to.
451 public void setClipRectangle(GdkRectangle
* rectangle
)
453 // void gdk_gc_set_clip_rectangle (GdkGC *gc, GdkRectangle *rectangle);
454 gdk_gc_set_clip_rectangle(gdkGC
, rectangle
);
458 * Sets the clip mask for a graphics context from a region structure.
459 * The clip mask is interpreted relative to the clip origin. (See
460 * gdk_gc_set_clip_origin()).
466 public void setClipRegion(Region region
)
468 // void gdk_gc_set_clip_region (GdkGC *gc, GdkRegion *region);
469 gdk_gc_set_clip_region(gdkGC
, (region
is null) ?
null : region
.getRegionStruct());
473 * Sets how drawing with this GC on a window will affect child
474 * windows of that window.
478 * the subwindow mode.
480 public void setSubwindow(GdkSubwindowMode mode
)
482 // void gdk_gc_set_subwindow (GdkGC *gc, GdkSubwindowMode mode);
483 gdk_gc_set_subwindow(gdkGC
, mode
);
488 * Sets whether copying non-visible portions of a drawable
489 * using this graphics context generate exposure events
490 * for the corresponding regions of the destination
491 * drawable. (See gdk_draw_drawable()).
495 * if TRUE, exposure events will be generated.
497 public void setExposures(int exposures
)
499 // void gdk_gc_set_exposures (GdkGC *gc, gboolean exposures);
500 gdk_gc_set_exposures(gdkGC
, exposures
);
504 * Sets various attributes of how lines are drawn. See
505 * the corresponding members of GdkGCValues for full
506 * explanations of the arguments.
510 * the width of lines.
512 * the dash-style for lines.
514 * the manner in which the ends of lines are drawn.
516 * the in which lines are joined together.
518 public void setLineAttributes(int lineWidth
, GdkLineStyle lineStyle
, GdkCapStyle capStyle
, GdkJoinStyle joinStyle
)
520 // void gdk_gc_set_line_attributes (GdkGC *gc, gint line_width, GdkLineStyle line_style, GdkCapStyle cap_style, GdkJoinStyle join_style);
521 gdk_gc_set_line_attributes(gdkGC
, lineWidth
, lineStyle
, capStyle
, joinStyle
);
528 * Sets the way dashed-lines are drawn. Lines will be
529 * drawn with alternating on and off segments of the
530 * lengths specified in dash_list. The manner in
531 * which the on and off segments are drawn is determined
532 * by the line_style value of the GC. (This can
533 * be changed with gdk_gc_set_line_attributes().)
534 * The dash_offset defines the phase of the pattern,
535 * specifying how many pixels into the dash-list the pattern
536 * should actually begin.
540 * the phase of the dash pattern.
542 * an array of dash lengths.
544 * the number of elements in dash_list.
546 public void setDashes(int dashOffset
, byte[] dashList
, int n
)
548 // void gdk_gc_set_dashes (GdkGC *gc, gint dash_offset, gint8 dash_list[], gint n);
549 gdk_gc_set_dashes(gdkGC
, dashOffset
, dashList
, n
);
553 * Copy the set of values from one graphics context
554 * onto another graphics context.
556 * the destination graphics context.
558 * the source graphics context.
560 public void copy(GC srcGc
)
562 // void gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc);
563 gdk_gc_copy(gdkGC
, (srcGc
is null) ?
null : srcGc
.getGCStruct());
567 * Sets the colormap for the GC to the given colormap. The depth
568 * of the colormap's visual must match the depth of the drawable
569 * for which the GC was created.
575 public void setColormap(Colormap colormap
)
577 // void gdk_gc_set_colormap (GdkGC *gc, GdkColormap *colormap);
578 gdk_gc_set_colormap(gdkGC
, (colormap
is null) ?
null : colormap
.getColormapStruct());
582 * Retrieves the colormap for a given GC, if it exists.
583 * A GC will have a colormap if the drawable for which it was created
584 * has a colormap, or if a colormap was set explicitely with
585 * gdk_gc_set_colormap.
589 * the colormap of gc, or NULL if gc doesn't have one.
591 public Colormap
getColormap()
593 // GdkColormap* gdk_gc_get_colormap (GdkGC *gc);
594 return new Colormap( gdk_gc_get_colormap(gdkGC
) );
598 * Offset attributes such as the clip and tile-stipple origins
599 * of the GC so that drawing at x - x_offset, y - y_offset with
600 * the offset GC has the same effect as drawing at x, y with the original
605 * amount by which to offset the GC in the X direction
607 * amount by which to offset the GC in the Y direction
609 public void offset(int xOffset
, int yOffset
)
611 // void gdk_gc_offset (GdkGC *gc, gint x_offset, gint y_offset);
612 gdk_gc_offset(gdkGC
, xOffset
, yOffset
);