Gdk::Image
class Gdk::Image
The Gdk::Image type represents an area for drawing graphics. It has now been superceded to a large extent by the much more flexible Gdk::RGB methods.
Class Methods
Gdk::Image.new(type, visual, width, height)
-
Creates a new Gdk::Image.
- type : the type of the Gdk::Image, one of Gdk::Image::NORMAL, Gdk::Image::SHARED and Gdk::Image::FASTEST. Gdk::Image::FASTEST is probably the best choice, since it will try creating a GDK_IMAGE_SHARED image first and if that fails it will then use Gdk::Image::NORMAL.
- visual: the Gdk::Visual to use for the image
- width: the width of the image in pixels
- height: the height of the image in pixels
- Returns: a new Gdk::Image
Instance Methods
image_type
-
Gets the type of the image.
- Returns: the tyepe of the image(GdkImageType)
visual
-
Gets the visual.
- Returns: the Gdk::Visual
width
-
Gets the width of the image in pixels.
- Returns: the width of the image in pixels.
height
-
Gets the height of the image in pixels.
- Returns: the height of the image in pixels.
depth
-
Gets the depth of the image, i.e. the number of bits per pixel
- Returns: the depth of the image.
bpp
-
Gets the number of bytes per pixel.
- Returns: the number of bytes per pixel
bpl
-
Gets the number of bytes per line of the image.
- Returns: the number of bytes per of the image.
bits_per_pixel
-
Gets the number of bits per pixel.
- Returns: the number of bits per pixel.
colormap
-
Retrieves the colormap for a given image, if it exists. An image will have a colormap if the drawable from which it was created has a colormap, or if a colormap was set explicitely with Gdk::Image#colormap=.
- Returns : colormap for the image
colormap=(colormap)
-
Sets the colormap for the image to the given colormap. Normally there's no need to use this method, images are created with the correct colormap if you get the image from a drawable. If you create the image from scratch, use the colormap of the drawable you intend to render the image to.
- colormap: a Gdk::Colormap
- Returns: colormap
set_colormap(colormap)
-
Same as Gdk::Image#colormap=.
- colormap: a Gdk::Colormap
- Returns: self
put_pixel(x, y, pixel)
-
Sets a pixel in a Gdk::Image to a given pixel value.
- x: the x coordinate of the pixel to set.
- y: the y coordinate of the pixel to set.
- pixel: the pixel value to set.
- Returns: self
get_pixel(x, y)
-
Gets a pixel value at a specified position in a Gdk::Image.
- x: the x coordinate of the pixel to get.
- y: the y coordinate of the pixel to get.
- Returns: the pixel value at the given position.
Constants
GdkImageType
Specifies the type of a Gdk::Image.
NORMAL
- The original X image type, which is quite slow since the image has to be transferred from the client to the server to display it.
SHARED
- A faster image type, which uses shared memory to transfer the image data between client and server. However this will only be available if client and server are on the same machine and the shared memory extension is supported by the server.
FASTEST
- Specifies that Gdk::Image::SHARED should be tried first, and if that fails then Gdk::Image::NORMAL will be used.
- Masao
Parola chiave:
Referenze:[Gtk::Image] [Gdk::Image] [Gdk::Colormap] [Gdk::Drawable] [Gdk::Visual] [Gdk::Pixbuf]