alternative to assert
[gtkD.git] / gtkD / src / gdk / Drawable.d
blob6214adb4c3f9b68159da705b459a5733d6833394
1 /*
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 = 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_drawable_
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 * module aliases:
101 * local aliases:
104 module gdk.Drawable;
106 version(noAssert)
108 version(Tango)
110 import tango.io.Stdout; // use the tango loging?
114 private import gtkc.gdktypes;
116 private import gtkc.gdk;
119 private import glib.Str;
120 private import gdk.Drawable;
121 private import gdk.Display;
122 private import gdk.Screen;
123 private import gdk.Visual;
124 private import gdk.Colormap;
125 private import gdk.Region;
126 private import gdk.GC;
127 private import gdk.Pixbuf;
128 private import gdk.Color;
129 private import gdk.Font;
130 private import gdk.ImageGdk;
131 private import pango.PgContext;
132 private import pango.PgItem;
133 private import pango.PgLayout;
134 private import pango.PgFontDescription;
135 private import pango.PgFontMetrics;
136 private import pango.PgFontFamily;
137 private import pango.PgFontFace;
138 private import pango.PgFontMap;
139 private import pango.PgFontsetSimple;
140 private import pango.PgAttribute;
141 private import pango.PgAttributeList;
142 private import pango.PgLanguage;
143 private import pango.PgTabArray;
144 private import pango.PgLayout;
145 private import pango.PgLayoutIter;
146 private import pango.PgScriptIter;
152 * Description
153 * These functions provide support for drawing points, lines, arcs and text
154 * onto what are called 'drawables'. Drawables, as the name suggests, are things
155 * which support drawing onto them, and are either GdkWindow or GdkPixmap
156 * objects.
157 * Many of the drawing operations take a GdkGC argument, which represents a
158 * graphics context. This GdkGC contains a number of drawing attributes such
159 * as foreground color, background color and line width, and is used to reduce
160 * the number of arguments needed for each drawing operation. See the
161 * Graphics Contexts section for
162 * more information.
163 * Some of the drawing operations take Pango data structures like PangoContext,
164 * PangoLayout or PangoLayoutLine as arguments. If you're using GTK+, the ususal
165 * way to obtain these structures is via gtk_widget_create_pango_context() or
166 * gtk_widget_create_pango_layout().
168 private import gobject.ObjectG;
169 public class Drawable : ObjectG
172 /** the main Gtk struct */
173 protected GdkDrawable* gdkDrawable;
176 public GdkDrawable* getDrawableStruct()
178 return gdkDrawable;
182 /** the main Gtk struct as a void* */
183 protected void* getStruct()
185 return cast(void*)gdkDrawable;
189 * Sets our main struct and passes it to the parent class
191 public this (GdkDrawable* gdkDrawable)
193 version(noAssert)
195 if ( gdkDrawable is null )
197 int zero = 0;
198 version(Tango)
200 Stdout("struct gdkDrawable is null on constructor").newline;
202 else
204 printf("struct gdkDrawable is null on constructor");
206 zero = zero / zero;
209 else
211 assert(gdkDrawable !is null, "struct gdkDrawable is null on constructor");
213 super(cast(GObject*)gdkDrawable);
214 this.gdkDrawable = gdkDrawable;
218 * Draws an outlined or filled polygon.
219 * drawable:
220 * a GdkDrawable (a GdkWindow or a GdkPixmap).
221 * gc:
222 * a GdkGC.
223 * filled:
224 * TRUE if the polygon should be filled. The polygon is closed
225 * automatically, connecting the last point to the first point if
226 * necessary.
227 * points:
228 * an array of GdkPoint structures specifying the points making
229 * up the polygon.
231 public void drawPolygon(GC gc, int filled, GdkPoint[] points)
233 // void gdk_draw_polygon (GdkDrawable *drawable, GdkGC *gc, gboolean filled, GdkPoint *points, gint npoints);
234 gdk_draw_polygon(gdkDrawable, gc.getGCStruct(), filled, points.ptr, points.length);
237 public void drawPixbuf(Pixbuf pixbuf, int destX, int destY)
239 drawPixbuf(null, pixbuf, destX, destY);
241 public void drawPixbuf(GC gc, Pixbuf pixbuf, int destX, int destY)
243 if ( pixbuf is null ) return;
244 gdk_draw_pixbuf(gdkDrawable,
245 (gc is null) ? null : gc.getGCStruct(),
246 pixbuf.getPixbufStruct(),
247 0, 0, destX, destY,
248 pixbuf.getWidth(), pixbuf.getHeight(),
249 GdkRgbDither.NORMAL,
250 0, 0);
262 * Warning
263 * gdk_drawable_ref is deprecated and should not be used in newly-written code.
264 * Deprecated equivalent of calling g_object_ref() on drawable.
265 * (Drawables were not objects in previous versions of GDK.)
266 * drawable:
267 * a GdkDrawable
268 * Returns:
269 * the same drawable passed in
271 public Drawable doref()
273 // GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable);
274 return new Drawable( gdk_drawable_ref(gdkDrawable) );
278 * Warning
279 * gdk_drawable_unref is deprecated and should not be used in newly-written code.
280 * Deprecated equivalent of calling g_object_unref() on drawable.
281 * drawable:
282 * a GdkDrawable
284 public void unref()
286 // void gdk_drawable_unref (GdkDrawable *drawable);
287 gdk_drawable_unref(gdkDrawable);
291 * Warning
292 * gdk_drawable_set_data is deprecated and should not be used in newly-written code.
293 * This function is equivalent to g_object_set_data(),
294 * the GObject variant should be used instead.
295 * drawable:
296 * a GdkDrawable
297 * key:
298 * name to store the data under
299 * data:
300 * arbitrary data
301 * destroy_func:
302 * function to free data, or NULL
304 public void setData(char[] key, void* data, GDestroyNotify destroyFunc)
306 // void gdk_drawable_set_data (GdkDrawable *drawable, const gchar *key, gpointer data, GDestroyNotify destroy_func);
307 gdk_drawable_set_data(gdkDrawable, Str.toStringz(key), data, destroyFunc);
311 * Warning
312 * gdk_drawable_get_data is deprecated and should not be used in newly-written code.
313 * Equivalent to g_object_get_data(); the GObject variant should be
314 * used instead.
315 * drawable:
316 * a GdkDrawable
317 * key:
318 * name the data was stored under
319 * Returns:
320 * the data stored at key
322 public void* getData(char[] key)
324 // gpointer gdk_drawable_get_data (GdkDrawable *drawable, const gchar *key);
325 return gdk_drawable_get_data(gdkDrawable, Str.toStringz(key));
329 * Gets the GdkDisplay associated with a GdkDrawable.
330 * drawable:
331 * a GdkDrawable
332 * Returns:
333 * the GdkDisplay associated with drawable
334 * Since 2.2
336 public Display getDisplay()
338 // GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
339 return new Display( gdk_drawable_get_display(gdkDrawable) );
343 * Gets the GdkScreen associated with a GdkDrawable.
344 * drawable:
345 * a GdkDrawable
346 * Returns:
347 * the GdkScreen associated with drawable
348 * Since 2.2
350 public Screen getScreen()
352 // GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
353 return new Screen( gdk_drawable_get_screen(gdkDrawable) );
357 * Gets the GdkVisual describing the pixel format of drawable.
358 * drawable:
359 * a GdkDrawable
360 * Returns:
361 * a GdkVisual
363 public Visual getVisual()
365 // GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
366 return new Visual( gdk_drawable_get_visual(gdkDrawable) );
370 * Sets the colormap associated with drawable. Normally this will
371 * happen automatically when the drawable is created; you only need to
372 * use this function if the drawable-creating function did not have a
373 * way to determine the colormap, and you then use drawable operations
374 * that require a colormap. The colormap for all drawables and
375 * graphics contexts you intend to use together should match. i.e.
376 * when using a GdkGC to draw to a drawable, or copying one drawable
377 * to another, the colormaps should match.
378 * drawable:
379 * a GdkDrawable
380 * colormap:
381 * a GdkColormap
383 public void setColormap(Colormap colormap)
385 // void gdk_drawable_set_colormap (GdkDrawable *drawable, GdkColormap *colormap);
386 gdk_drawable_set_colormap(gdkDrawable, (colormap is null) ? null : colormap.getColormapStruct());
390 * Gets the colormap for drawable, if one is set; returns
391 * NULL otherwise.
392 * drawable:
393 * a GdkDrawable
394 * Returns:
395 * the colormap, or NULL
397 public Colormap getColormap()
399 // GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
400 return new Colormap( gdk_drawable_get_colormap(gdkDrawable) );
404 * Obtains the bit depth of the drawable, that is, the number of bits
405 * that make up a pixel in the drawable's visual. Examples are 8 bits
406 * per pixel, 24 bits per pixel, etc.
407 * drawable:
408 * a GdkDrawable
409 * Returns:
410 * number of bits per pixel
412 public int getDepth()
414 // gint gdk_drawable_get_depth (GdkDrawable *drawable);
415 return gdk_drawable_get_depth(gdkDrawable);
419 * Fills *width and *height with the size of drawable.
420 * width or height can be NULL if you only want the other one.
421 * On the X11 platform, if drawable is a GdkWindow, the returned
422 * size is the size reported in the most-recently-processed configure
423 * event, rather than the current size on the X server.
424 * drawable:
425 * a GdkDrawable
426 * width:
427 * location to store drawable's width, or NULL
428 * height:
429 * location to store drawable's height, or NULL
431 public void getSize(int* width, int* height)
433 // void gdk_drawable_get_size (GdkDrawable *drawable, gint *width, gint *height);
434 gdk_drawable_get_size(gdkDrawable, width, height);
438 * Computes the region of a drawable that potentially can be written
439 * to by drawing primitives. This region will not take into account
440 * the clip region for the GC, and may also not take into account
441 * other factors such as if the window is obscured by other windows,
442 * but no area outside of this region will be affected by drawing
443 * primitives.
444 * drawable:
445 * a GdkDrawable
446 * Returns:
447 * a GdkRegion. This must be freed with gdk_region_destroy()
448 * when you are done.
450 public Region getClipRegion()
452 // GdkRegion* gdk_drawable_get_clip_region (GdkDrawable *drawable);
453 return new Region( gdk_drawable_get_clip_region(gdkDrawable) );
457 * Computes the region of a drawable that is potentially visible.
458 * This does not necessarily take into account if the window is
459 * obscured by other windows, but no area outside of this region
460 * is visible.
461 * drawable:
462 * a GdkDrawable
463 * Returns:
464 * a GdkRegion. This must be freed with gdk_region_destroy()
465 * when you are done.
467 public Region getVisibleRegion()
469 // GdkRegion* gdk_drawable_get_visible_region (GdkDrawable *drawable);
470 return new Region( gdk_drawable_get_visible_region(gdkDrawable) );
474 * Draws a point, using the foreground color and other attributes of
475 * the GdkGC.
476 * drawable:
477 * a GdkDrawable (a GdkWindow or a GdkPixmap).
478 * gc:
479 * a GdkGC.
480 * x:
481 * the x coordinate of the point.
482 * y:
483 * the y coordinate of the point.
485 public void drawPoint(GC gc, int x, int y)
487 // void gdk_draw_point (GdkDrawable *drawable, GdkGC *gc, gint x, gint y);
488 gdk_draw_point(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y);
492 * Draws a number of points, using the foreground color and other
493 * attributes of the GdkGC.
494 * drawable:
495 * a GdkDrawable (a GdkWindow or a GdkPixmap).
496 * gc:
497 * a GdkGC.
498 * points:
499 * an array of GdkPoint structures.
500 * npoints:
501 * the number of points to be drawn.
503 public void drawPoints(GC gc, GdkPoint* points, int npoints)
505 // void gdk_draw_points (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints);
506 gdk_draw_points(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), points, npoints);
510 * Draws a line, using the foreground color and other attributes of
511 * the GdkGC.
512 * drawable:
513 * a GdkDrawable (a GdkWindow or a GdkPixmap).
514 * gc:
515 * a GdkGC.
516 * x1_:
517 * the x coordinate of the start point.
518 * y1_:
519 * the y coordinate of the start point.
520 * x2_:
521 * the x coordinate of the end point.
522 * y2_:
523 * the y coordinate of the end point.
525 public void drawLine(GC gc, int x1_, int y1_, int x2_, int y2_)
527 // void gdk_draw_line (GdkDrawable *drawable, GdkGC *gc, gint x1_, gint y1_, gint x2_, gint y2_);
528 gdk_draw_line(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x1_, y1_, x2_, y2_);
532 * Draws a series of lines connecting the given points.
533 * The way in which joins between lines are draw is determined by the
534 * GdkCapStyle value in the GdkGC. This can be set with
535 * gdk_gc_set_line_attributes().
536 * drawable:
537 * a GdkDrawable (a GdkWindow or a GdkPixmap).
538 * gc:
539 * a GdkGC.
540 * points:
541 * an array of GdkPoint structures specifying the endpoints of the
542 * npoints:
543 * the size of the points array.
545 public void drawLines(GC gc, GdkPoint* points, int npoints)
547 // void gdk_draw_lines (GdkDrawable *drawable, GdkGC *gc, GdkPoint *points, gint npoints);
548 gdk_draw_lines(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), points, npoints);
552 * Renders a rectangular portion of a pixbuf to a drawable. The destination
553 * drawable must have a colormap. All windows have a colormap, however, pixmaps
554 * only have colormap by default if they were created with a non-NULL window
555 * argument. Otherwise a colormap must be set on them with
556 * gdk_drawable_set_colormap().
557 * On older X servers, rendering pixbufs with an alpha channel involves round
558 * trips to the X server, and may be somewhat slow.
559 * The clip mask of gc is ignored, but clip rectangles and clip regions work
560 * fine.
561 * drawable:
562 * Destination drawable.
563 * gc:
564 * a GdkGC, used for clipping, or NULL
565 * pixbuf:
566 * a GdkPixbuf
567 * src_x:
568 * Source X coordinate within pixbuf.
569 * src_y:
570 * Source Y coordinates within pixbuf.
571 * dest_x:
572 * Destination X coordinate within drawable.
573 * dest_y:
574 * Destination Y coordinate within drawable.
575 * width:
576 * Width of region to render, in pixels, or -1 to use pixbuf width.
577 * height:
578 * Height of region to render, in pixels, or -1 to use pixbuf height.
579 * dither:
580 * Dithering mode for GdkRGB.
581 * x_dither:
582 * X offset for dither.
583 * y_dither:
584 * Y offset for dither.
585 * Since 2.2
587 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)
589 // 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);
590 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);
594 * Draws a number of unconnected lines.
595 * drawable:
596 * a GdkDrawable (a GdkWindow or a GdkPixmap).
597 * gc:
598 * a GdkGC.
599 * segs:
600 * an array of GdkSegment structures specifying the start and
601 * end points of the lines to be drawn.
602 * nsegs:
603 * the number of line segments to draw, i.e. the size of the
604 * segs array.
606 public void drawSegments(GC gc, GdkSegment* segs, int nsegs)
608 // void gdk_draw_segments (GdkDrawable *drawable, GdkGC *gc, GdkSegment *segs, gint nsegs);
609 gdk_draw_segments(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), segs, nsegs);
614 * Draws a rectangular outline or filled rectangle, using the foreground color
615 * and other attributes of the GdkGC.
616 * A rectangle drawn filled is 1 pixel smaller in both dimensions than a
617 * rectangle outlined. Calling
618 * gdk_draw_rectangle (window, gc, TRUE, 0, 0, 20, 20)
619 * results in a filled rectangle 20 pixels wide and 20 pixels high. Calling
620 * gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)
621 * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20),
622 * and (20, 0), which makes it 21 pixels wide and 21 pixels high.
623 * Note
624 * drawable:
625 * a GdkDrawable (a GdkWindow or a GdkPixmap).
626 * gc:
627 * a GdkGC.
628 * filled:
629 * TRUE if the rectangle should be filled.
630 * x:
631 * the x coordinate of the left edge of the rectangle.
632 * y:
633 * the y coordinate of the top edge of the rectangle.
634 * width:
635 * the width of the rectangle.
636 * height:
637 * the height of the rectangle.
639 public void drawRectangle(GC gc, int filled, int x, int y, int width, int height)
641 // void gdk_draw_rectangle (GdkDrawable *drawable, GdkGC *gc, gboolean filled, gint x, gint y, gint width, gint height);
642 gdk_draw_rectangle(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, x, y, width, height);
646 * Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
647 * rectangle of the entire ellipse, and the start and end angles of the part
648 * of the ellipse to be drawn.
649 * drawable:
650 * a GdkDrawable (a GdkWindow or a GdkPixmap).
651 * gc:
652 * a GdkGC.
653 * filled:
654 * TRUE if the arc should be filled, producing a 'pie slice'.
655 * x:
656 * the x coordinate of the left edge of the bounding rectangle.
657 * y:
658 * the y coordinate of the top edge of the bounding rectangle.
659 * width:
660 * the width of the bounding rectangle.
661 * height:
662 * the height of the bounding rectangle.
663 * angle1:
664 * the start angle of the arc, relative to the 3 o'clock position,
665 * counter-clockwise, in 1/64ths of a degree.
666 * angle2:
667 * the end angle of the arc, relative to angle1, in 1/64ths
668 * of a degree.
670 public void drawArc(GC gc, int filled, int x, int y, int width, int height, int angle1, int angle2)
672 // void gdk_draw_arc (GdkDrawable *drawable, GdkGC *gc, gboolean filled, gint x, gint y, gint width, gint height, gint angle1, gint angle2);
673 gdk_draw_arc(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, x, y, width, height, angle1, angle2);
677 * Draws an outlined or filled polygon.
678 * drawable:
679 * a GdkDrawable (a GdkWindow or a GdkPixmap).
680 * gc:
681 * a GdkGC.
682 * filled:
683 * TRUE if the polygon should be filled. The polygon is closed
684 * automatically, connecting the last point to the first point if
685 * necessary.
686 * points:
687 * an array of GdkPoint structures specifying the points making
688 * up the polygon.
689 * npoints:
690 * the number of points.
692 public void drawPolygon(GC gc, int filled, GdkPoint* points, int npoints)
694 // void gdk_draw_polygon (GdkDrawable *drawable, GdkGC *gc, gboolean filled, GdkPoint *points, gint npoints);
695 gdk_draw_polygon(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), filled, points, npoints);
699 * Draws a set of anti-aliased trapezoids. The trapezoids are
700 * combined using saturation addition, then drawn over the background
701 * as a set. This is low level functionality used internally to implement
702 * rotated underlines and backgrouds when rendering a PangoLayout and is
703 * likely not useful for applications.
704 * drawable:
705 * a GdkDrawable
706 * gc:
707 * a GdkGC
708 * trapezoids:
709 * an array of GdkTrapezoid structures
710 * n_trapezoids:
711 * the number of trapezoids to draw
712 * Since 2.6
714 public void drawTrapezoids(GC gc, GdkTrapezoid* trapezoids, int nTrapezoids)
716 // void gdk_draw_trapezoids (GdkDrawable *drawable, GdkGC *gc, GdkTrapezoid *trapezoids, gint n_trapezoids);
717 gdk_draw_trapezoids(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), trapezoids, nTrapezoids);
722 * This is a low-level function; 99% of text rendering should be done
723 * using gdk_draw_layout() instead.
724 * A glyph is a single image in a font. This function draws a sequence of
725 * glyphs. To obtain a sequence of glyphs you have to understand a
726 * lot about internationalized text handling, which you don't want to
727 * understand; thus, use gdk_draw_layout() instead of this function,
728 * gdk_draw_layout() handles the details.
729 * drawable:
730 * a GdkDrawable
731 * gc:
732 * a GdkGC
733 * font:
734 * font to be used
735 * x:
736 * X coordinate of baseline origin
737 * y:
738 * Y coordinate of baseline origin
739 * glyphs:
740 * the glyph string to draw
742 public void drawGlyphs(GC gc, PangoFont* font, int x, int y, PangoGlyphString* glyphs)
744 // void gdk_draw_glyphs (GdkDrawable *drawable, GdkGC *gc, PangoFont *font, gint x, gint y, PangoGlyphString *glyphs);
745 gdk_draw_glyphs(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), font, x, y, glyphs);
749 * Renders a PangoGlyphString onto a drawable, possibly
750 * transforming the layed-out coordinates through a transformation
751 * matrix. Note that the transformation matrix for font is not
752 * changed, so to produce correct rendering results, the font
753 * must have been loaded using a PangoContext with an identical
754 * transformation matrix to that passed in to this function.
755 * See also gdk_draw_glyphs(), gdk_draw_layout().
756 * drawable:
757 * a GdkDrawable
758 * gc:
759 * a GdkGC
760 * matrix:
761 * a PangoMatrix, or NULL to use an identity transformation
762 * font:
763 * the font in which to draw the string
764 * x:
765 * the x position of the start of the string (in Pango
766 * units in user space coordinates)
767 * y:
768 * the y position of the baseline (in Pango units
769 * in user space coordinates)
770 * glyphs:
771 * the glyph string to draw
772 * Since 2.6
774 public void drawGlyphsTransformed(GC gc, PangoMatrix* matrix, PangoFont* font, int x, int y, PangoGlyphString* glyphs)
776 // void gdk_draw_glyphs_transformed (GdkDrawable *drawable, GdkGC *gc, PangoMatrix *matrix, PangoFont *font, gint x, gint y, PangoGlyphString *glyphs);
777 gdk_draw_glyphs_transformed(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), matrix, font, x, y, glyphs);
781 * Render a PangoLayoutLine onto an GDK drawable
782 * If the layout's PangoContext has a transformation matrix set, then
783 * x and y specify the position of the left edge of the baseline
784 * (left is in before-tranform user coordinates) in after-transform
785 * device coordinates.
786 * drawable:
787 * the drawable on which to draw the line
788 * gc:
789 * base graphics to use
790 * x:
791 * the x position of start of string (in pixels)
792 * y:
793 * the y position of baseline (in pixels)
794 * line:
795 * a PangoLayoutLine
797 public void drawLayoutLine(GC gc, int x, int y, PangoLayoutLine* line)
799 // void gdk_draw_layout_line (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayoutLine *line);
800 gdk_draw_layout_line(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, line);
804 * Render a PangoLayoutLine 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 left edge of the baseline
809 * (left is in before-tranform user coordinates) in after-transform
810 * device coordinates.
811 * drawable:
812 * the drawable on which to draw the line
813 * gc:
814 * base graphics to use
815 * x:
816 * the x position of start of string (in pixels)
817 * y:
818 * the y position of baseline (in pixels)
819 * line:
820 * a PangoLayoutLine
821 * foreground:
822 * foreground override color, or NULL for none
823 * background:
824 * background override color, or NULL for none
826 public void drawLayoutLineWithColors(GC gc, int x, int y, PangoLayoutLine* line, Color foreground, Color background)
828 // void gdk_draw_layout_line_with_colors (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayoutLine *line, const GdkColor *foreground, const GdkColor *background);
829 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());
833 * Render a PangoLayout onto a GDK drawable
834 * If the layout's PangoContext has a transformation matrix set, then
835 * x and y specify the position of the top left corner of the
836 * bounding box (in device space) of the transformed layout.
837 * If you're using GTK+, the usual way to obtain a PangoLayout
838 * is gtk_widget_create_pango_layout().
839 * drawable:
840 * the drawable on which to draw string
841 * gc:
842 * base graphics context to use
843 * x:
844 * the X position of the left of the layout (in pixels)
845 * y:
846 * the Y position of the top of the layout (in pixels)
847 * layout:
848 * a PangoLayout
850 public void drawLayout(GC gc, int x, int y, PgLayout layout)
852 // void gdk_draw_layout (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayout *layout);
853 gdk_draw_layout(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct());
857 * Render a PangoLayout onto a GdkDrawable, overriding the
858 * layout's normal colors with foreground and/or background.
859 * foreground and background need not be allocated.
860 * If the layout's PangoContext has a transformation matrix set, then
861 * x and y specify the position of the top left corner of the
862 * bounding box (in device space) of the transformed layout.
863 * If you're using GTK+, the ususal way to obtain a PangoLayout
864 * is gtk_widget_create_pango_layout().
865 * drawable:
866 * the drawable on which to draw string
867 * gc:
868 * base graphics context to use
869 * x:
870 * the X position of the left of the layout (in pixels)
871 * y:
872 * the Y position of the top of the layout (in pixels)
873 * layout:
874 * a PangoLayout
875 * foreground:
876 * foreground override color, or NULL for none
877 * background:
878 * background override color, or NULL for none
880 public void drawLayoutWithColors(GC gc, int x, int y, PgLayout layout, Color foreground, Color background)
882 // void gdk_draw_layout_with_colors (GdkDrawable *drawable, GdkGC *gc, gint x, gint y, PangoLayout *layout, const GdkColor *foreground, const GdkColor *background);
883 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());
887 * Warning
888 * gdk_draw_string is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
889 * Draws a string of characters in the given font or fontset.
890 * drawable:
891 * a GdkDrawable (a GdkWindow or a GdkPixmap).
892 * font:
893 * a GdkFont.
894 * gc:
895 * a GdkGC.
896 * x:
897 * the x coordinate of the left edge of the text.
898 * y:
899 * the y coordinate of the baseline of the text.
900 * string:
901 * the string of characters to draw.
903 public void drawString(Font font, GC gc, int x, int y, char[] string)
905 // void gdk_draw_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *string);
906 gdk_draw_string(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, Str.toStringz(string));
910 * Warning
911 * gdk_draw_text is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
912 * Draws a number of characters in the given font or fontset.
913 * drawable:
914 * a GdkDrawable (a GdkWindow or a GdkPixmap).
915 * font:
916 * a GdkFont.
917 * gc:
918 * a GdkGC.
919 * x:
920 * the x coordinate of the left edge of the text.
921 * y:
922 * the y coordinate of the baseline of the text.
923 * text:
924 * the characters to draw.
925 * text_length:
926 * the number of characters of text to draw.
928 public void drawText(Font font, GC gc, int x, int y, char[] text, int textLength)
930 // void gdk_draw_text (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const gchar *text, gint text_length);
931 gdk_draw_text(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, Str.toStringz(text), textLength);
935 * Warning
936 * gdk_draw_text_wc is deprecated and should not be used in newly-written code. Use gdk_draw_layout() instead.
937 * Draws a number of wide characters using the given font of fontset.
938 * If the font is a 1-byte font, the string is converted into 1-byte
939 * characters (discarding the high bytes) before output.
940 * drawable:
941 * a GdkDrawable (a GdkWindow or a GdkPixmap).
942 * font:
943 * a GdkFont.
944 * gc:
945 * a GdkGC.
946 * x:
947 * the x coordinate of the left edge of the text.
948 * y:
949 * the y coordinate of the baseline of the text.
950 * text:
951 * the wide characters to draw.
952 * text_length:
953 * the number of characters to draw.
955 public void drawTextWc(Font font, GC gc, int x, int y, GdkWChar* text, int textLength)
957 // void gdk_draw_text_wc (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, gint x, gint y, const GdkWChar *text, gint text_length);
958 gdk_draw_text_wc(gdkDrawable, (font is null) ? null : font.getFontStruct(), (gc is null) ? null : gc.getGCStruct(), x, y, text, textLength);
963 * Copies the width x height region of src at coordinates (xsrc,
964 * ysrc) to coordinates (xdest, ydest) in drawable.
965 * width and/or height may be given as -1, in which case the entire
966 * src drawable will be copied.
967 * Most fields in gc are not used for this operation, but notably the
968 * clip mask or clip region will be honored.
969 * The source and destination drawables must have the same visual and
970 * colormap, or errors will result. (On X11, failure to match
971 * visual/colormap results in a BadMatch error from the X server.)
972 * A common cause of this problem is an attempt to draw a bitmap to
973 * a color drawable. The way to draw a bitmap is to set the bitmap as
974 * the stipple on the GdkGC, set the fill mode to GDK_STIPPLED, and
975 * then draw the rectangle.
976 * drawable:
977 * a GdkDrawable
978 * gc:
979 * a GdkGC sharing the drawable's visual and colormap
980 * src:
981 * the source GdkDrawable, which may be the same as drawable
982 * xsrc:
983 * X position in src of rectangle to draw
984 * ysrc:
985 * Y position in src of rectangle to draw
986 * xdest:
987 * X position in drawable where the rectangle should be drawn
988 * ydest:
989 * Y position in drawable where the rectangle should be drawn
990 * width:
991 * width of rectangle to draw, or -1 for entire src width
992 * height:
993 * height of rectangle to draw, or -1 for entire src height
995 public void drawDrawable(GC gc, Drawable src, int xsrc, int ysrc, int xdest, int ydest, int width, int height)
997 // void gdk_draw_drawable (GdkDrawable *drawable, GdkGC *gc, GdkDrawable *src, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height);
998 gdk_draw_drawable(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), (src is null) ? null : src.getDrawableStruct(), xsrc, ysrc, xdest, ydest, width, height);
1002 * Draws a GdkImage onto a drawable.
1003 * The depth of the GdkImage must match the depth of the GdkDrawable.
1004 * drawable:
1005 * a GdkDrawable (a GdkWindow or a GdkPixmap).
1006 * gc:
1007 * a GdkGC.
1008 * image:
1009 * the GdkImage to draw.
1010 * xsrc:
1011 * the left edge of the source rectangle within image.
1012 * ysrc:
1013 * the top of the source rectangle within image.
1014 * xdest:
1015 * the x coordinate of the destination within drawable.
1016 * ydest:
1017 * the y coordinate of the destination within drawable.
1018 * width:
1019 * the width of the area to be copied, or -1 to make the area
1020 * extend to the right edge of image.
1021 * height:
1022 * the height of the area to be copied, or -1 to make the area
1023 * extend to the bottom edge of image.
1025 public void drawImage(GC gc, ImageGdk image, int xsrc, int ysrc, int xdest, int ydest, int width, int height)
1027 // void gdk_draw_image (GdkDrawable *drawable, GdkGC *gc, GdkImage *image, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height);
1028 gdk_draw_image(gdkDrawable, (gc is null) ? null : gc.getGCStruct(), (image is null) ? null : image.getImageGdkStruct(), xsrc, ysrc, xdest, ydest, width, height);
1032 * A GdkImage stores client-side image data (pixels). In contrast,
1033 * GdkPixmap and GdkWindow are server-side
1034 * objects. gdk_drawable_get_image() obtains the pixels from a
1035 * server-side drawable as a client-side GdkImage. The format of a
1036 * GdkImage depends on the GdkVisual of the current display, which
1037 * makes manipulating GdkImage extremely difficult; therefore, in
1038 * most cases you should use gdk_pixbuf_get_from_drawable() instead of
1039 * this lower-level function. A GdkPixbuf contains image data in a
1040 * canonicalized RGB format, rather than a display-dependent format.
1041 * Of course, there's a convenience vs. speed tradeoff here, so you'll
1042 * want to think about what makes sense for your application.
1043 * x, y, width, and height define the region of drawable to
1044 * obtain as an image.
1045 * You would usually copy image data to the client side if you intend
1046 * to examine the values of individual pixels, for example to darken
1047 * an image or add a red tint. It would be prohibitively slow to
1048 * make a round-trip request to the windowing system for each pixel,
1049 * so instead you get all of them at once, modify them, then copy
1050 * them all back at once.
1051 * If the X server or other windowing system backend is on the local
1052 * machine, this function may use shared memory to avoid copying
1053 * the image data.
1054 * If the source drawable is a GdkWindow and partially offscreen
1055 * or obscured, then the obscured portions of the returned image
1056 * will contain undefined data.
1057 * drawable:
1058 * a GdkDrawable
1059 * x:
1060 * x coordinate on drawable
1061 * y:
1062 * y coordinate on drawable
1063 * width:
1064 * width of region to get
1065 * height:
1066 * height or region to get
1067 * Returns:
1068 * a GdkImage containing the contents of drawable
1070 public ImageGdk getImage(int x, int y, int width, int height)
1072 // GdkImage* gdk_drawable_get_image (GdkDrawable *drawable, gint x, gint y, gint width, gint height);
1073 return new ImageGdk( gdk_drawable_get_image(gdkDrawable, x, y, width, height) );
1077 * Copies a portion of drawable into the client side image structure
1078 * image. If image is NULL, creates a new image of size width x height
1079 * and copies into that. See gdk_drawable_get_image() for further details.
1080 * drawable:
1081 * a GdkDrawable
1082 * image:
1083 * a GdkDrawable, or NULL if a new image should be created.
1084 * src_x:
1085 * x coordinate on drawable
1086 * src_y:
1087 * y coordinate on drawable
1088 * dest_x:
1089 * x coordinate within image. Must be 0 if image is NULL
1090 * dest_y:
1091 * y coordinate within image. Must be 0 if image is NULL
1092 * width:
1093 * width of region to get
1094 * height:
1095 * height or region to get
1096 * Returns:
1097 * image, or a new a GdkImage containing the contents
1098 * of drawable
1099 * Since 2.4
1101 public ImageGdk copyToImage(ImageGdk image, int srcX, int srcY, int destX, int destY, int width, int height)
1103 // 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);
1104 return new ImageGdk( gdk_drawable_copy_to_image(gdkDrawable, (image is null) ? null : image.getImageGdkStruct(), srcX, srcY, destX, destY, width, height) );