NAME

Image::Base::X11::Protocol::Window -- draw into an X11::Protocol window

SYNOPSIS

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

use Image::Base::X11::Protocol::Window;
my $image = Image::Base::X11::Protocol::Window->new
              (-X      => $X,
               -window => $win_xid);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');

CLASS HIERARCHY

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

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

DESCRIPTION

Image::Base::X11::Protocol::Window extends Image::Base to draw into an X window by speaking directly to an X server using X11::Protocol. There's no file load or save, just drawing operations.

As an experimental feature, if the X11::Protocol object has the SHAPE extension available and initialized then colour "None" means transparent and drawing it subtracts from the window's shape to make see-though holes. This is fun, and makes "None" more or less work like other Image::Base subclasses, but is probably not actually very useful.

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::Window->new (key=>value,...)

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

$image = Image::Base::X11::Protocol::Window->new
             (-X      => $x11_protocol_obj,
              -window => $win_xid);

-colormap is set from the window's current colormap attribute, or pass a value to save a server round-trip if you know it already or if you want a different colormap.

There's nothing to create a new X window since there's many settings for it and they seem outside the scope of this wrapper.

ATTRIBUTES

-window (XID integer)

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

-width (integer)
-height (integer)

Changing these resizes the window per ConfigureWindow. See the base Drawable class for the way fetching uses GetGeometry.

The maximum size allowed by the protocol in various places is 32767x32767, and the minimum is 1x1. When creating or resizing currently the sizes end up 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.

In the current code a window size change made outside this wrapper (including perhaps by the user through the window manager) is not noticed by the wrapper and -width and -height remain as the cached values. A GetGeometry for every get() would be the only way to be sure of the right values, but a server query every time would likely be very slow for generic image code designed for in-memory images, and of course most of the time the window size doesn't change.

-colormap (integer XID)

Changing this doesn't change the window's colormap attribute, it's just where the drawing operations should allocate colours.

SEE ALSO

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

X11::Protocol, X11::Protocol::Ext::SHAPE

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