NAME
Image::Base::Prima::Drawable -- draw into Prima window, image, etc
SYNOPSIS
use Image::Base::Prima::Drawable;
my $image = Image::Base::Prima::Drawable->new
(-drawable => $d);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');
CLASS HIERARCHY
Image::Base::Prima::Drawable
is a subclass of Image::Base
,
Image::Base
Image::Base::Prima::Drawable
DESCRIPTION
Image::Base::Prima::Drawable
extends Image::Base
to draw into a Prima::Drawable
drawable, meaning a widget window, off-screen image, printer, etc.
The native Prima drawing has many more features, but this module can point some Image::Base
style code at a Prima image etc.
Colour names for drawing are "Blue" etc of the Prima colour constants like cl::Blue
(see "Color space" in Prima::Drawable), plus 2-digit #RRGGBB or 4-digit #RRRRGGGGBBBB hex. Internally Prima works in 8-bit RGB components so 4-digit values are reduced. Drawables with less than 24-bits per pixel reduce further.
X,Y coordinates are the usual Image::Base
style 0,0 at the top-left corner. Prima works from 0,0 as the bottom-left but Image::Base::Prima::Drawable
converts. There's no support for the Prima "translate" origin shift.
None of the drawing functions here do a $drawable->begin_paint
. That's left to the application, and of course happens automatically in an onPaint
handler call. The symptom of forgetting is that lines, rectangles and ellipses don't draw anything. In the current code xy
might come out because it uses $drawable->pixel
, but don't rely on that.
FUNCTIONS
$image = Image::Base::Prima::Drawable->new (key=>value,...)
-
Create and return a new image object. A
Prima::Drawable
object must be given.$image = Image::Base::Prima::Drawable->new (-drawable => $d);
$colour = $image->xy ($x, $y)
$image->xy ($x, $y, $colour)
-
Get or set the pixel at
$x
,$y
.Currently colours returned by a get are always 2-digit hex #RRGGBB. Would names "Blue" for
cl::Blue
etc be better for those particular colours?
ATTRIBUTES
-drawable
(Prima::Drawable
object)-
The target drawable.
-width
(integer)-height
(integer)-
The width and height of the underlying drawable. Setting these resizes the drawable (as per
$drawable->size
, see "Other properties" in Prima::Drawable).
SEE ALSO
Image::Base, Prima::Drawable, Image::Base::Prima::Image
Image::Base::Gtk2::Gdk::Drawable, Image::Base::X11::Protocol::Drawable
HOME PAGE
http://user42.tuxfamily.org/image-base-prima/index.html
LICENSE
Image-Base-Prima is Copyright 2010, 2011 Kevin Ryde
Image-Base-Prima 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-Prima 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-Prima. If not, see <http://www.gnu.org/licenses/>.