I've no idea here...
[gtkD.git] / src / gdk / Drawable.d
blobdf812cf911d159c83410a803e7d57ab45b08f474
1 /*
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-Drawing-Primitives.html
26 * outPack = gdk
27 * outFile = Drawable
28 * strct = GdkDrawable
29 * realStrct=
30 * ctorStrct=
31 * clss = Drawable
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_drawble_
40 * - gdk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Drawable
47 * - gdk.Display
48 * - gdk.Screen
49 * - gdk.Visual
50 * - gdk.Colormap
51 * - gdk.Region
52 * - gdk.GC
53 * - gdk.Pixbuf
54 * - gdk.Color
55 * - gdk.Font
56 * - gdk.ImageGdk
57 * - pango.PgContext
58 * - pango.PgItem
59 * - pango.PgLayout
60 * - pango.PgFontDescription
61 * - pango.PgFontMetrics
62 * - pango.PgFontFamily
63 * - pango.PgFontFace
64 * - pango.PgFontMap
65 * - pango.PgFontsetSimple
66 * - pango.PgAttribute
67 * - pango.PgAttributeList
68 * - pango.PgLanguage
69 * - pango.PgTabArray
70 * - pango.PgLayout
71 * - pango.PgLayoutIter
72 * - pango.PgScriptIter
73 * structWrap:
74 * - GdkColor* -> Color
75 * - GdkColormap* -> Colormap
76 * - GdkDisplay* -> Display
77 * - GdkDrawable* -> Drawable
78 * - GdkFont* -> Font
79 * - GdkGC* -> GC
80 * - GdkImage* -> ImageGdk
81 * - GdkPixbuf* -> Pixbuf
82 * - GdkRegion* -> Region
83 * - GdkScreen* -> Screen
84 * - GdkVisual* -> Visual
85 * - PangoAttribute* -> PgAttribute
86 * - PangoAttributeList* -> PgAttributeList
87 * - PangoContext* -> PgContext
88 * - PangoFontDescription* -> PgFontDescription
89 * - PangoFontFace* -> PgFontFace
90 * - PangoFontFamily* -> PgFontFamily
91 * - PangoFontMap* -> PgFontMap
92 * - PangoFontMetrics* -> PgFontMetrics
93 * - PangoFontsetSimple* -> PgFontsetSimple
94 * - PangoItem* -> PgItem
95 * - PangoLanguage* -> PgLanguage
96 * - PangoLayout* -> PgLayout
97 * - PangoLayoutIter* -> PgLayoutIter
98 * - PangoScriptIter* -> PgScriptIter
99 * - PangoTabArray* -> PgTabArray
100 * local aliases:
103 module gdk.Drawable;
105 private import gdk.gdktypes;
107 private import lib.gdk;
109 private import glib.Str;
110 private import gdk.Drawable;
111 private import gdk.Display;
112 private import gdk.Screen;
113 private import gdk.Visual;
114 private import gdk.Colormap;
115 private import gdk.Region;
116 private import gdk.GC;
117 private import gdk.Pixbuf;
118 private import gdk.Color;
119 private import gdk.Font;
120 private import gdk.ImageGdk;
121 private import pango.PgContext;
122 private import pango.PgItem;
123 private import pango.PgLayout;
124 private import pango.PgFontDescription;
125 private import pango.PgFontMetrics;
126 private import pango.PgFontFamily;
127 private import pango.PgFontFace;
128 private import pango.PgFontMap;
129 private import pango.PgFontsetSimple;
130 private import pango.PgAttribute;
131 private import pango.PgAttributeList;
132 private import pango.PgLanguage;
133 private import pango.PgTabArray;
134 private import pango.PgLayout;
135 private import pango.PgLayoutIter;
136 private import pango.PgScriptIter;
139 * Description
140 * These functions provide support for drawing points, lines, arcs and text
141 * onto what are called 'drawables'. Drawables, as the name suggests, are things
142 * which support drawing onto them, and are either GdkWindow or GdkPixmap
143 * objects.
144 * Many of the drawing operations take a GdkGC argument, which represents a
145 * graphics context. This GdkGC contains a number of drawing attributes such
146 * as foreground color, background color and line width, and is used to reduce
147 * the number of arguments needed for each drawing operation. See the
148 * Graphics Contexts section for
149 * more information.
150 * Some of the drawing operations take Pango data structures like PangoContext,
151 * PangoLayout or PangoLayoutLine as arguments. If you're using GTK+, the ususal
152 * way to obtain these structures is via gtk_widget_create_pango_context() or
153 * gtk_widget_create_pango_layout().
155 private import gobject.ObjectG;
156 public class Drawable : ObjectG
159 /** the main Gtk struct */
160 protected GdkDrawable* gdkDrawable;
163 public GdkDrawable* getDrawableStruct()
165 return gdkDrawable;
169 /** the main Gtk struct as a void* */
170 protected void* getStruct()
172 return cast(void*)gdkDrawable;
176 * Sets our main struct and passes it to the parent class
178 public this (GdkDrawable* gdkDrawable)
180 super(cast(GObject*)gdkDrawable);
181 this.gdkDrawable = gdkDrawable;
185 * Draws an outlined or filled polygon.
186 * drawable:
187 * a GdkDrawable (a GdkWindow or a GdkPixmap).
188 * gc:
189 * a GdkGC.
190 * filled:
191 * TRUE if the polygon should be filled. The polygon is closed
192 * automatically, connecting the last point to the first point if
193 * necessary.
194 * points:
195 * an array of GdkPoint structures specifying the points making
196 * up the polygon.
198 public void drawPolygon(GC gc, int filled, GdkPoint[] points)
200 // void gdk_draw_polygon (GdkDrawable *drawable, GdkGC *gc, gboolean filled, GdkPoint *points, gint npoints);
201 gdk_draw_polygon(gdkDrawable, gc.getGCStruct(), filled, points.ptr, points.length);
209 * Warning
210 * gdk_drawable_ref is deprecated and should not be used in newly-written code.
211 * Deprecated equivalent of calling g_object_ref() on drawable.
212 * (Drawables were not objects in previous versions of GDK.)
213 * drawable:
214 * a GdkDrawable
215 * Returns:
216 * the same drawable passed in
218 public Drawable drawableRef()
220 // GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable);
221 return new Drawable( gdk_drawable_ref(gdkDrawable) );
225 * Warning
226 * gdk_drawable_unref is deprecated and should not be used in newly-written code.
227 * Deprecated equivalent of calling g_object_unref() on drawable.
228 * drawable:
229 * a GdkDrawable
231 public void drawableUnref()
233 // void gdk_drawable_unref (GdkDrawable *drawable);
234 gdk_drawable_unref(gdkDrawable);
238 * Warning
239 * gdk_drawable_set_data is deprecated and should not be used in newly-written code.
240 * This function is equivalent to g_object_set_data(),
241 * the GObject variant should be used instead.
242 * drawable:
243 * a GdkDrawable
244 * key:
245 * name to store the data under
246 * data:
247 * arbitrary data
248 * destroy_func:
249 * function to free data, or NULL
251 public void drawableSetData(char[] key, void* data, GDestroyNotify destroyFunc)
253 // void gdk_drawable_set_data (GdkDrawable *drawable, const gchar *key, gpointer data, GDestroyNotify destroy_func);
254 gdk_drawable_set_data(gdkDrawable, Str.toStringz(key), data, destroyFunc);
258 * Warning
259 * gdk_drawable_get_data is deprecated and should not be used in newly-written code.
260 * Equivalent to g_object_get_data(); the GObject variant should be
261 * used instead.
262 * drawable:
263 * a GdkDrawable
264 * key:
265 * name the data was stored under
266 * Returns:
267 * the data stored at key
269 public void* drawableGetData(char[] key)
271 // gpointer gdk_drawable_get_data (GdkDrawable *drawable, const gchar *key);
272 return gdk_drawable_get_data(gdkDrawable, Str.toStringz(key));
276 * Gets the GdkDisplay associated with a GdkDrawable.
277 * drawable:
278 * a GdkDrawable
279 * Returns:
280 * the GdkDisplay associated with drawable
281 * Since 2.2
283 public Display drawableGetDisplay()
285 // GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
286 return new Display( gdk_drawable_get_display(gdkDrawable) );
290 * Gets the GdkScreen associated with a GdkDrawable.
291 * drawable:
292 * a GdkDrawable
293 * Returns:
294 * the GdkScreen associated with drawable
295 * Since 2.2
297 public Screen drawableGetScreen()
299 // GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
300 return new Screen( gdk_drawable_get_screen(gdkDrawable) );
304 * Gets the GdkVisual describing the pixel format of drawable.
305 * drawable:
306 * a GdkDrawable
307 * Returns:
308 * a GdkVisual
310 public Visual drawableGetVisual()
312 // GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
313 return new Visual( gdk_drawable_get_visual(gdkDrawable) );
317 * Sets the colormap associated with drawable. Normally this will
318 * happen automatically when the drawable is created; you only need to
319 * use this function if the drawable-creating function did not have a
320 * way to determine the colormap, and you then use drawable operations
321 * that require a colormap. The colormap for all drawables and
322 * graphics contexts you intend to use together should match. i.e.
323 * when using a GdkGC to draw to a drawable, or copying one drawable
324 * to another, the colormaps should match.
325 * drawable:
326 * a GdkDrawable
327 * colormap:
328 * a GdkColormap
330 public void drawableSetColormap(Colormap colormap)
332 // void gdk_drawable_set_colormap (GdkDrawable *drawable, GdkColormap *colormap);
333 gdk_drawable_set_colormap(gdkDrawable, (colormap is null) ? null : colormap.getColormapStruct());
337 * Gets the colormap for drawable, if one is set; returns
338 * NULL otherwise.
339 * drawable:
340 * a GdkDrawable
341 * Returns:
342 * the colormap, or NULL
344 public Colormap drawableGetColormap()
346 // GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
347 return new Colormap( gdk_drawable_get_colormap(gdkDrawable) );
351 * Obtains the bit depth of the drawable, that is, the number of bits
352 * that make up a pixel in the drawable's visual. Examples are 8 bits
353 * per pixel, 24 bits per pixel, etc.
354 * drawable:
355 * a GdkDrawable
356 * Returns:
357 * number of bits per pixel
359 public int drawableGetDepth()
361 // gint gdk_drawable_get_depth (GdkDrawable *drawable);
362 return gdk_drawable_get_depth(gdkDrawable);
366 * Fills *width and *height with the size of drawable.
367 * width or height can be NULL if you only want the other one.
368 * On the X11 platform, if drawable is a GdkWindow, the returned
369 * size is the size reported in the most-recently-processed configure
370 * event, rather than the current size on the X server.
371 * drawable:
372 * a GdkDrawable
373 * width:
374 * location to store drawable's width, or NULL
375 * height:
376 * location to store drawable's height, or NULL
378 public void drawableGetSize(int* width, int* height)
380 // void gdk_drawable_get_size (GdkDrawable *drawable, gint *width, gint *height);
381 gdk_drawable_get_size(gdkDrawable, width, height);
385 * Computes the region of a drawable that potentially can be written
386 * to by drawing primitives. This region will not take into account
387 * the clip region for the GC, and may also not take into account
388 * other factors such as if the window is obscured by other windows,
389 * but no area outside of this region will be affected by drawing
390 * primitives.
391 * drawable:
392 * a GdkDrawable
393 * Returns:
394 * a GdkRegion. This must be freed with gdk_region_destroy()
395 * when you are done.
397 public Region drawableGetClipRegion()
399 // GdkRegion* gdk_drawable_get_clip_region (GdkDrawable *drawable);
400 return new Region( gdk_drawable_get_clip_region(gdkDrawable) );
404 * Computes the region of a drawable that is potentially visible.
405 * This does not necessarily take into account if the window is
406 * obscured by other windows, but no area outside of this region
407 * is visible.
408 * drawable:
409 * a GdkDrawable
410 * Returns:
411 * a GdkRegion. This must be freed with gdk_region_destroy()
412 * when you are done.
414 public Region drawableGetVisibleRegion()
416 // GdkRegion* gdk_drawable_get_visible_region (GdkDrawable *drawable);
417 return new Region( gdk_drawable_get_visible_region(gdkDrawable) );
421 * Draws a point, using the foreground color and other attributes of
422 * the GdkGC.
423 * drawable:
424 * a GdkDrawable (a GdkWindow or a GdkPixmap).
425 * gc:
426 * a GdkGC.
427 * x:
428 * the x coordinate of the point.
429 * y:
430 * the y coordinate of the point.
432 public void drawPoint(GC gc, int x, int y)
434 // void gdk_draw_point (GdkDrawable *drawable, GdkGC *gc, gint x, gint y);
435 gdk_draw_point(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y);
439 * Draws a number of points, using the foreground color and other
440 * attributes of the GdkGC.
441 * drawable:
442 * a GdkDrawable (a GdkWindow or a GdkPixmap).
443 * gc:
444 * a GdkGC.
445 * points:
446 * an array of GdkPoint structures.
447 * npoints:
448 * the number of points to be drawn.
450 public void drawPoints(GC gc, GdkPoint* points, int npoints)
452 // void gdk_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints);
453 gdk_draw_points(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), points, npoints);
457 * Draws a line, using the foreground color and other attributes of
458 * the GdkGC.
459 * drawable:
460 * a GdkDrawable (a GdkWindow or a GdkPixmap).
461 * gc:
462 * a GdkGC.
463 * x1_:
464 * the x coordinate of the start point.
465 * y1_:
466 * the y coordinate of the start point.
467 * x2_:
468 * the x coordinate of the end point.
469 * y2_:
470 * the y coordinate of the end point.
472 public void drawLine(GC gc, int x1_, int y1_, int x2_, int y2_)
474 // void gdk_draw_line (GdkDrawable *drawable, GdkGC *gc, gint x1_, gint y1_, gint x2_, gint y2_);
475 gdk_draw_line(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x1_, y1_, x2_, y2_);
479 * Draws a series of lines connecting the given points.
480 * The way in which joins between lines are draw is determined by the
481 * GdkCapStyle value in the GdkGC. This can be set with
482 * gdk_gc_set_line_attributes().
483 * drawable:
484 * a GdkDrawable (a GdkWindow or a GdkPixmap).
485 * gc:
486 * a GdkGC.
487 * points:
488 * an array of GdkPoint structures specifying the endpoints of the
489 * npoints:
490 * the size of the points array.
492 public void drawLines(GC gc, GdkPoint* points, int npoints)
494 // void gdk_draw_lines (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints);
495 gdk_draw_lines(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), points, npoints);
499 * Renders a rectangular portion of a pixbuf to a drawable. The destination
500 * drawable must have a colormap. All windows have a colormap, however, pixmaps
501 * only have colormap by default if they were created with a non-NULL window
502 * argument. Otherwise a colormap must be set on them with
503 * gdk_drawable_set_colormap().
504 * On older X servers, rendering pixbufs with an alpha channel involves round
505 * trips to the X server, and may be somewhat slow.
506 * The clip mask of gc is ignored, but clip rectangles and clip regions work
507 * fine.
508 * drawable:
509 * Destination drawable.
510 * gc:
511 * a GdkGC, used for clipping, or NULL
512 * pixbuf:
513 * a GdkPixbuf
514 * src_x:
515 * Source X coordinate within pixbuf.
516 * src_y:
517 * Source Y coordinates within pixbuf.
518 * dest_x:
519 * Destination X coordinate within drawable.
520 * dest_y:
521 * Destination Y coordinate within drawable.
522 * width:
523 * Width of region to render, in pixels, or -1 to use pixbuf width.
524 * height:
525 * Height of region to render, in pixels, or -1 to use pixbuf height.
526 * dither:
527 * Dithering mode for GdkRGB.
528 * x_dither:
529 * X offset for dither.
530 * y_dither:
531 * Y offset for dither.
532 * Since 2.2
534 public void drawPixbuf(GC gc, Pixbuf pixbuf, int srcX, int srcY, int destX, int destY, int width, int height, GdkRgbDither dither, int xDither, int yDither)
536 // void gdk_draw_pixbuf (GdkDrawable *drawable, GdkGC *gc, GdkPixbuf *pixbuf, gint src_x, gint src_y, gint dest_x, gint dest_y, gint width, gint height, GdkRgbDither dither, gint x_dither, gint y_dither);
537 gdk_draw_pixbuf(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct(), srcX, srcY, destX, destY, width, height, dither, xDither, yDither);
541 * Draws a number of unconnected lines.
542 * drawable:
543 * a GdkDrawable (a GdkWindow or a GdkPixmap).
544 * gc:
545 * a GdkGC.
546 * segs:
547 * an array of GdkSegment structures specifying the start and
548 * end points of the lines to be drawn.
549 * nsegs:
550 * the number of line segments to draw, i.e. the size of the
551 * segs array.
553 public void drawSegments(GC gc, GdkSegment* segs, int nsegs)
555 // void gdk_draw_segments (GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs);
556 gdk_draw_segments(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), segs, nsegs);
561 * Draws a rectangular outline or filled rectangle, using the foreground color
562 * and other attributes of the GdkGC.
563 * A rectangle drawn filled is 1 pixel smaller in both dimensions than a
564 * rectangle outlined. Calling
565 * gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20)
566 * results in a filled rectangle 20 pixels wide and 20 pixels high. Calling
567 * gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)
568 * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20),
569 * and (20, 0), which makes it 21 pixels wide and 21 pixels high.
570 * Note
571 * drawable:
572 * a GdkDrawable (a GdkWindow or a GdkPixmap).
573 * gc:
574 * a GdkGC.
575 * filled:
576 * TRUE if the rectangle should be filled.
577 * x:
578 * the x coordinate of the left edge of the rectangle.
579 * y:
580 * the y coordinate of the top edge of the rectangle.
581 * width:
582 * the width of the rectangle.
583 * height:
584 * the height of the rectangle.
586 public void drawRectangle(GC gc, int filled, int x, int y, int width, int height)
588 // void gdk_draw_rectangle (GdkDrawable *drawable, GdkGC *gc, gboolean filled, gint x, gint y, gint width, gint height);
589 gdk_draw_rectangle(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, x, y, width, height);
593 * Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
594 * rectangle of the entire ellipse, and the start and end angles of the part
595 * of the ellipse to be drawn.
596 * drawable:
597 * a GdkDrawable (a GdkWindow or a GdkPixmap).
598 * gc:
599 * a GdkGC.
600 * filled:
601 * TRUE if the arc should be filled, producing a 'pie slice'.
602 * x:
603 * the x coordinate of the left edge of the bounding rectangle.
604 * y:
605 * the y coordinate of the top edge of the bounding rectangle.
606 * width:
607 * the width of the bounding rectangle.
608 * height:
609 * the height of the bounding rectangle.
610 * angle1:
611 * the start angle of the arc, relative to the 3 o'clock position,
612 * counter-clockwise, in 1/64ths of a degree.
613 * angle2:
614 * the end angle of the arc, relative to angle1, in 1/64ths
615 * of a degree.
617 public void drawArc(GC gc, int filled, int x, int y, int width, int height, int angle1, int angle2)
619 // void gdk_draw_arc (GdkDrawable *drawable, GdkGC *gc, gboolean filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2);
620 gdk_draw_arc(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, x, y, width, height, angle1, angle2);
624 * Draws an outlined or filled polygon.
625 * drawable:
626 * a GdkDrawable (a GdkWindow or a GdkPixmap).
627 * gc:
628 * a GdkGC.
629 * filled:
630 * TRUE if the polygon should be filled. The polygon is closed
631 * automatically, connecting the last point to the first point if
632 * necessary.
633 * points:
634 * an array of GdkPoint structures specifying the points making
635 * up the polygon.
636 * npoints:
637 * the number of points.
639 public void drawPolygon(GC gc, int filled, GdkPoint* points, int npoints)
641 // void gdk_draw_polygon (GdkDrawable *drawable, GdkGC *gc, gboolean filled, GdkPoint *points, gint npoints);
642 gdk_draw_polygon(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, points, npoints);
646 * Draws a set of anti-aliased trapezoids. The trapezoids are
647 * combined using saturation addition, then drawn over the background
648 * as a set. This is low level functionality used internally to implement
649 * rotated underlines and backgrouds when rendering a PangoLayout and is
650 * likely not useful for applications.
651 * drawable:
652 * a GdkDrawable
653 * gc:
654 * a GdkGC
655 * trapezoids:
656 * an array of GdkTrapezoid structures
657 * n_trapezoids:
658 * the number of trapezoids to draw
659 * Since 2.6
661 public void drawTrapezoids(GC gc, GdkTrapezoid* trapezoids, int nTrapezoids)
663 // void gdk_draw_trapezoids (GdkDrawable *drawable, GdkGC *gc, GdkTrapezoid *trapezoids, gint n_trapezoids);
664 gdk_draw_trapezoids(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), trapezoids, nTrapezoids);
669 * This is a low-level function; 99% of text rendering should be done
670 * using gdk_draw_layout() instead.
671 * A glyph is a single image in a font. This function draws a sequence of
672 * glyphs. To obtain a sequence of glyphs you have to understand a
673 * lot about internationalized text handling, which you don't want to
674 * understand; thus, use gdk_draw_layout() instead of this function,
675 * gdk_draw_layout() handles the details.
676 * drawable:
677 * a GdkDrawable
678 * gc:
679 * a GdkGC
680 * font:
681 * font to be used
682 * x:
683 * X coordinate of baseline origin
684 * y:
685 * Y coordinate of baseline origin
686 * glyphs:
687 * the glyph string to draw
689 public void drawGlyphs(GC gc, PangoFont* font, int x, int y, PangoGlyphString* glyphs)
691 // void gdk_draw_glyphs (GdkDrawable *drawable, GdkGC *gc, PangoFont *font, gint x, gint y, PangoGlyphString *glyphs);
692 gdk_draw_glyphs(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), font, x, y, glyphs);
696 * Renders a PangoGlyphString onto a drawable, possibly
697 * transforming the layed-out coordinates through a transformation
698 * matrix. Note that the transformation matrix for font is not
699 * changed, so to produce correct rendering results, the font
700 * must have been loaded using a PangoContext with an identical
701 * transformation matrix to that passed in to this function.
702 * See also gdk_draw_glyphs(), gdk_draw_layout().
703 * drawable:
704 * a GdkDrawable
705 * gc:
706 * a GdkGC
707 * matrix:
708 * a PangoMatrix, or NULL to use an identity transformation
709 * font:
710 * the font in which to draw the string
711 * x:
712 * the x position of the start of the string (in Pango
713 * units in user space coordinates)
714 * y:
715 * the y position of the baseline (in Pango units
716 * in user space coordinates)
717 * glyphs:
718 * the glyph string to draw
719 * Since 2.6
721 public void drawGlyphsTransformed(GC gc, PangoMatrix* matrix, PangoFont* font, int x, int y, PangoGlyphString* glyphs)
723 // void gdk_draw_glyphs_transformed (GdkDrawable *drawable, GdkGC *gc, PangoMatrix *matrix, PangoFont *font, gint x, gint y, PangoGlyphString *glyphs);
724 gdk_draw_glyphs_transformed(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), matrix, font, x, y, glyphs);
728 * Render a PangoLayoutLine onto an GDK drawable
729 * If the layout's PangoContext has a transformation matrix set, then
730 * x and y specify the position of the left edge of the baseline
731 * (left is in before-tranform user coordinates) in after-transform
732 * device coordinates.
733 * drawable:
734 * the drawable on which to draw the line
735 * gc:
736 * base graphics to use
737 * x:
738 * the x position of start of string (in pixels)
739 * y:
740 * the y position of baseline (in pixels)
741 * line:
742 * a PangoLayoutLine
744 public void drawLayoutLine(GC gc, int x, int y, PangoLayoutLine* line)
746 // void gdk_draw_layout_line (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayoutLine *line);
747 gdk_draw_layout_line(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, line);
751 * Render a PangoLayoutLine onto a GdkDrawable, overriding the
752 * layout's normal colors with foreground and/or background.
753 * foreground and background need not be allocated.
754 * If the layout's PangoContext has a transformation matrix set, then
755 * x and y specify the position of the left edge of the baseline
756 * (left is in before-tranform user coordinates) in after-transform
757 * device coordinates.
758 * drawable:
759 * the drawable on which to draw the line
760 * gc:
761 * base graphics to use
762 * x:
763 * the x position of start of string (in pixels)
764 * y:
765 * the y position of baseline (in pixels)
766 * line:
767 * a PangoLayoutLine
768 * foreground:
769 * foreground override color, or NULL for none
770 * background:
771 * background override color, or NULL for none
773 public void drawLayoutLineWithColors(GC gc, int x, int y, PangoLayoutLine* line, Color foreground, Color background)
775 // void gdk_draw_layout_line_with_colors (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayoutLine *line, const GdkColor *foreground, const GdkColor *background);
776 gdk_draw_layout_line_with_colors(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, line, (foreground is null) ? null : foreground.getColorStruct(), (background is null) ? null : background.getColorStruct());
780 * Render a PangoLayout onto a GDK drawable
781 * If the layout's PangoContext has a transformation matrix set, then
782 * x and y specify the position of the top left corner of the
783 * bounding box (in device space) of the transformed layout.
784 * If you're using GTK+, the usual way to obtain a PangoLayout
785 * is gtk_widget_create_pango_layout().
786 * drawable:
787 * the drawable on which to draw string
788 * gc:
789 * base graphics context to use
790 * x:
791 * the X position of the left of the layout (in pixels)
792 * y:
793 * the Y position of the top of the layout (in pixels)
794 * layout:
795 * a PangoLayout
797 public void drawLayout(GC gc, int x, int y, PgLayout layout)
799 // void gdk_draw_layout (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayout *layout);
800 gdk_draw_layout(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct());
804 * Render a PangoLayout onto a GdkDrawable, overriding the
805 * layout's normal colors with foreground and/or background.
806 * foreground and background need not be allocated.
807 * If the layout's PangoContext has a transformation matrix set, then
808 * x and y specify the position of the top left corner of the
809 * bounding box (in device space) of the transformed layout.
810 * If you're using GTK+, the ususal way to obtain a PangoLayout
811 * is gtk_widget_create_pango_layout().
812 * drawable:
813 * the drawable on which to draw string
814 * gc:
815 * base graphics context to use
816 * x:
817 * the X position of the left of the layout (in pixels)
818 * y:
819 * the Y position of the top of the layout (in pixels)
820 * layout:
821 * a PangoLayout
822 * foreground:
823 * foreground override color, or NULL for none
824 * background:
825 * background override color, or NULL for none
827 public void drawLayoutWithColors(GC gc, int x, int y, PgLayout layout, Color foreground, Color background)
829 // void gdk_draw_layout_with_colors (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayout *layout, const GdkColor *foreground, const GdkColor *background);
830 gdk_draw_layout_with_colors(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct(), (foreground is null) ? null : foreground.getColorStruct(), (background is null) ? null : background.getColorStruct());
834 * Warning
835 * gdk_draw_string is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
836 * Draws a string of characters in the given font or fontset.
837 * drawable:
838 * a GdkDrawable (a GdkWindow or a GdkPixmap).
839 * font:
840 * a GdkFont.
841 * gc:
842 * a GdkGC.
843 * x:
844 * the x coordinate of the left edge of the text.
845 * y:
846 * the y coordinate of the baseline of the text.
847 * string:
848 * the string of characters to draw.
850 public void drawString(Font font, GC gc, int x, int y, char[] string)
852 // void gdk_draw_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *string);
853 gdk_draw_string(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, Str.toStringz(string));
857 * Warning
858 * gdk_draw_text is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
859 * Draws a number of characters in the given font or fontset.
860 * drawable:
861 * a GdkDrawable (a GdkWindow or a GdkPixmap).
862 * font:
863 * a GdkFont.
864 * gc:
865 * a GdkGC.
866 * x:
867 * the x coordinate of the left edge of the text.
868 * y:
869 * the y coordinate of the baseline of the text.
870 * text:
871 * the characters to draw.
872 * text_length:
873 * the number of characters of text to draw.
875 public void drawText(Font font, GC gc, int x, int y, char[] text, int textLength)
877 // void gdk_draw_text (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length);
878 gdk_draw_text(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, Str.toStringz(text), textLength);
882 * Warning
883 * gdk_draw_text_wc is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
884 * Draws a number of wide characters using the given font of fontset.
885 * If the font is a 1-byte font, the string is converted into 1-byte
886 * characters (discarding the high bytes) before output.
887 * drawable:
888 * a GdkDrawable (a GdkWindow or a GdkPixmap).
889 * font:
890 * a GdkFont.
891 * gc:
892 * a GdkGC.
893 * x:
894 * the x coordinate of the left edge of the text.
895 * y:
896 * the y coordinate of the baseline of the text.
897 * text:
898 * the wide characters to draw.
899 * text_length:
900 * the number of characters to draw.
902 public void drawTextWc(Font font, GC gc, int x, int y, GdkWChar* text, int textLength)
904 // void gdk_draw_text_wc (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const GdkWChar *text, gint text_length);
905 gdk_draw_text_wc(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, text, textLength);
910 * Copies the width x height region of src at coordinates (xsrc,
911 * ysrc) to coordinates (xdest, ydest) in drawable.
912 * width and/or height may be given as -1, in which case the entire
913 * src drawable will be copied.
914 * Most fields in gc are not used for this operation, but notably the
915 * clip mask or clip region will be honored.
916 * The source and destination drawables must have the same visual and
917 * colormap, or errors will result. (On X11, failure to match
918 * visual/colormap results in a BadMatch error from the X server.)
919 * A common cause of this problem is an attempt to draw a bitmap to
920 * a color drawable. The way to draw a bitmap is to set the bitmap as
921 * the stipple on the GdkGC, set the fill mode to GDK_STIPPLED, and
922 * then draw the rectangle.
923 * drawable:
924 * a GdkDrawable
925 * gc:
926 * a GdkGC sharing the drawable's visual and colormap
927 * src:
928 * the source GdkDrawable, which may be the same as drawable
929 * xsrc:
930 * X position in src of rectangle to draw
931 * ysrc:
932 * Y position in src of rectangle to draw
933 * xdest:
934 * X position in drawable where the rectangle should be drawn
935 * ydest:
936 * Y position in drawable where the rectangle should be drawn
937 * width:
938 * width of rectangle to draw, or -1 for entire src width
939 * height:
940 * height of rectangle to draw, or -1 for entire src height
942 public void drawDrawable(GC gc, Drawable src, int xsrc, int ysrc, int xdest, int ydest, int width, int height)
944 // void gdk_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height);
945 gdk_draw_drawable(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), (src is null) ? null : src.getDrawableStruct(), xsrc, ysrc, xdest, ydest, width, height);
949 * Draws a GdkImage onto a drawable.
950 * The depth of the GdkImage must match the depth of the GdkDrawable.
951 * drawable:
952 * a GdkDrawable (a GdkWindow or a GdkPixmap).
953 * gc:
954 * a GdkGC.
955 * image:
956 * the GdkImage to draw.
957 * xsrc:
958 * the left edge of the source rectangle within image.
959 * ysrc:
960 * the top of the source rectangle within image.
961 * xdest:
962 * the x coordinate of the destination within drawable.
963 * ydest:
964 * the y coordinate of the destination within drawable.
965 * width:
966 * the width of the area to be copied, or -1 to make the area
967 * extend to the right edge of image.
968 * height:
969 * the height of the area to be copied, or -1 to make the area
970 * extend to the bottom edge of image.
972 public void drawImage(GC gc, ImageGdk image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)
974 // void gdk_draw_image (GdkDrawable *drawable, GdkGC *gc, GdkImage *image, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height);
975 gdk_draw_image(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), (image is null) ? null : image.getImageGdkStruct(), xsrc, ysrc, xdest, ydest, width, height);
979 * A GdkImage stores client-side image data (pixels). In contrast,
980 * GdkPixmap and GdkWindow are server-side
981 * objects. gdk_drawable_get_image() obtains the pixels from a
982 * server-side drawable as a client-side GdkImage. The format of a
983 * GdkImage depends on the GdkVisual of the current display, which
984 * makes manipulating GdkImage extremely difficult; therefore, in
985 * most cases you should use gdk_pixbuf_get_from_drawable() instead of
986 * this lower-level function. A GdkPixbuf contains image data in a
987 * canonicalized RGB format, rather than a display-dependent format.
988 * Of course, there's a convenience vs. speed tradeoff here, so you'll
989 * want to think about what makes sense for your application.
990 * x, y, width, and height define the region of drawable to
991 * obtain as an image.
992 * You would usually copy image data to the client side if you intend
993 * to examine the values of individual pixels, for example to darken
994 * an image or add a red tint. It would be prohibitively slow to
995 * make a round-trip request to the windowing system for each pixel,
996 * so instead you get all of them at once, modify them, then copy
997 * them all back at once.
998 * If the X server or other windowing system backend is on the local
999 * machine, this function may use shared memory to avoid copying
1000 * the image data.
1001 * If the source drawable is a GdkWindow and partially offscreen
1002 * or obscured, then the obscured portions of the returned image
1003 * will contain undefined data.
1004 * drawable:
1005 * a GdkDrawable
1006 * x:
1007 * x coordinate on drawable
1008 * y:
1009 * y coordinate on drawable
1010 * width:
1011 * width of region to get
1012 * height:
1013 * height or region to get
1014 * Returns:
1015 * a GdkImage containing the contents of drawable
1017 public ImageGdk drawableGetImage(int x, int y, int width, int height)
1019 // GdkImage* gdk_drawable_get_image (GdkDrawable *drawable, gint x, gint y, gint width, gint height);
1020 return new ImageGdk( gdk_drawable_get_image(gdkDrawable, x, y, width, height) );
1024 * Copies a portion of drawable into the client side image structure
1025 * image. If image is NULL, creates a new image of size width x height
1026 * and copies into that. See gdk_drawable_get_image() for further details.
1027 * drawable:
1028 * a GdkDrawable
1029 * image:
1030 * a GdkDrawable, or NULL if a new image should be created.
1031 * src_x:
1032 * x coordinate on drawable
1033 * src_y:
1034 * y coordinate on drawable
1035 * dest_x:
1036 * x coordinate within image. Must be 0 if image is NULL
1037 * dest_y:
1038 * y coordinate within image. Must be 0 if image is NULL
1039 * width:
1040 * width of region to get
1041 * height:
1042 * height or region to get
1043 * Returns:
1044 * image, or a new a GdkImage containing the contents
1045 * of drawable
1046 * Since 2.4
1048 public ImageGdk drawableCopyToImage(ImageGdk image, int srcX, int srcY, int destX, int destY, int width, int height)
1050 // GdkImage* gdk_drawable_copy_to_image (GdkDrawable *drawable, GdkImage *image, gint src_x, gint src_y, gint dest_x, gint dest_y, gint width, gint height);
1051 return new ImageGdk( gdk_drawable_copy_to_image(gdkDrawable, (image is null) ? null : image.getImageGdkStruct(), srcX, srcY, destX, destY, width, height) );