Image related php-gtk functions
Images are displayed using the GtkPixmap widget which has
to be invoked with two parameters; a map of type
GdkPixmap and a mask of type
GdkBitmap.
The map defines all the pixels with its colors, and as the map is not able to
contain transparent color information, the mask is a map of 1's and 0's telling
which pixel is transparent and which not.
There are two functions dedicated to reading of XPM images:
As both functions are identical in usage, I will describe pixmap_create_from_xpm_d
only.
list( $pixmap, $mask) = gdk::pixmap_create_from_xpm_d( $objWindow->window, $colTransparent, $arImage);
|
The function returns an array of size 2: the first is the map with all the pixels and colors,
and the second is the mask with transparency information. We store them in two different
variables here, although you can just use an array.
The first parameter, $objWindow->window is the GdkWindow
of your application's window. Please make sure that the GdkWindow
exists by showing the GtkWindow or by calling the
realize() function.
The second parameter, $colTransparent defines which color the
transparent color (color None) will get if the pixmask is not
used when creating e.g. the GtkPixmap.
The third parameter is the name of the image file (pixmap_create_from_xpm),
or a normal php array with the structure as described in the XPM standard
(pixmap_create_from_xpm_d).