The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Image::Base::X11::Protocol::Pixmap -- draw into an X11::Protocol pixmap

SYNOPSIS

 use Image::Base::X11::Protocol::Drawable;
 my $X = X11::Protocol->new;

 use Image::Base::X11::Protocol::Pixmap;
 my $image = Image::Base::X11::Protocol::Pixmap->new
               (-X          => $X,
                -width      => 200,
                -height     => 100,
                -for_window => $win);
 $image->line (0,0, 99,99, '#FF00FF');
 $image->rectangle (10,10, 20,15, 'white');

CLASS HIERARCHY

Image::Base::X11::Protocol::Pixmap is a subclass of Image::Base::X11::Protocol::Drawable,

    Image::Base
      Image::Base::X11::Protocol::Drawable
        Image::Base::X11::Protocol::Pixmap

DESCRIPTION

Image::Base::X11::Protocol::Pixmap extends Image::Base to create and draw into X pixmaps by sending drawing requests to an X server using X11::Protocol. There's no file load or save, just drawing operations.

FUNCTIONS

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

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

Create and return a new image object. An existing pixmap can be used, usually with a colormap for where to allocate colours.

    $image = Image::Base::X11::Protocol::Pixmap->new
                 (-X        => $x11_protocol_obj,
                  -pixmap   => $pixmap_xid,
                  -colormap => $colormap_xid);

Or a new pixmap can be created,

    $image = Image::Base::X11::Protocol::Pixmap->new
                 (-X      => $x11_protocol_obj,
                  -width  => 100,
                  -height => 100);  # default screen and depth

A pixmap requires a size, screen and depth, plus a colormap if allocating colours instead of making a bitmap or similar. The default is the X11::Protocol object's current choose_screen and the depth of the root window on that screen, or desired settings can be applied with

    -screen   => integer screen number
    -depth    => integer bits per pixel
    -colormap => integer XID

If -depth is given and it's not the screen's default depth then there's no default colormap (since the screen's default would be wrong). This happens when creating a bitmap,

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

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

    -for_drawable =>  integer XID
    -for_window   =>  integer XID

-for_drawable means the depth and screen of that pixmap or window. -for_window likewise and in addition the colormap fetched from it per GetWindowAttributes. Getting this information is a server round-trip (except for a root window) so if you already know those things then passing them as -screen, -depth and -colormap is faster.

ATTRIBUTES

See Image::Base::X11::Protocol::Drawable for the base drawable attributes inherited.

-pixmap (XID integer)

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

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

The size of a pixmap cannot be changed once created.

The maximum size allowed by the protocol is 32767x32767, and minimum 1x1. When creating a pixmap currently the sizes are chopped by Perl's pack to a signed 16 bits, which means 32768 to 65535 results in an X protocol error (being negatives), but for instance 65546 wraps around to 10 and will seem to work.

SEE ALSO

Image::Base, Image::Base::X11::Protocol::Drawable, Image::Base::X11::Protocol::Window, X11::Protocol

HOME PAGE

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

LICENSE

Image-Base-X11-Protocol is Copyright 2010, 2011, 2012, 2013 Kevin Ryde

Image-Base-X11-Protocol 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-X11-Protocol 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-X11-Protocol. If not, see <http://www.gnu.org/licenses/>.