Image::Base::Gtk2::Gdk::Image -- draw into a Gtk2::Gdk::Image
use Image::Base::Gtk2::Gdk::Image; my $image = Image::Base::Gtk2::Gdk::Image->new (-width => 100, -height => 100, -colormap => Gtk2::Gdk::Colormap->get_system); $image->line (0,0, 99,99, '#FF00FF'); $image->rectangle (10,10, 20,15, 'white');
Image::Base::Gtk2::Gdk::Image is a subclass of
Image::Base to create and draw into GdkImage objects. It requires Perl-Gtk2 1.240 for the full GdkImage support there. A GdkImage is pixel data in client-side memory. There's no file load or save, just drawing operations.
Colour names are raw integer pixel values, and special names "set" and "clear" for pixel values 1 and 0 to use with bitmaps. If the GdkImage has a colormap then also anything recognised by
Gtk2::Gdk::Color->parse, such as "pink" and hex #RRGGBB or #RRRRGGGGBBB. As of Gtk 2.20 the colour names are the Pango compiled-in copy of the X11 rgb.txt.
A GdkImage is designed to copy pixel data between client memory and a window (or pixmap) on the server. Because it uses a
Gtk2::Gdk::Visual it's restricted to the depths (bits per pixel) supported the server windows and so isn't a general purpose pixel array.
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Gtk2::Gdk::Image->new (key=>value,...)
Create and return a new image object. It can be pointed at an existing
$image = Image::Base::Gtk2::Gdk::Image->new (-gdkimage => $gdkimage);
Or a new
$image = Image::Base::Gtk2::Gdk::Image->new (-width => 10, -height => 10);
Creating a GdkImage requires a size and visual, and optionally a colormap.
-width => integer -height => integer -visual => Gtk2::Gdk::Visual object -colormap => Gtk2::Gdk::Colormap object or undef
-visualdefaults to the visual of the
-colormapif given, or to the Gtk "system" visual otherwise.
$image->xy ($x, $y, $colour)
Get or set the pixel at
Currently if the GdkImage has a colormap then colours are returned in #RRRRGGGGBBBB form. Without a colormap the return is the integer pixel value integer.
-width(integer, read and create only)
-height(integer, read and create only)
The size of a GdkImage cannot be changed once created.
Gtk2::Gdk::Visual, read or create only)
get_depth, being the bits per pixel.
Copyright 2010, 2011, 2012 Kevin Ryde
Image-Base-Gtk2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Image-Base-Gtk2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Image-Base-Gtk2. If not, see http://www.gnu.org/licenses/.