NAME

Image::Base::X11::Protocol::Picture -- draw into an X11::Protocol render picture

SYNOPSIS

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

my $image = Image::Base::X11::Protocol::Picture->new
              (-X        => $X,
               -picture  => $xid,
               -colormap => $colormap);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');

CLASS HIERARCHY

Image::Base::X11::Protocol::Picture is a subclass of Image::Base,

Image::Base
  Image::Base::X11::Protocol::Picture

DESCRIPTION

Image::Base::X11::Protocol::Picture extends Image::Base to draw into X "RENDER" extension pictures by sending drawing requests to an X server with X11::Protocol. There's no file load or save, just drawing operations.

Native X drawing does more than Image::Base but if you have some generic pixel twiddling code for Image::Base then this module lets you point it at a render picture.

Colour Names

Colour names are the server's colour names per AllocNamedColor plus hexadecimal RGB, and set/clear for bitmaps or monochrome windows,

LookupColor        usually server's /etc/X11/rgb.txt    
#RGB               1 to 4 digit hex
#RRGGBB
#RRRGGGBBB
#RRRRGGGGBBBB
1                  \              
0                   |  for bitmaps and monochrome windows
set                 |
clear              /

Colours used are allocated in a specified -colormap.

FUNCTIONS

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

Create and return a new image object. This requires an X11::Protocol connection object and a picture XID (an integer).

my $image = Image::Base::X11::Protocol::Picture->new
              (-X        => $x11_protocol_obj,
               -picture  => $picture_xid);
$colour = $image->xy ($x, $y)
$image->xy ($x, $y, $colour)

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

$image->add_colours ($name, $name, ...)

Allocate colours in the -colormap. Colour names are the same as for the drawing functions. For example,

$image->add_colours ('red', 'green', '#FF00FF');

Drawing automatically adds a colour if it doesn't already exist but using add_colours can do a set of pixel lookups in a single server round-trip instead of separate individual ones.

If using the default colormap of the screen then names "black" and "white" are taken from the screen info and don't query the server (neither in the drawing operations nor add_colours).

ATTRIBUTES

-picture (integer XID)

The target picture.

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

Width and height ...

SEE ALSO

Image::Base, X11::Protocol::Ext::RENDER