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 composite 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.
Types |
---|
type Alpha_Mode is (Alpha_Bilevel, Alpha_Full); | |
Alpha compositing mode.
This indicates how the alpha channel (for opacity) is handled when
rendering.
| |
type Gdk_Pixbuf is private; | |
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.
|
Subprograms |
---|
Accessing the fields | ||
function Get_Format (Pixbuf : in Gdk_Pixbuf) return Gdk.Art.Pixbuf.Art_Pix_Format; | ||
Return the format of the image. | ||
function Get_N_Channels (Pixbuf : in Gdk_Pixbuf) return Gint; | ||
Number of channels in the image.
| ||
function Get_Has_Alpha (Pixbuf : in Gdk_Pixbuf) return Boolean; | ||
Return True if the image has an alpha channel (opacity information).
| ||
function Get_Bits_Per_Sample (Pixbuf : in Gdk_Pixbuf) return Gint; | ||
Number of bits per color sample.
| ||
function Get_Pixels (Pixbuf : in Gdk_Pixbuf) return Gdk.Rgb.Rgb_Buffer_Access; | ||
Return a pointer to the pixel data of the image.
| ||
function Get_Width (Pixbuf : in Gdk_Pixbuf) return Gint; | ||
Return the width of the image in pixels.
| ||
function Get_Height (Pixbuf : in Gdk_Pixbuf) return Gint; | ||
Return the height of the image in pixels.
| ||
function Get_Rowstride (Pixbuf : in Gdk_Pixbuf) return Gint; | ||
Return the number of bytes between rows in the image data.
| ||
Reference counting | ||
procedure Ref (Pixbuf : in Gdk_Pixbuf); | ||
Increment the reference counting on the image. | ||
procedure Unref (Pixbuf : in Gdk_Pixbuf); | ||
Decrement the reference counting on the image.
| ||
Libart interface | ||
function New_From_Art_Pixbuf (Pixbuf : in Gdk.Art.Pixbuf.Art_Pixbuf) return Gdk_Pixbuf; | ||
Wrap an art_pixbuf. | ||
function Gdk_New (Width : in Gint; Height : in Gint; Format : in Gdk.Art.Pixbuf.Art_Pix_Format := Gdk.Art.Pixbuf.Art_Pix_RGB; Has_Alpha : in Boolean := False; Bits_Per_Sample : in Gint := 8) return Gdk_Pixbuf; | ||
Create a blank pixbuf with an optimal row stride and a new buffer. | ||
Creating | ||
function New_From_File (Filename : in String) return Gdk_Pixbuf; | ||
Load an image from file.
| ||
function New_From_Xpm_Data (Data : in Interfaces.C.Strings.chars_ptr_array) return Gdk_Pixbuf; | ||
Create an image from a XPM data.
| ||
function Add_Alpha (Pixbuf : in Gdk_Pixbuf; Substitute_Color : in Boolean; Red : in Guchar := 0; Green : in Guchar := 0; Blue : in Guchar := 0) return Gdk_Pixbuf; | ||
Return a newly allocated image copied from Pixbuf, but with an | ||
Rendering | ||
procedure Render_Threshold_Alpha (Pixbuf : in Gdk_Pixbuf; Bitmap : in Gdk.Bitmap.Gdk_Bitmap; Src_X : in Gint; Src_Y : in Gint; Dest_X : in Gint; Dest_Y : in Gint; Width : in Gint; Height : in Gint; Alpha_Threshold : in Gint); | ||
Take the opacity values in a rectangular portion of a pixbuf and | ||
procedure Render_To_Drawable (Pixbuf : in Gdk_Pixbuf; Drawable : in Gdk.Drawable.Gdk_Drawable; Gc : in Gdk.GC.Gdk_GC; Src_X : in Gint; Src_Y : in Gint; Dest_X : in Gint; Dest_Y : in Gint; Width : in Gint; Height : in Gint; Dither : in Gdk.Rgb.Gdk_Rgb_Dither := Gdk.Rgb.Dither_Normal; X_Dither : in Gint := 0; Y_Dither : in Gint := 0); | ||
Render a rectangular portion of a pixbuf to a drawable while using the
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 : in Gdk_Pixbuf; Drawable : in Gdk.Drawable.Gdk_Drawable; Src_X : in Gint; Src_Y : in Gint; Dest_X : in Gint; Dest_Y : in Gint; Width : in Gint; Height : in Gint; Alpha : in Alpha_Mode; Alpha_Threshold : in Gint; Dither : in Gdk.Rgb.Gdk_Rgb_Dither := Gdk.Rgb.Dither_Normal; X_Dither : in Gint := 0; Y_Dither : in Gint := 0); | ||
Render a rectangular portion of a pixbuf to a drawable.
If the image does have opacity information and Alpha_Mode
is Alpha_Bilevel, specifies the threshold value for opacity values
| ||
function Get_From_Drawable (Dest : in Gdk_Pixbuf; Src : in Gdk.Drawable.Gdk_Drawable; Cmap : in Gdk.Color.Gdk_Colormap; Src_X : in Gint; Src_Y : in Gint; Dest_X : in Gint; Dest_Y : in Gint; Width : in Gint; Height : in Gint) return Gdk_Pixbuf; | ||
Transfer image data from a Gdk drawable and converts it to an RGB(A) 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 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.
| ||
procedure Copy_Area (Src_Pixbuf : in Gdk_Pixbuf; Src_X : in Gint; Src_Y : in Gint; Width : in Gint; Height : in Gint; Dest_Pixbuf : in Gdk_Pixbuf; Dest_X : in Gint; Dest_Y : in Gint); | ||
Copy a rectangular area from Src_pixbuf to Dest_pixbuf. | ||
Scaling | ||
procedure Scale (Src : in Gdk_Pixbuf; Dest : in Gdk_Pixbuf; Dest_X : in Gint; Dest_Y : in Gint; Dest_Width : in Gint; Dest_Height : in Gint; Offset_X : in Gdouble := 0.0; Offset_Y : in Gdouble := 0.0; Scale_X : in Gdouble := 1.0; Scale_Y : in Gdouble := 1.0; Filter_Level : in Gdk.Art.Pixbuf.Art_Filter_Level := Gdk.Art.Pixbuf.Filter_Bilinear); | ||
Transform the source image by scaling by Scale_x and Scale_y then | ||
procedure Composite (Src : in Gdk_Pixbuf; Dest : in Gdk_Pixbuf; Dest_X : in Gint; Dest_Y : in Gint; Dest_Width : in Gint; Dest_Height : in Gint; Offset_X : in Gdouble := 0.0; Offset_Y : in Gdouble := 0.0; Scale_X : in Gdouble := 1.0; Scale_Y : in Gdouble := 1.0; Filter_Level : in Gdk.Art.Pixbuf.Art_Filter_Level := Gdk.Art.Pixbuf.Filter_Bilinear; Overall_Alpha : in Gint := 128); | ||
Transform the source image by scaling by Scale_x and Scale_y then | ||
procedure Composite_Color (Src : in Gdk_Pixbuf; Dest : in Gdk_Pixbuf; Dest_X : in Gint; Dest_Y : in Gint; Dest_Width : in Gint; Dest_Height : in Gint; Offset_X : in Gdouble := 0.0; Offset_Y : in Gdouble := 0.0; Scale_X : in Gdouble := 1.0; Scale_Y : in Gdouble := 1.0; Filter_Level : in Gdk.Art.Pixbuf.Art_Filter_Level := Gdk.Art.Pixbuf.Filter_Bilinear; Overall_Alpha : in Gint := 128; Check_X : in Gint := 0; Check_Y : in Gint := 0; Check_Size : in Gint := 0; Color1 : in Gdk.Art.Pixbuf.Art_U32 := 0; Color2 : in Gdk.Art.Pixbuf.Art_U32 := 0); | ||
Transform the source image by scaling by Scale_x and Scale_y then | ||
function Scale_Simple (Src : in Gdk_Pixbuf; Dest_Width : in Gint; Dest_Height : in Gint; Filter_Level : in Gdk.Art.Pixbuf.Art_Filter_Level := Gdk.Art.Pixbuf.Filter_Bilinear) return Gdk_Pixbuf; | ||
Scale the Src image to Dest_width x Dest_height and render the result | ||
function Composite_Color_Simple (Src : in Gdk_Pixbuf; Dest_Width : in Gint; Dest_Height : in Gint; Filter_Level : in Gdk.Art.Pixbuf.Art_Filter_Level := Gdk.Art.Pixbuf.Filter_Bilinear; Overall_Alpha : in Gint := 128; Color1 : in Gdk.Art.Pixbuf.Art_U32 := 0; Color2 : in Gdk.Art.Pixbuf.Art_U32 := 0) return Gdk_Pixbuf; | ||
Scale Src to Dest_width x Dest_height and composite the result with |