NAME

Image::Base::Gtk2::Gdk::Image -- draw into a Gtk2::Gdk::Image

SYNOPSIS

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');

CLASS HIERARCHY

Image::Base::Gtk2::Gdk::Image is a subclass of Image::Base,

Image::Base
  Image::Base::Gtk2::Gdk::Image

DESCRIPTION

Image::Base::Gtk2::Gdk::Image extends 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.

FUNCTIONS

$image = Image::Base::Gtk2::Gdk::Image->new (key=>value,...)

Create and return a new image object. It can be pointed at an existing Gtk2::Gdk::Image,

$image = Image::Base::Gtk2::Gdk::Image->new
             (-gdkimage => $gdkimage);

Or a new Gtk2::Gdk::Image created,

$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

-visual defaults to the visual of the -colormap if given, or to the Gtk "system" visual otherwise.

$image->xy ($x, $y, $colour)

Get or set the pixel at $x,$y.

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.

ATTRIBUTES

-gdkimage (Gtk2::Gdk::Image object)

The target Gtk2::Gdk::Image object.

-width (integer, read and create only)
-height (integer, read and create only)

The size of a GdkImage cannot be changed once created.

-visual (Gtk2::Gdk::Visual, read or create only)
-colormap (Gtk2::Gdk::Colormap, read/write)
-depth (integer, read-only)

The GdkImage get_depth, being the bits per pixel.

SEE ALSO

Gtk2::Gdk::Image, Image::Base, Image::Base::Gtk2::Gdk::Drawable

HOME PAGE

http://user42.tuxfamily.org/image-base-gtk2/index.html

LICENSE

Copyright 2010, 2011 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/.