The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::MathImage::Image::Base::Prima::Image -- draw into Prima image

SYNOPSIS

 use App::MathImage::Image::Base::Prima::Image;
 my $image = App::MathImage::Image::Base::Prima::Image->new
               (-width => 200, -height => 100);
 $image->line (0,0, 99,99, '#FF00FF');
 $image->rectangle (10,10, 20,15, 'white');

CLASS HIERARCHY

App::MathImage::Image::Base::Prima::Image is a subclass of App::MathImage::Image::Base::Prima::Drawable,

    Image::Base
      App::MathImage::Image::Base::Prima::Drawable
        App::MathImage::Image::Base::Prima::Image

DESCRIPTION

App::MathImage::Image::Base::Prima::Image extends Image::Base to create and draw into Prima::Image objects, including file loading and saving.

See App::MathImage::Image::Base::Prima::Drawable for the actual drawing operation. This subclass adds image creation and file load/save.

FUNCTIONS

$image = App::MathImage::Image::Base::Prima::Image->new (key=>value,...)

Create and return a new image object. A new Prima::Image object can be created, usually a -width and -height though it also works to set them later,

    $ibase = App::MathImage::Image::Base::Prima::Image->new
               (-width => 200,
                -height => 100);;

Or an existing Prima::Image object can be given

    $ibase = App::MathImage::Image::Base::Prima::Image->new
               (-drawable => $pimage);
$image->load
$image->load ($filename)

Load from -file, or with $filename set -file then load.

The Prima loadExtras option is used so as to get the file format codecID in the underlying image.

$image->save
$image->save ($filename)

Save to -file, or with $filename set -file then save to that.

As per Prima save, the file format is taken from the underlying $primaimage->{'extras'}->{'codecID'} if that's set, otherwise the filename extension.

ATTRIBUTES

-file (string)

For saving Prima takes the file format from the filename extension, for example ".png". See Prima::image-load.

-file_format (string or undef)

The file format as a string like "PNG" or "JPEG", or undef if unknown or never set. Getting or setting -file_format operates on the underlying $primaimage->{'extras'}->{'codecID'} field.

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

The width and height of the underlying drawable.

SEE ALSO

Image::Base, Prima::Image, Prima::image-load