This is gtkada_rm.info, produced by makeinfo version 4.5 from gtkada_rm.texi. INFO-DIR-SECTION User Interface Toolkit START-INFO-DIR-ENTRY * GtkAda_Rm: (gtkada_rm). Ada95 graphical tookit based on GTK+ (Reference Manual) END-INFO-DIR-ENTRY  File: gtkada_rm.info, Node: Gdk.Font Subprograms, Prev: Gdk.Font Types, Up: Package_Gdk.Font Subprograms =========== function Get_Type return Glib.GType; Return the internal value associated with Gdk_Font. procedure Load (Font : out Gdk_Font; Font_Name : String); Load a new font, given its name. This is the first step before using a font. The font is first looked up in the cache, and if it was already loaded, it is not reloaded again. Thus, it does not harm to call this function multiple times with the same Font_Name. Null_Font is returned if the font could not be loaded. See From_Description below for another way of creating a Gdk_Font. procedure Fontset_Load (Font : out Gdk_Font; Fontset_Name : String); Load a new font set. Fontset_Name is a comma-separated list of fonts that will be loaded as part of the fontset. function From_Description (Font_Desc : Pango.Font.Pango_Font_Description) return Gdk.Font.Gdk_Font; Create a new Gdk_Font from the given Pango_Font_Description. This is a convenient function to create fonts from, because a Pango_Font_Description is a higher level description of a font attributes. procedure Ref (Font : Gdk_Font); Increment the reference counter for the font. You should not make any assumption of the initial value of the fonts returned by Load or Fontset_Load, since these can be extracted from a cache. procedure Unref (Font : Gdk_Font); Decrement the reference counter for the font. When this counter reaches 0, the font is deleted from memory. function Id (Font : Gdk_Font) return Gint; Return the X font id for the font. This Id will only be needed if you want to call directly X11 functions, you won't need it with GtkAda. function Equal (Fonta, Fontb : Gdk_Font) return Boolean; Compare two fonts or two fontsets for equality. Two fonts are equal if they have the same font Id. Two fontsets are equal if the name given to Fontset_Load was the same. function Get_Ascent (Font : Gdk_Font) return Gint; Return the maximal ascent for the font. This is the logical extent above the baseline for spacing between two lines. function Get_Descent (Font : Gdk_Font) return Gint; Return the maximal descent for the font. This is the logical extent below the baseline for spacing between two lines. function String_Width (Font : Gdk_Font; Str : String) return Gint; Return the width in pixels that Str will occupy if drawn with Font. The value returned is the distance between the origin of the text and the position at which the next string should be drawn. function String_Width (Font : Gdk_Font; Text : Gdk.Types.Gdk_WString) return Gint; Return the width in pixels that Text will occupy on the screen. This function should be used with strings that contain Unicode characters function Char_Width (Font : Gdk_Font; Char : Character) return Gint; Return the width in pixels occupied by a single character on the screen. The value returned is the distance between Char's origin on the screen and the origin of the next character in the string. function Char_Width (Font : Gdk_Font; Char : Gdk.Types.Gdk_WChar) return Gint; Return the width in pixels occupied by a single wide-character. function String_Measure (Font : Gdk_Font; Str : String) return Gint; Determine the distance from the origin to the rightmost portion of Str. This is not the correct value for determining the origin of the next portion when drawing text in multiple pieces. See String_Width instead. function Char_Measure (Font : Gdk_Font; Char : Character) return Gint; Return the width in pixels of Char. As opposed to Char_Width, the value returned is not the distance at which the next character should be drawn. This is also called the right bearing of the character. function String_Height (Font : Gdk_Font; Str : String) return Gint; Return the height in pixels of the string. This is the total height, and you can not easily tell how this height is split around the baseline. function Char_Height (Font : Gdk_Font; Char : Character) return Gint; Return the total height in pixels of a single character. procedure String_Extents (Font : Gdk.Font.Gdk_Font; Str : String; Lbearing : out Gint; Rbearing : out Gint; Width : out Gint; Ascent : out Gint; Descent : out Gint); Return the metrics for a given text. See the picture for more explanations on all the fields. Lbearing : Origin to left edge of character. Rbearing : Origin to right edge of character. Width : Advance to next character's origin. Ascent : Baseline to top edge of character. Descent : Baseline to bottom edge of character. procedure String_Extents (Font : Gdk_Font; Text : Gdk.Types.Gdk_WString; Lbearing : out Gint; Rbearing : out Gint; Width : out Gint; Ascent : out Gint; Descent : out Gint); Return all the metrics for a given wide-character string. See the picture for more explanations on the returned values.  File: gtkada_rm.info, Node: Package_Gdk.GC, Next: Package_Gdk.Main, Prev: Package_Gdk.Font, Up: Top Package Gdk.GC ************** A graphic context is a structure that describes all the attributes used by the drawing functions in Gdk. The colors, line styles, Fill styles and so on are defined through this structure. On X11 systems, this structure is stored directly on the XServer, which speeds up the transfer of the drawing attributes a lot. Instead of transferring all of them every time you call one of the drawing functions, you simply specify which GC you want to use. Thus, it is recommended to create as many GCs as you need, instead of creating a single one that is modified every time you need to modify one of the attributes. On Unix machines, you should have a look at the external utility 'xgc' which demonstrates all the basic settings of the graphic contexts. * Menu: * Gdk.GC Types:: * Gdk.GC Subprograms::  File: gtkada_rm.info, Node: Gdk.GC Types, Next: Gdk.GC Subprograms, Up: Package_Gdk.GC Types ===== type Gdk_Cap_Style is (Cap_Not_Last, Cap_Butt, Cap_Round, Cap_Projecting); type Gdk_Fill is (Solid, Tiled, Stippled, Opaque_Stippled); type Gdk_Function is (Copy, Invert, Gdk_Xor, Clear, Gdk_And, And_Reverse, And_Invert, Noop, Gdk_Or, Equiv, Or_Reverse, Copy_Invert, Or_Invert, Nand, Set); subtype Gdk_GC is Gdk.Gdk_GC; A graphic context that contain all the information to draw graphics on the screen. Creating these GC is more efficient than passing a lot of parameters to each of the drawing functions, since these GC are stored on the server side and do not need to be pass through the network. type Gdk_GC_Values is new Gdk.C_Proxy; A structure used on the client side to store the same information as the GC. Creating a GC from this structure is more efficient than calling a lot of functions to modify the GC directly, since there is a single call to the server. type Gdk_GC_Values_Mask is mod 2 ** 32; type Gdk_Join_Style is (Join_Miter, Join_Round, Join_Bevel); type Gdk_Line_Style is (Line_Solid, Line_On_Off_Dash, Line_Double_Dash); type Gdk_Subwindow_Mode is (Clip_By_Children, Include_Inferiors);  File: gtkada_rm.info, Node: Gdk.GC Subprograms, Prev: Gdk.GC Types, Up: Package_Gdk.GC Subprograms =========== Gdk_GC ------ procedure Gdk_New (GC : out Gdk_GC; Drawable : Gdk.Gdk_Drawable); Create a new graphic context. The window must have been realized first (so that it is associated with some resources on the Xserver). The GC can then be used for any window that has the same root window, and same color depth as Window. See the manual page for XCreateGC on Unix systems for more information. procedure Gdk_New (GC : out Gdk_GC; Drawable : Gdk.Gdk_Drawable; Values : Gdk_GC_Values; Values_Mask : Gdk_GC_Values_Mask); Create a new graphic context. It is directly created with the values set in Values, and whose associated field has been set in Values_Mask. This is faster than calling the simple Gdk_New function and each of other functions in this package, since each of them requires a call to the server. function Get_Type return Glib.GType; Return the internal value associated with Gdk_GC. procedure Destroy (GC : Gdk_GC); Free the memory allocated on the server for the graphic context. Graphic contexts are never freed automatically by GtkAda, this is the user responsibility to do so. This procedure is deprecated. Use Unref instead. procedure Ref (GC : Gdk_GC); Increment the reference counting for the graphic context. procedure Unref (GC : Gdk_GC); Decrement the reference counting for the graphic context. When this reaches 0, the graphic context is destroyed. procedure Get_Values (GC : Gdk_GC; Values : Gdk_GC_Values); Get the values set in the GC. This copies the values from the server to client, allowing faster modifications. Values can then be copied back to the server by creating a new graphic context with the function Gdk_New above. Values should have been allocated first with a call to Gdk_New. procedure Set_Values (GC : Gdk_GC; Values : Gdk_GC_Values; Mask : Gdk_GC_Values_Mask); Set the values in the GC. Mask indicates which values should be taken from Values and set in GC. procedure Set_Foreground (GC : Gdk_GC; Color : Gdk.Color.Gdk_Color); Set the foreground color for the graphic context. This color is the one that is used by most drawing functions. procedure Set_Background (GC : Gdk_GC; Color : Gdk.Color.Gdk_Color); Set the background color for the graphic context. procedure Set_Font (GC : Gdk_GC; Font : Gdk.Font.Gdk_Font); Set the font used by the graphic context. This font is used by the function Gdk.Drawable.Draw_Text. procedure Set_Function (GC : Gdk_GC; Func : Gdk_Function); Set the function in the graphic context. This function specifies how the points are put on the screen, ie if GtkAda how GtkAda should mix the point already on the screen and the new point being put. Note that setting the function to Gdk_Xor is not the right way to do animation. You should instead save the background pixmap, put the image, and then restore the background. In general, there are three basic steps to drawing: reading the source pixels, reading the destination pixels, and writing the destination pixels. Some functions only perform the third step (Set and Clear), some do not need the middle step (Copy), whereas most require the three steps, and thus can be much slower. procedure Set_Fill (GC : Gdk_GC; Fill : Gdk_Fill); Set the pattern used for filling the polygons. procedure Set_Tile (GC : Gdk_GC; Tile : Gdk.Gdk_Pixmap); procedure Set_Stipple (GC : Gdk_GC; Stipple : Gdk.Gdk_Pixmap); procedure Set_Ts_Origin (GC : Gdk_GC; X, Y : Gint); Set the Tile and Stipple origin in the graphic context. procedure Set_Clip_Origin (GC : Gdk_GC; X, Y : Gint); Set the origin of the clip mask. See the functions Set_Clip_Rectangle, Set_Clip_Region and Gdk.Bitmap.Set_Clip_Mask for more explanation. procedure Set_Clip_Mask (GC : Gdk.GC.Gdk_GC; Mask : Gdk.Gdk_Bitmap); If Mask is set to Null_Bitmap, then no clip_mask is used for drawing. Points will be drawn through this GC only where the bits are set to 1 in the mask. See also the function Set_Clip_Origin for how to move the mask inside the GC. procedure Set_Clip_Rectangle (GC : Gdk_GC; Rectangle : Gdk.Rectangle.Gdk_Rectangle); procedure Set_Clip_Region (GC : Gdk_GC; Region : Gdk.Region.Gdk_Region); Define a clip region on the screen. This is just like Set_Clip_Rectangle, except that a region is a more complex region, that can be the intersection or union of multiple rectangles. Note that the Clip_Origin can have an influence on this function. procedure Set_Subwindow (GC : Gdk_GC; Mode : Gdk_Subwindow_Mode); Set the subwindow mode for the graphic context. This specifies whether the drawing routines should be clipped to the specific window they are drawn into, or if they should extend to subwindows as well. procedure Set_Exposures (GC : Gdk_GC; Exposures : Boolean); Exposures indicates whether you want "expose" and "noexpose" events to be reported when calling Copy_Area and Copy_Plane with this GC. You should disable this if you don't need the event and want to optimize your application. If Exposures is True, then any call to Copy_Area or Draw_Pixmap will generate an expose event. Otherwise, these will generate a no_expose event. procedure Set_Line_Attributes (GC : Gdk_GC; Line_Width : Gint; Line_Style : Gdk_Line_Style; Cap_Style : Gdk_Cap_Style; Join_Style : Gdk_Join_Style); Set the line attributes for this GC. Line_Width is the width of the line. If its value is 0, the line is as thin as possible, possibly even more so than if the width is 1. It is also faster to draw a line with width 0 than any other line width. Line_Style specifies whether the line should be solid or dashed. With Line_On_Off_Dash, the colors are alternatively the foreground color, and blank. With Line_Double_Dash, the colors are alternatively the foreground and background colors. Cap_Style specifies how the line should end, either flat or rounded. Join_Style specifies how two consecutive lines drawn by Draw_Lines are connected. procedure Set_Dashes (Gc : Gdk_GC; Dash_Offset : Gint; Dash_List : Guchar_Array); Specify the dash pattern when the line's style is anything but solid. The values in the array alternatively give the length (in pixels) of the plain dash, the empty dash, the second plain dash, ... None of these values can be 0. If there is an odd number of items in Dash_List, this is equivalent to giving the array concatenated with itself. Dash_Offset specifies the phase of the pattern to start with. procedure Copy (Dst_GC : Gdk_GC; Src_GC : Gdk_GC); Copy a Src_GC to Dst_GC. procedure Set_Colormap (Gc : Gdk_GC; Colormap : Gdk.Gdk_Colormap); function Get_Colormap (Gc : Gdk_GC) return Gdk.Gdk_Colormap; procedure Set_Rgb_Fg_Color (Gc : Gdk_GC; Color : Gdk.Color.Gdk_Color); procedure Set_Rgb_Bg_Color (Gc : Gdk_GC; Color : Gdk.Color.Gdk_Color); Gdk_Color_Values ---------------- function Gdk_New return Gdk_GC_Values; Allocate a new Values structure on the client. Note that this function allocates a C structure, and thus needs to be freed with a call to Free below. procedure Free (Values : Gdk_GC_Values); Free the C structure associated with Values. procedure Set_Foreground (Values : Gdk_GC_Values; Color : Gdk.Color.Gdk_Color); Same as Set_Foreground, but on the client side procedure Set_Background (Values : Gdk_GC_Values; Color : Gdk.Color.Gdk_Color); Same as Set_Background, but on the client side procedure Set_Font (Values : Gdk_GC_Values; Font : Gdk.Font.Gdk_Font); Same as Set_Font, but on the client side procedure Set_Function (Values : Gdk_GC_Values; Func : Gdk_Function); Same as Set_Function, but on the client side procedure Set_Fill (Values : Gdk_GC_Values; Fill : Gdk_Fill); Same as Set_Fill, but on the client side procedure Set_Ts_Origin (Values : Gdk_GC_Values; X, Y : Gint); Same as Set_Ts_Origin, but on the client side procedure Set_Clip_Origin (Values : Gdk_GC_Values; X, Y : Gint); Same as Set_Clip_Origin, but on the client side procedure Set_Subwindow (Values : Gdk_GC_Values; Mode : Gdk_Subwindow_Mode); Same as Set_Subwindow, but on the client side procedure Set_Exposures (Values : Gdk_GC_Values; Exposures : Boolean); Same as Set_Exposures, but on the client side procedure Set_Line_Attributes (Values : Gdk_GC_Values; Line_Width : Gint; Line_Style : Gdk_Line_Style; Cap_Style : Gdk_Cap_Style; Join_Style : Gdk_Join_Style); Same as Set_Line_Attributes, but on the client side  File: gtkada_rm.info, Node: Package_Gdk.Main, Next: Package_Gdk.Pixbuf, Prev: Package_Gdk.GC, Up: Top Package Gdk.Main **************** This package provides routines to handle initialization and set up of the Gdk library. * Menu: * Gdk.Main Types:: * Gdk.Main Subprograms::  File: gtkada_rm.info, Node: Gdk.Main Types, Next: Gdk.Main Subprograms, Up: Package_Gdk.Main Types ===== type Gdk_Grab_Status is (Grab_Success, Grab_Already_Grabbed, Gdk_Grab_Invalid_Time, Gdk_Grab_Not_Viewable, Gdk_Grab_Frozen);  File: gtkada_rm.info, Node: Gdk.Main Subprograms, Prev: Gdk.Main Types, Up: Package_Gdk.Main Subprograms =========== procedure Init; Initialize the library for use. The command line arguments are modified to reflect any arguments which were not handled. (Such arguments should either be handled by the application or dismissed). procedure Gdk_Exit (Error_Code : Gint); Restore the library to an un-itialized state and exits the program using the "exit" system call. Error_Code is the error value to pass to "exit". Allocated structures are freed and the program exits cleanly. This function is deprecated. function Set_Locale return String; Initialize handling of internationalization of strings. *note Package_Gtkada.Intl:: for more details. procedure Set_Locale; Drops the string returned by the Set_Locale function; procedure Set_Use_Xshm (Use_Xshm : Boolean := True); Set whether shared memory (when supported by the graphic server) should be used. function Get_Use_Xshm return Boolean; Return whether shared memory on the graphic server is used. function Get_Display return String; Return the name of the display. function Pointer_Grab (Window : Gdk.Window.Gdk_Window; Owner_Events : Boolean := True; Event_Mask : Gdk.Event.Gdk_Event_Mask; Confine_To : Gdk.Window.Gdk_Window := Gdk.Window.Null_Window; Cursor : Gdk.Cursor.Gdk_Cursor := Gdk.Cursor.Null_Cursor; Time : Guint32) return Gdk_Grab_Status; Grab the pointer to a specific window. * Window is the window which will receive the grab * Owner_Events specifies whether events will be reported as is, or relative to Window * Event_Mask masks only interesting events * Confine_To limits the cursor movement to the specified window * Cursor changes the cursor for the duration of the grab * Time specifies the time Requires a corresponding call to Pointer_Ungrab procedure Pointer_Ungrab (Time : Guint32); Release any pointer grab. function Pointer_Is_Grabbed return Boolean; Tell wether there is an active pointer grab in effect. function Keyboard_Grab (Window : Gdk.Window.Gdk_Window; Owner_Events : Boolean := True; Time : Guint32) return Gdk_Grab_Status; Grab the keyboard to a specific window. * Window is the window which will receive the grab * Owner_Events specifies whether events will be reported as is, or relative to Window * Time specifies the time Requires a corresponding call to Keyboard_Ungrab procedure Keyboard_Ungrab (Time : Guint32); Release any keyboard grab. function Screen_Width return Gint; Return the width of the screen. function Screen_Height return Gint; Return the height of the screen. function Screen_Width_MM return Gint; Return the width of the screen in millimeters. function Screen_Height_MM return Gint; Return the height of the screen in millimeters. procedure Flush; Flush the queue of graphic events and then wait until all requests have been received and processed. procedure Beep; Emit a beep. procedure Set_Double_Click_Time (Msec : Guint);  File: gtkada_rm.info, Node: Package_Gdk.Pixbuf, Next: Package_Gdk.Pixmap, Prev: Package_Gdk.Main, Up: Top Package Gdk.Pixbuf ****************** This object provides image manipulation routines. The following image formats are known, but some depend on external libraries for the proper loading of files (indicated with * in the list): PNG*, JPEG*, TIFF*, GIF, XPM, PNM, Sun raster file (ras), ico, bmp. With this package, you can load images from file, display them on the screen, re-scale them and compose them with other images. All the functions fully support alpha channels (opacity). Different filters are provided, depending on the quality of output you expect and the speed you need. * Menu: * Gdk.Pixbuf Types:: * Gdk.Pixbuf Subprograms::  File: gtkada_rm.info, Node: Gdk.Pixbuf Types, Next: Gdk.Pixbuf Subprograms, Up: Package_Gdk.Pixbuf Types ===== type Alpha_Mode is (Alpha_Bilevel, Alpha_Full); Alpha compositing mode. This indicates how the alpha channel (for opacity) is handled when rendering. pragma Convention (C, Alpha_Mode); type Alpha_Range is range 0 .. 255; Valid values for alpha parameters. pragma Convention (C, Alpha_Range); type File_Format is (JPEG, PNG); Possible formats when saving a file. type Gdk_Colorspace is (Colorspace_RGB); Type of the image. The only possible value is currently RGB, but extensions will exist with CMYK, Gray, Lab, ... pragma Convention (C, Gdk_Colorspace); type Gdk_Interp_Type is (Interp_Nearest, -- Nearest neighbor. It is the fastest and lowest quality. Interp_Tiles, -- Accurate simulation of the Postscript image operator -- without any interpolation enabled; each pixel is rendered as a tiny -- parallelogram of solid color, the edges of which are implemented -- with anti-aliasing. It resembles nearest neighbor for enlargement, -- and bilinear for reduction. Interp_Bilinear, -- Bilinear interpolation. For enlargement, it is equivalent to -- point-sampling the ideal bilinear-interpolated image. For reduction, -- it is equivalent to laying down small tiles and integrating over the -- coverage area. Interp_Hyper -- Filter_Hyper is the highest quality reconstruction function. It is -- derived from the hyperbolic filters in Wolberg's "Digital Image -- Warping," and is formally defined as the hyperbolic-filter sampling -- the ideal hyperbolic-filter interpolated image (the filter is -- designed to be idempotent for 1:1 pixel mapping). It is the slowest and highest quality. ); Interpolation methods. pragma Convention (C, Gdk_Interp_Type); type Gdk_Pixbuf is new Glib.C_Proxy; A very efficient client-side pixmap. This type can be adapted to all the possible screen depths (number of bits per pixel), and the algorithms are extremely efficient. You can also load a pixbuf directly from an external file in one of the standard image formats. type Gdk_Pixbuf_Animation is new Glib.C_Proxy; Type used for animations. type Gdk_Pixbuf_Animation_Iter is new Glib.C_Proxy; Type used to iterate through an animation. type Image_Quality is range 0 .. 100; For a JPEG image only, quality of the image in percentage.  File: gtkada_rm.info, Node: Gdk.Pixbuf Subprograms, Prev: Gdk.Pixbuf Types, Up: Package_Gdk.Pixbuf Subprograms =========== Get_Type -------- function Get_Type return Glib.GType; Return the internal value associated with a Gdk_Pixbuf. Reference counting ------------------ procedure Ref (Pixbuf : Gdk_Pixbuf); Increment the reference counting on the image. The image is destroyed when its reference counting reaches 0. Note also that most of the time you won't have to call this function yourself. procedure Unref (Pixbuf : Gdk_Pixbuf); Decrement the reference counting on the image. Accessing the fields -------------------- function Get_Colorspace (Pixbuf : Gdk_Pixbuf) return Gdk_Colorspace; Query the color space of a pixbuf. function Get_N_Channels (Pixbuf : Gdk_Pixbuf) return Gint; Number of channels in the image. function Get_Has_Alpha (Pixbuf : Gdk_Pixbuf) return Boolean; Return True if the image has an alpha channel (opacity information). function Get_Bits_Per_Sample (Pixbuf : Gdk_Pixbuf) return Gint; Number of bits per color sample. function Get_Pixels (Pixbuf : Gdk_Pixbuf) return Gdk.Rgb.Rgb_Buffer_Access; Return a pointer to the pixel data of the image. function Get_Width (Pixbuf : Gdk_Pixbuf) return Gint; Return the width of the image in pixels. function Get_Height (Pixbuf : Gdk_Pixbuf) return Gint; Return the height of the image in pixels. function Get_Rowstride (Pixbuf : Gdk_Pixbuf) return Gint; Return the number of bytes between rows in the image data. Creating -------- function Gdk_New (Colorspace : Gdk_Colorspace := Colorspace_RGB; Has_Alpha : Boolean := False; Bits_Per_Sample : Gint := 8; Width : Gint; Height : Gint) return Gdk_Pixbuf; Create a blank pixbuf with an optimal row stride and a new buffer. The buffer is allocated, but not cleared. The reference counting is initialized to 1. function Copy (Pixbuf : Gdk_Pixbuf) return Gdk_Pixbuf; Copy a pixbuf. function Gdk_New_Subpixbuf (Src_Pixbuf : Gdk_Pixbuf; Src_X : Gint; Src_Y : Gint; Width : Gint; Height : Gint) return Gdk_Pixbuf; Create a pixbuf which points to the pixels of another pixbuf procedure Gdk_New_From_File (Pixbuf : out Gdk_Pixbuf; Filename : String; Error : out GError); Load an image from file. function Gdk_New_From_Xpm_Data (Data : Interfaces.C.Strings.chars_ptr_array) return Gdk_Pixbuf; Create an image from a XPM data. procedure Fill (Pixbuf : Gdk_Pixbuf; Pixel : Guint32); Fill pixbuf with a given pixel value. procedure Save (Pixbuf : Gdk_Pixbuf; Filename : String; Format : File_Format; Error : out GError; Quality : Image_Quality := Image_Quality'Last); Save pixbuf to a file. Quality is only taken into account for JPEG images. Error is set to null on success, and set to a GError otherwise. function Add_Alpha (Pixbuf : Gdk_Pixbuf; Substitute_Color : Boolean := False; Red : Guchar := 0; Green : Guchar := 0; Blue : Guchar := 0) return Gdk_Pixbuf; Add an alpha channel. Return a newly allocated image copied from Pixbuf, but with an extra alpha channel. If Pixbuf already had an alpha channel, the two images have exactly the same contents. If Substitute_Color is True, the color (Red, Green, Blue) is substituted for zero opacity. If Substitute_Color is False, Red, Green and Blue are ignored, and a new color is created with zero opacity. procedure Copy_Area (Src_Pixbuf : Gdk_Pixbuf; Src_X : Gint; Src_Y : Gint; Width : Gint; Height : Gint; Dest_Pixbuf : Gdk_Pixbuf; Dest_X : Gint; Dest_Y : Gint); Copy a rectangular area from Src_pixbuf to Dest_pixbuf. Conversion of pixbuf formats is done automatically. procedure Saturate_And_Pixelate (Src : Gdk_Pixbuf; Dest : Gdk_Pixbuf; Saturation : Gfloat; Pixelate : Boolean := True); Brighten/darken and optionally make it pixelated-looking. Rendering --------- procedure Render_Threshold_Alpha (Pixbuf : Gdk_Pixbuf; Bitmap : Gdk.Bitmap.Gdk_Bitmap; Src_X : Gint; Src_Y : Gint; Dest_X : Gint; Dest_Y : Gint; Width : Gint; Height : Gint; Alpha_Threshold : Alpha_Range); Take the opacity values in a rectangular portion of a pixbuf and thresholds them to produce a bi-level alpha mask that can be used as a clipping mask for a drawable. Bitmap is the bitmap where the bilevel mask will be painted to. Alpha_Threshold are the opacity values below which a pixel will be painted as zero. All other values will be painted as one. procedure Render_To_Drawable (Pixbuf : Gdk_Pixbuf; Drawable : Gdk.Drawable.Gdk_Drawable; Gc : Gdk.GC.Gdk_GC; Src_X : Gint; Src_Y : Gint; Dest_X : Gint; Dest_Y : Gint; Width : Gint; Height : Gint; Dither : Gdk.Rgb.Gdk_Rgb_Dither := Gdk.Rgb.Dither_Normal; X_Dither : Gint := 0; Y_Dither : Gint := 0); Render a rectangular portion of a pixbuf to a drawable while using the specified GC. This is done using Gdk.RGB, so the specified drawable must have the Gdk.RGB visual and colormap. Note that this function will ignore the opacity information for images with an alpha channel; the GC must already have the clipping mask set if you want transparent regions to show through. For an explanation of dither offsets, see the Gdk.RGB documentation. In brief, the dither offset is important when re-rendering partial regions of an image to a rendered version of the full image, or for when the offsets to a base position change, as in scrolling. The dither matrix has to be shifted for consistent visual results. If you do not have any of these cases, the dither offsets can be both zero. procedure Render_To_Drawable_Alpha (Pixbuf : Gdk_Pixbuf; Drawable : Gdk.Drawable.Gdk_Drawable; Src_X : Gint; Src_Y : Gint; Dest_X : Gint; Dest_Y : Gint; Width : Gint; Height : Gint; Alpha : Alpha_Mode; Alpha_Threshold : Alpha_Range; Dither : Gdk.Rgb.Gdk_Rgb_Dither := Gdk.Rgb.Dither_Normal; X_Dither : Gint := 0; Y_Dither : Gint := 0); Render a rectangular portion of a pixbuf to a drawable. This is done using Gdk.RGB, so the specified drawable must have the Gdk_RGB visual and colormap. When used with Alpha_Bilevel, this function has to create a bitmap out of the thresholded alpha channel of the image and, it has to set this bitmap as the clipping mask for the GC used for drawing. This can be a significant performance penalty depending on the size and the complexity of the alpha channel of the image. If performance is crucial, consider handling the alpha channel yourself (possibly by caching it in your application) and using Render_To_Drawable or Gdk.RGB directly instead. If the image does have opacity information and Alpha_Mode is Alpha_Bilevel, specifies the threshold value for opacity values procedure Render_Pixmap_And_Mask (Pixbuf : Gdk_Pixbuf; Pixmap : out Gdk.Pixmap.Gdk_Pixmap; Mask : out Gdk.Bitmap.Gdk_Bitmap; Alpha_Threshold : Alpha_Range); function Get_From_Drawable (Dest : Gdk_Pixbuf; Src : Gdk.Drawable.Gdk_Drawable; Cmap : Gdk.Color.Gdk_Colormap; Src_X : Gint; Src_Y : Gint; Dest_X : Gint; Dest_Y : Gint; Width : Gint; Height : Gint) return Gdk_Pixbuf; Transfer image data from a Gdk drawable and converts it to an RGB(A) representation inside a Gdk_Pixbuf. If the drawable src is a pixmap, then a suitable colormap must be specified, since pixmaps are just blocks of pixel data without an associated colormap. If the drawable is a window, the Cmap argument will be ignored and the window's own colormap will be used instead. If the specified destination pixbuf Dest is Null_Pixbuf, then this function will create an RGB pixbuf with 8 bits per channel and no alpha, with the same size specified by the Width and Height arguments. In this case, the Dest_x and Dest_y arguments must be specified as 0, otherwise the function will return Null_Pixbuf. If the specified destination pixbuf is not Null_Pixbuf and it contains alpha information, then the filled pixels will be set to full opacity. If the specified drawable is a pixmap, then the requested source rectangle must be completely contained within the pixmap, otherwise the function will return Null_Pixbuf. If the specified drawable is a window, then it must be viewable, i.e. all of its ancestors up to the root window must be mapped. Also, the specified source rectangle must be completely contained within the window and within the screen. If regions of the window are obscured by non-inferior windows, the contents of those regions are undefined. The contents of regions obscured by inferior windows of a different depth than that of the source window will also be undefined. Return value: The same pixbuf as Dest if it was non-NULL, or a newly-created pixbuf with a reference count of 1 if no destination pixbuf was specified. Scaling ------- procedure Scale (Src : Gdk_Pixbuf; Dest : Gdk_Pixbuf; Dest_X : Gint; Dest_Y : Gint; Dest_Width : Gint; Dest_Height : Gint; Offset_X : Gdouble := 0.0; Offset_Y : Gdouble := 0.0; Scale_X : Gdouble := 1.0; Scale_Y : Gdouble := 1.0; Inter_Type : Gdk_Interp_Type := Interp_Bilinear); Transform the source image by scaling by Scale_x and Scale_y then translating by Offset_x and Offset_y. The image is then rendered in the rectangle (Dest_x, Dest_y, Dest_width, Dest_height) of the resulting image onto the destination drawable replacing the previous contents. procedure Composite (Src : Gdk_Pixbuf; Dest : Gdk_Pixbuf; Dest_X : Gint; Dest_Y : Gint; Dest_Width : Gint; Dest_Height : Gint; Offset_X : Gdouble := 0.0; Offset_Y : Gdouble := 0.0; Scale_X : Gdouble := 1.0; Scale_Y : Gdouble := 1.0; Inter_Type : Gdk_Interp_Type := Interp_Bilinear; Overall_Alpha : Alpha_Range := 128); Transform the source image by scaling by Scale_X and Scale_Y then translating by Offset_X and Offset_Y, then composite the rectangle (Dest_X, Dest_Y, Dest_Width, Dest_Height) of the resulting image onto the destination drawable. procedure Composite_Color (Src : Gdk_Pixbuf; Dest : Gdk_Pixbuf; Dest_X : Gint; Dest_Y : Gint; Dest_Width : Gint; Dest_Height : Gint; Offset_X : Gdouble := 0.0; Offset_Y : Gdouble := 0.0; Scale_X : Gdouble := 1.0; Scale_Y : Gdouble := 1.0; Inter_Type : Gdk_Interp_Type := Interp_Bilinear; Overall_Alpha : Alpha_Range := 128; Check_X : Gint := 0; Check_Y : Gint := 0; Check_Size : Gint := 0; Color1 : Guint32 := 0; Color2 : Guint32 := 0); Transform the source image by scaling by Scale_x and Scale_y then translating by Offset_x and Offset_y, then composites the rectangle (Dest_X, Dest_Y, Dest_Width, Dest_Height) of the resulting image with a checkboard of the colors Color1 and Color2 and renders it onto the destination drawable. The origin of checkboard is at (Check_x, Check_y) Color1 is the color at the upper left of the check. function Scale_Simple (Src : Gdk_Pixbuf; Dest_Width : Gint; Dest_Height : Gint; Inter_Type : Gdk_Interp_Type := Interp_Bilinear) return Gdk_Pixbuf; Scale the Src image to Dest_width x Dest_height and render the result into a new pixbuf. function Composite_Color_Simple (Src : Gdk_Pixbuf; Dest_Width : Gint; Dest_Height : Gint; Inter_Type : Gdk_Interp_Type := Interp_Bilinear; Overall_Alpha : Alpha_Range := 128; Color1 : Guint32 := 0; Color2 : Guint32 := 0) return Gdk_Pixbuf; Scale Src to Dest_width x Dest_height and composite the result with a checkboard of colors Color1 and Color2 and render the result into a new pixbuf. Animation support ----------------- function Get_Type_Animation return Glib.GType; Return the internal value associated with a Gdk_Pixbuf_Animation. procedure Gdk_New_From_File (Animation : out Gdk_Pixbuf_Animation; Filename : String; Error : out GError); Create a new animation by loading it from a file. The file format is detected automatically. If the file's format does not support multi-frame images, then an animation with a single frame will be created. Possible errors are in the Pixbuf_Error and GFile_Error domains. On return, Animation is a newly created animation with a reference count of 1, or null if any of several error conditions ocurred: the file could not be opened, there was no loader for the file's format, there was not enough memory to allocate the image buffer, or the image file contained invalid data. procedure Ref (Animation : Gdk_Pixbuf_Animation); Increment the reference counting on the animation. procedure Unref (Animation : Gdk_Pixbuf_Animation); Decrement the reference counting on the animation. function Get_Width (Animation : Gdk_Pixbuf_Animation) return Gint; Return the width of the bounding box of a pixbuf animation. function Get_Height (Animation : Gdk_Pixbuf_Animation) return Gint; Return the height of the bounding box of a pixbuf animation. function Is_Static_Image (Animation : Gdk_Pixbuf_Animation) return Boolean; If you load a file with Gdk_New_From_File and it turns out to be a plain, unanimated image, then this function will return True. Use Get_Static_Image to retrieve the image. function Get_Static_Image (Animation : Gdk_Pixbuf_Animation) return Gdk_Pixbuf; If an animation is really just a plain image (has only one frame), this function returns that image. If the animation is an animation, this function returns a reasonable thing to display as a static unanimated image, which might be the first frame, or something more sophisticated. If an animation hasn't loaded any frames yet, this function will return null. function Get_Iter (Animation : Gdk_Pixbuf_Animation; Start_Time : GTime_Val_Access := null) return Gdk_Pixbuf_Animation_Iter; Get an iterator for displaying an animation. The iterator provides the frames that should be displayed at a given time. It should be freed after use with Unref. Start_Time would normally come from G_Get_Current_Time, and marks the beginning of animation playback. After creating an iterator, you should immediately display the pixbuf returned by Get_Pixbuf. Then, you should install a timeout (with Timeout_Add) or by some other mechanism to ensure that you'll update the image after Get_Delay_Time milliseconds. Each time the image is updated, you should reinstall the timeout with the new, possibly-changed delay time. As a shortcut, if Start_Time is equal to null, the result of G_Get_Current_Time will be used automatically. To update the image (i.e. possibly change the result of Get_Pixbuf to a new frame of the animation), call Advance. If you're using Gdk_Pixbuf_Loader, in addition to updating the image after the delay time, you should also update it whenever you receive the area_updated signal and On_Currently_Loading_Frame returns True. In this case, the frame currently being fed into the loader has received new data, so needs to be refreshed. The delay time for a frame may also be modified after an area_updated signal, for example if the delay time for a frame is encoded in the data after the frame itself. So your timeout should be reinstalled after any area_updated signal. A delay time of -1 is possible, indicating "infinite." Iterators --------- function Get_Type_Animation_Iterreturn Glib.GType; Return the internal value associated with a Gdk_Pixbuf_Animation_Iter. procedure Ref (Iter : Gdk_Pixbuf_Animation_Iter); Increment the reference counting on the iterator. procedure Unref (Iter : Gdk_Pixbuf_Animation_Iter); Decrement the reference counting on the iterator. function Get_Delay_Time (Iter : Gdk_Pixbuf_Animation_Iter) return Gint; Return the number of milliseconds the current pixbuf should be displayed or -1 if the current pixbuf should be displayed forever. Timeout_Add conveniently takes a timeout in milliseconds, so you can use a timeout to schedule the next update. function Get_Pixbuf (Iter : Gdk_Pixbuf_Animation_Iter) return Gdk_Pixbuf; Return the current pixbuf which should be displayed. The pixbuf will be the same size as the animation itself (Get_Width, Get_Height). This pixbuf should be displayed for Get_Delay_Time milliseconds. The caller of this function does not own a reference to the returned pixbuf; the returned pixbuf will become invalid when the iterator advances to the next frame, which may happen anytime you call Advance. Copy the pixbuf to keep it (don't just add a reference), as it may get recycled as you advance the iterator. function On_Currently_Loading_Frame (Iter : Gdk_Pixbuf_Animation_Iter) return Boolean; Used to determine how to respond to the area_updated signal on Gdk_Pixbuf_Loader when loading an animation. area_updated is emitted for an area of the frame currently streaming in to the loader. So if you're on the currently loading frame, you need to redraw the screen for the updated area. function Advance (Iter : Gdk_Pixbuf_Animation_Iter; Current_Timer : GTime_Val_Access := null) return Boolean; Possibly advance an animation to a new frame. Chooses the frame based on the start time passed to Get_Iter. Current_Time would normally come from G_Get_Current_Time, and must be greater than or equal to the time passed to Get_Iter, and must increase or remain unchanged each time Get_Pixbuf is called. That is, you can't go backward in time; animations only play forward. As a shortcut, pass null for the current time and G_Get_Current_Time will be invoked on your behalf. So you only need to explicitly pass Current_Time if you're doing something odd like playing the animation at double speed. If this function returns False, there's no need to update the animation display, assuming the display had been rendered prior to advancing; if True, you need to call Get_Pixbuf and update the display with the new pixbuf.  File: gtkada_rm.info, Node: Package_Gdk.Pixmap, Next: Package_Gdk.Rgb, Prev: Package_Gdk.Pixbuf, Up: Top Package Gdk.Pixmap ****************** Pixmaps are off-screen drawables. They can be drawn upon with the standard drawing primitives, then copied to another drawable (such as a Gdk_Window) with Gdk.Drawable.Draw_Drawable. The depth of a pixmap is the number of bits per pixels. Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off). *note Package_Gdk.Bitmap:: for more details on bitmap handling. * Menu: * Gdk.Pixmap Types:: * Gdk.Pixmap Subprograms::  File: gtkada_rm.info, Node: Gdk.Pixmap Types, Next: Gdk.Pixmap Subprograms, Up: Package_Gdk.Pixmap Types ===== subtype Gdk_Pixmap is Gdk.Gdk_Pixmap; A server-side image. You can create an empty pixmap, or load if from external files in bitmap and pixmap format. See Gdk.Pixbuf if you need to load images in other formats.