NAME
App::MathImage::Image::Base::Prima::Drawable -- draw into Prima window, image, etc
SYNOPSIS
use App::MathImage::Image::Base::Prima::Drawable;
my $image = App::MathImage::Image::Base::Prima::Drawable->new
(-drawable => $d);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');
CLASS HIERARCHY
App::MathImage::Image::Base::Prima::Drawable
is a subclass of Image::Base
,
Image::Base
App::MathImage::Image::Base::Prima::Drawable
DESCRIPTION
App::MathImage::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 lots more features, but this module is an easy way to point Image::Base
style code at a Prima image etc.
Colours names for drawing are the "Blue" etc from 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 truncated.
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 App::MathImage::Image::Base::Prima::Drawable
converts. There's no support for the Prima "translate" origin shift yet.
None of the drawing functions do a $drawable->begin_paint
. That's left to the application, and of course happens automatically for an onPaint
handler. 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 = App::MathImage::Image::Base::Prima::Drawable->new (key=>value,...)
-
Create and return a new image object. A
Prima::Drawable
object must be given.$image = App::MathImage::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.
ATTRIBUTES
-drawable
(Prima::Drawable
)-
The target drawable.
-width
(integer, read-only)-height
(integer, read-only)-
The width and height of the underlying drawable.