Kevin Ryde > Image-Base-Gtk2 > Image::Base::Gtk2::Gdk::Pixmap

Download:
Image-Base-Gtk2-11.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 11   Source  

NAME ^

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

SYNOPSIS ^

 use Image::Base::Gtk2::Gdk::Pixmap;
 my $image = Image::Base::Gtk2::Gdk::Pixmap->new
                 (-width => 10,
                  -height => 10,
                  -for_drawable => $win);
 $image->line (0,0, 99,99, '#FF00FF');
 $image->rectangle (10,10, 20,15, 'white');

CLASS HIERARCHY ^

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

    Image::Base
      Image::Base::Gtk2::Gdk::Drawable
        Image::Base::Gtk2::Gdk::Pixmap

DESCRIPTION ^

Image::Base::Gtk2::Gdk::Pixmap extends Image::Base to create and draw into Gdk Pixmaps. There's no file load or save, just drawing operations.

The drawing is done by the Image::Base::Gtk2::Gdk::Drawable base class. This class adds some pixmap creation help.

FUNCTIONS ^

See "FUNCTIONS" in Image::Base::Gtk2::Gdk::Drawable and "FUNCTIONS" in Image::Base for the behaviour inherited from the superclasses.

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

Create and return a new pixmap image object. It can be pointed at an existing pixmap,

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

Or a new pixmap created,

    $image = Image::Base::Gtk2::Gdk::Pixmap->new
                 (-width    => 10,
                  -height   => 10);

A pixmap requires a size, screen, depth (bits per pixel) and usually a colormap for allocating colours. The default is the Gtk default screen and its depth and colormap, or desired settings can be applied with

    -screen   =>  Gtk2::Gdk::Screen object
    -depth    =>  integer bits per pixel
    -colormap =>  Gtk2::Gdk::Colormap object or undef

If just -colormap is given then the screen and depth are taken from it. If -depth is given and it's not the screen's default depth then there's no default colormap (as it would be wrong), which happens when creating a bitmap,

    $image = Image::Base::Gtk2::Gdk::Pixmap->new
                 (-width   => 10,
                  -height  => 10,
                  -depth   => 1);  # bitmap, no colormap

The following further helper options can create a pixmap for use with a widget, window, or another pixmap,

    -for_drawable  => Gtk2::Gdk::Drawable object (win or pixmap)
    -for_widget    => Gtk2::Widget object

These targets give a screen, colormap and depth. -colormap and/or -depth can be given to override if desired though.

In a multi-screen program -for_widget should be used after the widget has been added somewhere under a toplevel widget, because until then it will only report the default screen (and colormap). Also, if a widget plays tricks with its window colormap or depth then it might only have the right settings after realized (ie. has created its window).

$new_image = $image->new (key=>value,...)

Create and return a copy of $image. The underlying pixmap is cloned by creating a new one and copying contents to it.

ATTRIBUTES ^

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

The size of a pixmap cannot be changed once created.

-pixmap (Gtk2::Gdk::Pixmap object)

The target pixmap. -drawable and -pixmap access the same attribute.

SEE ALSO ^

Image::Base, Image::Base::Gtk2::Gdk::Drawable, Image::Base::Gtk2::Gdk::Window, Gtk2::Gdk::Pixmap

HOME PAGE ^

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

LICENSE ^

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/.

syntax highlighting: