NAME
Image::Base::Imlib2 -- draw images using Imlib2
SYNOPSIS
use Image::Base::Imlib2;
my $image = Image::Base::Imlib2->new (-width => 100,
-height => 100);
$image->rectangle (0,0, 99,99, '#FFF'); # white
$image->xy (20,20, '#000'); # black
$image->line (50,50, 70,70, '#FF00FF');
$image->line (50,50, 70,70, '#0000AAAA9999');
$image->save ('/some/filename.png');
CLASS HIERARCHY
Image::Base::Imlib2
is a subclass of Image::Base
,
Image::Base
Image::Base::Imlib2
DESCRIPTION
Image::Base::Imlib2
extends Image::Base
to create or update image files using the Image::Imlib2
module.
The following file formats are available, as of Imlib2 1.4.4, provided Imlib2 was built with necessary supporting libraries (such as libpng
).
PNG, JPEG, TIFF, PNM, BMP
GIF read-only
XPM read-only
TGA Targa
LBM Amiga Paint, read-only
ARGB raw something format (?)
Colour Names
There's no named colours as such, only hex and a special "None" for transparent
#RGB
#RRGGBB
#RRRGGGBBB
#RRRRGGGGBBBB
None transparent
When an XPM file is loaded the /usr/share/X11/rgb.txt file (possibly in other directories) is consulted for named colours in the XPM, but that's not made available to drawing operations as such.
FUNCTIONS
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Imlib2->new (key=>value,...)
-
Create and return a new image object. A new image can be started with
-width
and-height
,$image = Image::Base::Imlib2->new (-width => 200, -height => 100);
Or an existing file can be read,
$image = Image::Base::Imlib2->new (-file => '/some/filename.png');
Or an
Image::Imlib2
object can be given,my $imlibobj = Image::Imlib2->new (20, 10); $image = Image::Base::Imlib2->new (-imlib => $imlibobj);
$new_image = $image->new (key=>value,...)
-
Create and return a copy of
$image
. The Imlib2 object within$image
is cloned per$imlib->clone()
. Optional key/value parameters are applied to the new image as per$image->set()
.# copy image, new quality level my $new_image = $image->new (-quality_percent => 100);
$image->load ()
$image->load ($filename)
-
Read the
-file
, or set-file
to$filename
and then read.This creates and sets a new underlying
-imlib
object because it's not possible to read into an existing object, only create a new one for the load. $image->save ()
$image->save ($filename)
-
Save to
-file
, or with a$filename
argument set-file
then save to that.The file format is taken from the
-file_format
attribute (see below).
ATTRIBUTES
-width
(integer, create-only)-height
(integer, create-only)-
The size of the underlying
Image::Imlib2
is set when created and can't be changed after that. (Is that right?) -imlib
-
The underlying
Image::Imlib2
object. -file_format
(string, write-only)-
The file format as a string like "png" or "jpeg".
After
load()
the-file_format
is the format read. Setting-file_format
can change the format for a subsequentsave()
.This is applied with
$imlib->set_file_format()
and is currently write-only. -quality_percent
(0 to 100, write-only)-
The image quality for saving to JPEG format. JPEG compresses by reducing colours and resolution in ways that are not too noticeable to the human eye. 100 means full quality, no such reductions.
For PNG, Imlib2 turns this into a Zlib compression level, but the intention is to have a separate
-zlib_compression
attribute (ifImage::Imlib2
offers the necessaryimlib_image_attach_data_value()
).
BUGS
Imlib2 interprets filenames like "name:foo.bar" with a colon as meaning a sub-part of some file formats. If the full "name:foo.bar" exists (and is a ordinary file, not a char special) then it loads that, otherwise it tries "name" alone. This is unlike other Image::Base
modules and the intention would be to avoid it in the interests of consistency and being certain what file is opened, but it's not clear if that's possible.
For reference, in the current implementation ellipse()
is done with the Image::Base
superclass code, since the native ellipse drawing in Imlib2 1.4.4 seems a bit dubious, seeming to go outside the requested size. In any case the native ellipse parameters are integers for an x,y centre and a,b semi-radii which would mean it could only be for odd sizes anyway, ie. $x2-$x1+1
and $y2-$y1+1
both odd numbers.
SEE ALSO
Imlib2 documentation
http://docs.enlightenment.org/api/imlib2/html/index.html
file://usr/share/doc/libimlib2-dev/html/index.html
HOME PAGE
http://user42.tuxfamily.org/image-base-imlib2/index.html
LICENSE
Image-Base-Imlib2 is Copyright 2011 Kevin Ryde
Image-Base-Imlib2 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-Imlib2 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-Imlib2. If not, see <http://www.gnu.org/licenses/>.