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

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

SYNOPSIS

 use Image::Base::Prima::Image;
 my $image = 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

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

    Image::Base
      Image::Base::Prima::Drawable
        Image::Base::Prima::Image

DESCRIPTION

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

See Image::Base::Prima::Drawable for the drawing operations. This subclass adds image creation and file load/save. begin_paint / end_paint bracketing is still necessary.

As of Prima 1.28 the supported file formats for both read and write include JPEG, PNG, TIFF, GIF, XBM, XPM and BMP. Prima on X11 draws using the X server, so an X connection is necessary. Don't use Prima::noX11 or drawing operations will quietly do nothing.

FUNCTIONS

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

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

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

Or an existing Prima::Image object can be given

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

Load from -file, or with a $filename argument 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 a $filename argument 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 from the filename extension. The -file_format attribute below can set the desired output format.

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 $primaimage->{'extras'}->{'codecID'} field of the underlying Prime::Image.

After load the -file_format is the format read. Setting -file_format can changes the format for a subsequent save.

SEE ALSO

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

Image::Xpm, Image::Xbm, Image::Base::GD, Image::Base::PNGwriter Image::Base::Gtk2::Gdk::Pixbuf

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