This package implements a client-side pixmap. As opposed to the pixmaps found in Gdk.Pixmap, this one simply implements a local buffer, which can be manipulated at the pixel level easily. This buffer then needs to be sent to the server. The major efficiency difference is that the same amount of data needs to be sent to the server no matter how much things were modified. Gdk.Pixmaps requires one communication with the server per drawing function. Some X servers are also optimized so that the buffers in this package can be implemented in shared memory with the server, which of course makes it much faster to transfer the data. This package is basically an implementation of XImage (on X-Window), which means that it handles transparently different depths, byte ordering,... It also provides some color dithering functions.
Note that you need to initialize this package before using it by calling the Init procedure below.
See the commands Get_Visual and Get_Cmap below on how to use the colormaps and visual with this package
Dithering simulates a higher number of colors than what is available on the current visual (only for 8-bit and 16-bit displays).
Types |
---|
type Gdk_Rgb_Cmap is new Gdk.C_Proxy; | |
This is the full colormap, ie a set of 256 Rbg items.
You can extract values using the functions Get or Set below.
| |
type Gdk_Rgb_Dither is (Dither_None, Dither_Normal, Dither_Max); | |
The three kinds of dithering that are implemented in this package:
- Dither_None: No dithering will be done
- Dither_Normal: Specifies dithering on 8 bit displays, but not 16-bit.
Usually the best choice.
- Dither_Max: Specifies dithering on every kind of display
| |
type Rgb_Buffer is array (Natural) of Glib.Guchar; | |
See Rgb_Buffer_Access.
| |
type Rgb_Buffer_Access is access all Rgb_Buffer; | |
This is the buffer that will contain the image. You can manipulate each
byte in it independantly, although there is no high level routine
to draw lines, circles, ...
Once you are done drawing into this buffer, you can copy it to any
drawable on the screen, *if* the widget was created with the correct
visual and colormap (see above).
Note also that this is a flat array, and that you can not check its
ranges.
| |
type Rgb_Cmap_Index is new Natural range 0 .. 255; | |
| |
subtype Rgb_Item is Glib.Guint32; | |
This represents the coding for a rbg value. The exact encoding depends
on the visual used and its depth (pseudo-color, true-color, ...)
|
Subprograms |
---|
procedure Init; | ||
This function must be called before using any of the functions below. | ||
function Get_Visual return Gdk.Visual.Gdk_Visual; | ||
See Get_Cmap.
| ||
function Get_Cmap return Gdk.Color.Gdk_Colormap; | ||
Return the visual and the color map used internally in this package. The drawable you intend to copy the RBG buffer to must use this visual and this colormap. Therefore, before creating the widget, you need to do the following:
| ||
Color manipulation | ||
function Xpixel_From_Rgb (Value : in Rgb_Item) return Glib.Gulong; | ||
Convert the Rgb representation to the usual one found in Gdk.Color.
| ||
procedure GC_Set_Foreground (GC : in Gdk.GC.Gdk_GC; Value : in Rgb_Item); | ||
See GC_Set_Background.
| ||
procedure GC_Set_Background (GC : in Gdk.GC.Gdk_GC; Value : in Rgb_Item); | ||
Modify the foreground and the background of a graphic context with a | ||
Colormap manipulation | ||
function Get (Cmap : in Gdk_Rgb_Cmap; Index : in Rgb_Cmap_Index) return Rgb_Item; | ||
Access an item in a colormap.
| ||
function Get_8 (Cmap : in Gdk_Rgb_Cmap; Index : in Rgb_Cmap_Index) return Glib.Guchar; | ||
Same as Get for 8-bit displays.
| ||
procedure Set (Cmap : in Gdk_Rgb_Cmap; Index : in Rgb_Cmap_Index; Value : in Rgb_Item); | ||
Set an item in Cmap.
| ||
procedure Set_8 (Cmap : in Gdk_Rgb_Cmap; Index : in Rgb_Cmap_Index; Value : in Glib.Guchar); | ||
Same as Set for 8-bit displays
| ||
procedure Gtk_New (Cmap : out Gdk_Rgb_Cmap; Colors : in Glib.Guint32_Array); | ||
Create a colormap.
| ||
procedure Free (Cmap : in out Gdk_Rgb_Cmap); | ||
Free a colormap.
| ||
Drawing Images | ||
procedure Draw_Rgb_Image (Drawable : in Gdk.Drawable.Gdk_Drawable; GC : in Gdk.GC.Gdk_GC; X, Y : in Glib.Gint; Width, Height : in Glib.Gint; Dith : in Gdk_Rgb_Dither; Rgb_Buf : in Rgb_Buffer; Rowstride : in Glib.Gint); | ||
Render a Gdk buffer with 24 bit Data.
| ||
procedure Draw_Rgb_Image_Dithalign (Drawable : in Gdk.Drawable.Gdk_Drawable; GC : in Gdk.GC.Gdk_GC; X, Y : in Glib.Gint; Width, Height : in Glib.Gint; Dith : in Gdk_Rgb_Dither; Rgb_Buf : in Rgb_Buffer; Rowstride : in Glib.Gint; Xdith, Ydith : in Glib.Gint); | ||
Same kind of function as above, but for different buffer types (???).
| ||
procedure Draw_Rgb_32_Image (Drawable : in Gdk.Drawable.Gdk_Drawable; GC : in Gdk.GC.Gdk_GC; X, Y : in Glib.Gint; Width, Height : in Glib.Gint; Dith : in Gdk_Rgb_Dither; Rgb_Buf : in Rgb_Buffer; Rowstride : in Glib.Gint); | ||
Same kind of function as above, but for different buffer types (???).
| ||
procedure Draw_Gray_Image (Drawable : in Gdk.Drawable.Gdk_Drawable; GC : in Gdk.GC.Gdk_GC; X, Y : in Glib.Gint; Width, Height : in Glib.Gint; Dith : in Gdk_Rgb_Dither; Rgb_Buf : in Rgb_Buffer; Rowstride : in Glib.Gint); | ||
Same kind of function as above, but for different buffer types (???).
| ||
procedure Draw_Indexed_Image (Drawable : in Gdk.Drawable.Gdk_Drawable; GC : in Gdk.GC.Gdk_GC; X, Y : in Glib.Gint; Width, Height : in Glib.Gint; Dith : in Gdk_Rgb_Dither; Rgb_Buf : in Rgb_Buffer; Rowstride : in Glib.Gint; Cmap : in Gdk_Rgb_Cmap); | ||
Same kind of function as above, but for different buffer types (???).
|