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
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
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
;
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
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
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()
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
)
195 if ( gdkDrawable
is null )
200 Stdout("struct gdkDrawable is null on constructor").newline
;
204 printf("struct gdkDrawable is null on constructor");
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.
220 * a GdkDrawable (a GdkWindow or a GdkPixmap).
224 * TRUE if the polygon should be filled. The polygon is closed
225 * automatically, connecting the last point to the first point if
228 * an array of GdkPoint structures specifying the points making
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(),
248 pixbuf
.getWidth(), pixbuf
.getHeight(),
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.)
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
) );
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.
286 // void gdk_drawable_unref (GdkDrawable *drawable);
287 gdk_drawable_unref(gdkDrawable
);
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.
298 * name to store the data under
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
);
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
318 * name the data was stored under
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.
333 * the GdkDisplay associated with drawable
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.
347 * the GdkScreen associated with drawable
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.
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.
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
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.
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.
427 * location to store drawable's width, or NULL
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
447 * a GdkRegion. This must be freed with gdk_region_destroy()
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
464 * a GdkRegion. This must be freed with gdk_region_destroy()
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
477 * a GdkDrawable (a GdkWindow or a GdkPixmap).
481 * the x coordinate of the point.
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.
495 * a GdkDrawable (a GdkWindow or a GdkPixmap).
499 * an array of GdkPoint structures.
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
513 * a GdkDrawable (a GdkWindow or a GdkPixmap).
517 * the x coordinate of the start point.
519 * the y coordinate of the start point.
521 * the x coordinate of the end point.
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().
537 * a GdkDrawable (a GdkWindow or a GdkPixmap).
541 * an array of GdkPoint structures specifying the endpoints of the
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
562 * Destination drawable.
564 * a GdkGC, used for clipping, or NULL
568 * Source X coordinate within pixbuf.
570 * Source Y coordinates within pixbuf.
572 * Destination X coordinate within drawable.
574 * Destination Y coordinate within drawable.
576 * Width of region to render, in pixels, or -1 to use pixbuf width.
578 * Height of region to render, in pixels, or -1 to use pixbuf height.
580 * Dithering mode for GdkRGB.
582 * X offset for dither.
584 * Y offset for dither.
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.
596 * a GdkDrawable (a GdkWindow or a GdkPixmap).
600 * an array of GdkSegment structures specifying the start and
601 * end points of the lines to be drawn.
603 * the number of line segments to draw, i.e. the size of the
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.
625 * a GdkDrawable (a GdkWindow or a GdkPixmap).
629 * TRUE if the rectangle should be filled.
631 * the x coordinate of the left edge of the rectangle.
633 * the y coordinate of the top edge of the rectangle.
635 * the width of the rectangle.
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.
650 * a GdkDrawable (a GdkWindow or a GdkPixmap).
654 * TRUE if the arc should be filled, producing a 'pie slice'.
656 * the x coordinate of the left edge of the bounding rectangle.
658 * the y coordinate of the top edge of the bounding rectangle.
660 * the width of the bounding rectangle.
662 * the height of the bounding rectangle.
664 * the start angle of the arc, relative to the 3 o'clock position,
665 * counter-clockwise, in 1/64ths of a degree.
667 * the end angle of the arc, relative to angle1, in 1/64ths
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.
679 * a GdkDrawable (a GdkWindow or a GdkPixmap).
683 * TRUE if the polygon should be filled. The polygon is closed
684 * automatically, connecting the last point to the first point if
687 * an array of GdkPoint structures specifying the points making
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.
709 * an array of GdkTrapezoid structures
711 * the number of trapezoids to draw
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.
736 * X coordinate of baseline origin
738 * Y coordinate of baseline origin
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().
761 * a PangoMatrix, or NULL to use an identity transformation
763 * the font in which to draw the string
765 * the x position of the start of the string (in Pango
766 * units in user space coordinates)
768 * the y position of the baseline (in Pango units
769 * in user space coordinates)
771 * the glyph string to draw
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.
787 * the drawable on which to draw the line
789 * base graphics to use
791 * the x position of start of string (in pixels)
793 * the y position of baseline (in pixels)
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.
812 * the drawable on which to draw the line
814 * base graphics to use
816 * the x position of start of string (in pixels)
818 * the y position of baseline (in pixels)
822 * foreground override color, or NULL for none
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().
840 * the drawable on which to draw string
842 * base graphics context to use
844 * the X position of the left of the layout (in pixels)
846 * the Y position of the top of the layout (in pixels)
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().
866 * the drawable on which to draw string
868 * base graphics context to use
870 * the X position of the left of the layout (in pixels)
872 * the Y position of the top of the layout (in pixels)
876 * foreground override color, or NULL for none
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());
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.
891 * a GdkDrawable (a GdkWindow or a GdkPixmap).
897 * the x coordinate of the left edge of the text.
899 * the y coordinate of the baseline of the text.
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
));
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.
914 * a GdkDrawable (a GdkWindow or a GdkPixmap).
920 * the x coordinate of the left edge of the text.
922 * the y coordinate of the baseline of the text.
924 * the characters to draw.
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
);
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.
941 * a GdkDrawable (a GdkWindow or a GdkPixmap).
947 * the x coordinate of the left edge of the text.
949 * the y coordinate of the baseline of the text.
951 * the wide characters to draw.
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.
979 * a GdkGC sharing the drawable's visual and colormap
981 * the source GdkDrawable, which may be the same as drawable
983 * X position in src of rectangle to draw
985 * Y position in src of rectangle to draw
987 * X position in drawable where the rectangle should be drawn
989 * Y position in drawable where the rectangle should be drawn
991 * width of rectangle to draw, or -1 for entire src width
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.
1005 * a GdkDrawable (a GdkWindow or a GdkPixmap).
1009 * the GdkImage to draw.
1011 * the left edge of the source rectangle within image.
1013 * the top of the source rectangle within image.
1015 * the x coordinate of the destination within drawable.
1017 * the y coordinate of the destination within drawable.
1019 * the width of the area to be copied, or -1 to make the area
1020 * extend to the right edge of image.
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
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.
1060 * x coordinate on drawable
1062 * y coordinate on drawable
1064 * width of region to get
1066 * height or region to get
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.
1083 * a GdkDrawable, or NULL if a new image should be created.
1085 * x coordinate on drawable
1087 * y coordinate on drawable
1089 * x coordinate within image. Must be 0 if image is NULL
1091 * y coordinate within image. Must be 0 if image is NULL
1093 * width of region to get
1095 * height or region to get
1097 * image, or a new a GdkImage containing the contents
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
) );