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
60 * - pango.PgFontDescription
61 * - pango.PgFontMetrics
62 * - pango.PgFontFamily
65 * - pango.PgFontsetSimple
67 * - pango.PgAttributeList
71 * - pango.PgLayoutIter
72 * - pango.PgScriptIter
74 * - GdkColor* -> Color
75 * - GdkColormap* -> Colormap
76 * - GdkDisplay* -> Display
77 * - GdkDrawable* -> Drawable
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
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
;
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
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
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()
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.
187 * a GdkDrawable (a GdkWindow or a GdkPixmap).
191 * TRUE if the polygon should be filled. The polygon is closed
192 * automatically, connecting the last point to the first point if
195 * an array of GdkPoint structures specifying the points making
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
);
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.)
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
) );
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.
231 public void drawableUnref()
233 // void gdk_drawable_unref (GdkDrawable *drawable);
234 gdk_drawable_unref(gdkDrawable
);
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.
245 * name to store the data under
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
);
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
265 * name the data was stored under
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.
280 * the GdkDisplay associated with drawable
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.
294 * the GdkScreen associated with drawable
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.
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.
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
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.
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.
374 * location to store drawable's width, or NULL
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
394 * a GdkRegion. This must be freed with gdk_region_destroy()
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
411 * a GdkRegion. This must be freed with gdk_region_destroy()
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
424 * a GdkDrawable (a GdkWindow or a GdkPixmap).
428 * the x coordinate of the point.
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.
442 * a GdkDrawable (a GdkWindow or a GdkPixmap).
446 * an array of GdkPoint structures.
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
460 * a GdkDrawable (a GdkWindow or a GdkPixmap).
464 * the x coordinate of the start point.
466 * the y coordinate of the start point.
468 * the x coordinate of the end point.
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().
484 * a GdkDrawable (a GdkWindow or a GdkPixmap).
488 * an array of GdkPoint structures specifying the endpoints of the
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
509 * Destination drawable.
511 * a GdkGC, used for clipping, or NULL
515 * Source X coordinate within pixbuf.
517 * Source Y coordinates within pixbuf.
519 * Destination X coordinate within drawable.
521 * Destination Y coordinate within drawable.
523 * Width of region to render, in pixels, or -1 to use pixbuf width.
525 * Height of region to render, in pixels, or -1 to use pixbuf height.
527 * Dithering mode for GdkRGB.
529 * X offset for dither.
531 * Y offset for dither.
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.
543 * a GdkDrawable (a GdkWindow or a GdkPixmap).
547 * an array of GdkSegment structures specifying the start and
548 * end points of the lines to be drawn.
550 * the number of line segments to draw, i.e. the size of the
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.
572 * a GdkDrawable (a GdkWindow or a GdkPixmap).
576 * TRUE if the rectangle should be filled.
578 * the x coordinate of the left edge of the rectangle.
580 * the y coordinate of the top edge of the rectangle.
582 * the width of the rectangle.
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.
597 * a GdkDrawable (a GdkWindow or a GdkPixmap).
601 * TRUE if the arc should be filled, producing a 'pie slice'.
603 * the x coordinate of the left edge of the bounding rectangle.
605 * the y coordinate of the top edge of the bounding rectangle.
607 * the width of the bounding rectangle.
609 * the height of the bounding rectangle.
611 * the start angle of the arc, relative to the 3 o'clock position,
612 * counter-clockwise, in 1/64ths of a degree.
614 * the end angle of the arc, relative to angle1, in 1/64ths
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.
626 * a GdkDrawable (a GdkWindow or a GdkPixmap).
630 * TRUE if the polygon should be filled. The polygon is closed
631 * automatically, connecting the last point to the first point if
634 * an array of GdkPoint structures specifying the points making
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.
656 * an array of GdkTrapezoid structures
658 * the number of trapezoids to draw
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.
683 * X coordinate of baseline origin
685 * Y coordinate of baseline origin
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().
708 * a PangoMatrix, or NULL to use an identity transformation
710 * the font in which to draw the string
712 * the x position of the start of the string (in Pango
713 * units in user space coordinates)
715 * the y position of the baseline (in Pango units
716 * in user space coordinates)
718 * the glyph string to draw
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.
734 * the drawable on which to draw the line
736 * base graphics to use
738 * the x position of start of string (in pixels)
740 * the y position of baseline (in pixels)
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.
759 * the drawable on which to draw the line
761 * base graphics to use
763 * the x position of start of string (in pixels)
765 * the y position of baseline (in pixels)
769 * foreground override color, or NULL for none
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().
787 * the drawable on which to draw string
789 * base graphics context to use
791 * the X position of the left of the layout (in pixels)
793 * the Y position of the top of the layout (in pixels)
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().
813 * the drawable on which to draw string
815 * base graphics context to use
817 * the X position of the left of the layout (in pixels)
819 * the Y position of the top of the layout (in pixels)
823 * foreground override color, or NULL for none
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());
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.
838 * a GdkDrawable (a GdkWindow or a GdkPixmap).
844 * the x coordinate of the left edge of the text.
846 * the y coordinate of the baseline of the text.
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
));
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.
861 * a GdkDrawable (a GdkWindow or a GdkPixmap).
867 * the x coordinate of the left edge of the text.
869 * the y coordinate of the baseline of the text.
871 * the characters to draw.
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
);
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.
888 * a GdkDrawable (a GdkWindow or a GdkPixmap).
894 * the x coordinate of the left edge of the text.
896 * the y coordinate of the baseline of the text.
898 * the wide characters to draw.
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.
926 * a GdkGC sharing the drawable's visual and colormap
928 * the source GdkDrawable, which may be the same as drawable
930 * X position in src of rectangle to draw
932 * Y position in src of rectangle to draw
934 * X position in drawable where the rectangle should be drawn
936 * Y position in drawable where the rectangle should be drawn
938 * width of rectangle to draw, or -1 for entire src width
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.
952 * a GdkDrawable (a GdkWindow or a GdkPixmap).
956 * the GdkImage to draw.
958 * the left edge of the source rectangle within image.
960 * the top of the source rectangle within image.
962 * the x coordinate of the destination within drawable.
964 * the y coordinate of the destination within drawable.
966 * the width of the area to be copied, or -1 to make the area
967 * extend to the right edge of image.
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
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.
1007 * x coordinate on drawable
1009 * y coordinate on drawable
1011 * width of region to get
1013 * height or region to get
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.
1030 * a GdkDrawable, or NULL if a new image should be created.
1032 * x coordinate on drawable
1034 * y coordinate on drawable
1036 * x coordinate within image. Must be 0 if image is NULL
1038 * y coordinate within image. Must be 0 if image is NULL
1040 * width of region to get
1042 * height or region to get
1044 * image, or a new a GdkImage containing the contents
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
) );