This package provides support for drawing points, lines, arcs and text onto what are called 'drawables'. Drawables, as the name suggests, are things which support drawing onto them, and are either Gdk_Window or Gdk_Pixmap objects.
Many of the drawing operations take a Gdk_GC argument, which represents a graphics context. This Gdk_GC contains a number of drawing attributes such as foreground color, background color and line width, and is used to reduce the number of arguments needed for each drawing operation. see section Package Gdk.GC for more information.
Types |
---|
subtype Gdk_Drawable is Gdk.Gdk_Drawable; | |
A screen area that can be drawn upon.
|
Subprograms |
---|
function Get_Type return Glib.GType; | ||
Return the internal value associated with a Gdk_Drawable.
| ||
procedure Get_Size (Drawable : Gdk_Drawable; Width : out Gint; Height : out Gint); | ||
Return the width and height of a given drawable.
| ||
procedure Set_Colormap (Drawable : Gdk_Drawable; Colormap : Gdk.Gdk_Colormap); | ||
| ||
function Get_Colormap (Drawable : Gdk_Drawable) return Gdk.Gdk_Colormap; | ||
| ||
function Get_Visual (Drawable : Gdk_Drawable) return Gdk.Gdk_Visual; | ||
| ||
function Get_Depth (Drawable : Gdk_Drawable) return Gdk.Gdk_Visual; | ||
| ||
procedure Ref (Drawable : Gdk_Drawable); | ||
| ||
procedure Unref (Drawable : Gdk_Drawable); | ||
| ||
procedure Draw_Point (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; X : Gint; Y : Gint); | ||
Draw a point, using the foreground color and other attributes of the Gc.
| ||
procedure Draw_Line (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; X1 : Gint; Y1 : Gint; X2 : Gint; Y2 : Gint); | ||
Draw a line, using the foreground color and other attributes of the Gc. | ||
procedure Draw_Rectangle (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Filled : Boolean := False; X : Gint; Y : Gint; Width : Gint; Height : Gint); | ||
Draw a rectangular outline or filled rectangle.
(X, Y) represents the coordinate of the top-left edge of the rectangle.
| ||
procedure Draw_Arc (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Filled : Boolean := False; X : Gint; Y : Gint; Width : Gint; Height : Gint; Angle1 : Gint; Angle2 : Gint); | ||
Draws an arc or a filled 'pie slice'. | ||
procedure Draw_Polygon (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Filled : Boolean; Points : Gdk.Types.Gdk_Points_Array); | ||
Draw an outlined or filled polygon. | ||
procedure Draw_Text (Drawable : Gdk_Drawable; Font : Gdk.Gdk_Font; Gc : Gdk.Gdk_GC; X : Gint; Y : Gint; Text : UTF8_String); | ||
Draw a string in the given font or fontset.
You should use Gtk.Widget.Create_Pango_Layout instead to handle
internationalization.
| ||
procedure Draw_Text (Drawable : Gdk_Drawable; Font : Gdk.Gdk_Font; Gc : Gdk.Gdk_GC; X : Gint; Y : Gint; Wide_Text : Gdk.Types.Gdk_WString); | ||
Draw a wide string in the given font of fontset. | ||
procedure Draw_Drawable (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Src : Gdk_Drawable; Xsrc : Gint; Ysrc : Gint; Xdest : Gint; Ydest : Gint; Width : Gint := -1; Height : Gint := -1); | ||
Draw a pixmap, or a part of a pixmap, onto another drawable. | ||
procedure Draw_Layout (Drawable : Gdk_Drawable; GC : Gdk.Gdk_GC; X : Gint; Y : Gint; Layout : Pango.Layout.Pango_Layout); | ||
Display the layout and its text in Drawable. This method should be | ||
procedure Draw_Pixmap (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Src : Gdk_Drawable; Xsrc : Gint; Ysrc : Gint; Xdest : Gint; Ydest : Gint; Width : Gint := -1; Height : Gint := -1); | ||
Deprecated, use Draw_Drawable instead.
| ||
procedure Draw_Image (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Image : Gdk.Gdk_Image; Xsrc : Gint; Ysrc : Gint; Xdest : Gint; Ydest : Gint; Width : Gint := -1; Height : Gint := -1); | ||
Draw a Gdk_Image onto a Drawable. | ||
procedure Draw_Points (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Points : Gdk.Types.Gdk_Points_Array); | ||
Draw a number of points. | ||
procedure Draw_Segments (Drawable : in Gdk_Drawable; Gc : in Gdk.Gdk_GC; Segs : in Gdk.Types.Gdk_Segments_Array); | ||
Draw a number of unconnected lines.
| ||
procedure Draw_Lines (Drawable : Gdk_Drawable; Gc : Gdk.Gdk_GC; Points : Gdk.Types.Gdk_Points_Array); | ||
Draw a series of lines connecting the given points. | ||
function Get_Image (Drawable : Gdk_Drawable; X : Gint; Y : Gint; Width : Gint; Height : Gint) return Gdk_Image; | ||
| ||
function Get_Clip_Region (Drawable : Gdk_Drawable) return Gdk.Gdk_Region; | ||
| ||
function Get_Visible_Region (Drawable : Gdk_Drawable) return Gdk.Gdk_Region; | ||
|
Example |
---|
with Glib; with Gdk.Window; with Gdk.Drawable; with Gdk.GC; with Gdk.Font; with Gtk.Drawing_Area; procedure Draw (Drawing : in out Gtk.Drawing_Area.Gtk_Drawing_Area) is Gdkw : Gdk.Window.Gdk_Window; GC : Gdk.GC.Gdk_GC; Font : Gdk.Font.Gdk_Font; use type Glib.Gint; begin -- Get the Gdk window Gdkw := Gtk.Drawing_Area.Get_Window (Drawing); -- Clear the window Gdk.Window.Clear (Gdkw); -- Create a graphic context associated with this window Gdk.GC.Gdk_New (GC, Gdkw); -- Draw a line in this window Gdk.Drawable.Draw_Line (Drawable => Gdkw, GC => GC, X1 => 0, Y1 => 0, X2 => 100, Y2 => 100); -- Draw an arc Gdk.Drawable.Draw_Arc (Drawable => Gdkw, Gc => GC, Filled => True, X => 100, Y => 100, Width => 200, Height => 100, Angle1 => 0 * 64, Angle2 => 270 * 64); -- Ask for a given font Gdk.Font.Load (Font, "-adobe-courier-medium-i-*-*-15-*-*-*-*-*-*-*"); Gdk.Drawable.Draw_Text (Drawable => Gdkw, Font => Font, Gc => GC, X => 50, Y => 50, Text => "Hello World"); Gdk.GC.Destroy (GC); end Draw;