Image::Base::Gtk2::Gdk::Drawable -- draw into a Gdk window or pixmap
use Image::Base::Gtk2::Gdk::Drawable; my $image = Image::Base::Gtk2::Gdk::Drawable->new (-drawable => $win_or_pixmap); $image->line (0,0, 99,99, '#FF00FF'); $image->rectangle (10,10, 20,15, 'white');
Image::Base::Gtk2::Gdk::Drawable is a subclass of Image::Base,
Image::Base::Gtk2::Gdk::Drawable
Image::Base
Image::Base Image::Base::Gtk2::Gdk::Drawable
Image::Base::Gtk2::Gdk::Drawable extends Image::Base to draw into a Gdk drawable, meaning either a window or a pixmap.
Colour names are anything recognised by Gtk2::Gdk::Color->parse, which means various names like "pink" plus hex #RRGGBB or #RRRRGGGGBBB. As of Gtk 2.20 the colour names are the Pango compiled-in copy of the X11 rgb.txt. Special names "set" and "clear" mean pixel values 1 and 0 for use with bitmaps.
Gtk2::Gdk::Color->parse
The Image::Base::Gtk2::Gdk::Pixmap subclass has some specifics for creating pixmaps, but this base Drawable is enough to draw into an existing one.
Image::Base::Gtk2::Gdk::Pixmap
Native Gdk drawing does much more than Image::Base but if you have some generic pixel twiddling code for Image::Base then this Drawable class lets you point it at a Gdk window etc. Drawing into a window is a good way to show slow drawing progressively, rather than drawing into a pixmap or image file and only displaying when complete. See Image::Base::Multiplex for a way to do both simultaneously.
Image::Base::Multiplex
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Gtk2::Gdk::Drawable->new (key=>value,...)
Create and return a new image object. A -drawable parameter must be given,
-drawable
$image = Image::Base::Gtk2::Gdk::Drawable->new (-drawable => $win_or_pixmap);
Further parameters are applied per set (see "ATTRIBUTES" below).
set
$image->xy ($x, $y, $colour)
Get or set the pixel at $x,$y.
$x
$y
In the current code colours are returned in #RRGGBB form and require a colormap. Perhaps in the future it will be #RRRRGGGGBBBB form since under X there's 16-bit resolution. Generally a colormap is required, though bitmaps without a colormap give 0 and 1. The intention is probably to have pixmaps without colormaps give back raw pixel values. Maybe bitmaps could give back "set" and "clear" as an option.
Fetching a pixel is an X server round-trip and reading out a big region will be slow. The server can give a region or the entire drawable in one go, so some function for that would be better if much fetching is needed.
Gtk2::Gdk::Drawable
The target drawable.
-width
-height
The size of the drawable per $drawable->get_size.
$drawable->get_size
-colormap
Gtk2::Gdk::Colormap
undef
The colormap in the underlying -drawable per $drawable->get_colormap. Windows always have a colormap, but pixmaps may or may not.
$drawable->get_colormap
-depth
The number of bits per pixel in the drawable, from $drawable->get_depth.
$drawable->get_depth
-screen
Gtk2::Gdk::Screen
The screen of the underlying drawable ($drawable->get_screen).
$drawable->get_screen
Image::Base, Image::Base::Gtk2::Gdk::Pixmap, Image::Base::Gtk2::Gdk::Window, Gtk2::Gdk::Drawable, Image::Base::Multiplex
http://user42.tuxfamily.org/image-base-gtk2/index.html
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/.
To install Image::Base::Gtk2::Gdk::Image, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Base::Gtk2::Gdk::Image
CPAN shell
perl -MCPAN -e shell install Image::Base::Gtk2::Gdk::Image
For more information on module installation, please visit the detailed CPAN module installation guide.