Image::Base::Prima::Drawable -- draw into Prima window, image, etc
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');
Image::Base::Prima::Drawable is a subclass of
Image::Base to draw into a
Prima::Drawable drawable, meaning a widget window, off-screen image, printer, postscript accumulator, etc.
The native Prima drawing has many more features, but this module can point some
Image::Base style code at a Prima image etc.
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. No attention is paid to the Prima
translate() origin change, which ends up meaning the top-left shifts up etc with the translate. That seems reasonably logical, is it the best way though?
None of the drawing functions here do a
$drawable->begin_paint() or a
Prima::PS::Drawable). That's left to the application. A
begin_paint() of course happens automatically in an
onPaint handler call. The symptom of forgetting a
begin_paint() is generally that lines, rectangles and ellipses don't draw anything, though
xy() might come out because it uses
$drawable->pixel() (but don't rely on that). Forgetting a
begin_doc() for PS output may cause various warnings about
Colour names for drawing are
Blue Prima colour constants cl::Blue etc #RRGGBB hex #RRRRGGGGBBBB hex
Internally Prima works in 8-bit RGB components and drawables with less than 24-bits per pixel then reduce further. See "Color space" in Prima::Drawable for details and the
cl:: colour constant names.
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Prima::Drawable->new (key=>value,...)
Create and return a new image object. A
Prima::Drawableobject 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
Currently colours returned by a get are always 2-digit hex #RRGGBB. Would names "Blue" for
cl::Blueetc be better for those particular colours?
The target drawable.
The width and height of the underlying drawable. Setting these resizes the drawable (as per
$drawable->size, see "Other properties" in Prima::Drawable).
Image-Base-Prima is Copyright 2010, 2011, 2012, 2015 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/>.