| Image-Base-PNGwriter documentation | view source | Contained in the Image-Base-PNGwriter distribution. |
Image::Base::PNGwriter -- draw PNG format images
use Image::Base::PNGwriter;
my $image = Image::Base::PNGwriter->new (-width => 100,
-height => 100);
$image->line (0,0, 99,99, '#FF00FF');
$image->rectangle (10,10, 20,15, 'white');
$image->ellipse (30,30, 90,90, '#AAAA3333DDDD');
$image->save ('/some/filename.png');
Image::Base::PNGwriter is a subclass of Image::Base,
Image::Base
Image::Base::PNGwriter
Image::Base::PNGwriter extends Image::Base to create or update PNG
format image files using the Image::PNGwriter module and pngwriter
library.
The native PNGwriter has more features, but this module is an easy way to
point Image::Base style code at a PNGwriter and is a good way to get PNG
out of some Image::Base code.
There's no colour name database as yet, only "black", "white" and hex "#RRGGBB" or "#RRRRGGGGBBBB".
X,Y coordinates are the usual Image::Base style 0,0 at the top-left
corner. The underlying pngwriter library is 1,1 as the bottom-left but
Image::Base::PNGwriter converts.
$image = Image::Base::PNGwriter->new (key=>value,...)Create and return an image object. A new image can be started with
-width and -height,
$image = Image::Base::PNGwriter->new (-width => 200,
-height => 100);
Or an existing file can be read,
$image = Image::Base::PNGwriter->new
(-file => '/some/filename.png');
Or an Image::PNGwriter object can be given,
$image = Image::Base::PNGwriter->new (-pngwriter => $pwobj);
$image->ellipse ($x1,$y1, $x2,$y2, $colour)$image->ellipse ($x1,$y1, $x2,$y2, $colour, $fill)Draw an ellipse within the rectangle with top-left corner $x1,$y1 and
bottom-right $x2,$y2. Optional $fill true means a filled ellipse.
In the current implementation circles with an odd diameter (meaning
$x2-$x1+1 is an odd number and equal to $y2-$y1+1) are drawn with
PNGwriter and the rest go to Image::Base. This is a bit inconsistent but
uses the features of PNGwriter as far as possible and its drawing should be
faster.
The following attributes can be get and set.
-file (string filename)The file to load in a new, and the default filename for subsequent
save or load.
-width (integer)-height (integer)Setting these changes the size of the image, but also clears it to all black. The image must be at least 1x1 pixels.
-zlib_compression (integer 0-9 or -1)The amount of data compression to apply when saving. The value is Zlib style 0 for no compression up to 9 for maximum effort. -1 means Zlib's default level.
-pngwriter (Image::PNGwriter object)The underlying Image::PNGwriter object in use.
Because filename and compression level can't be read out of a pngwriter
object, if you set -pngwriter then a get of the -file or
-zlib_compression will return undef and there's no default filename
for load. A save will use the filename and compression in the object
though. Perhaps this will improve in the future.
http://user42.tuxfamily.org/image-base-pngwriter/index.html
Image-Base-PNGwriter is Copyright 2010, 2011 Kevin Ryde
Image-Base-PNGwriter 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-PNGwriter 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-PNGwriter. If not, see <http://www.gnu.org/licenses/>.
| Image-Base-PNGwriter documentation | view source | Contained in the Image-Base-PNGwriter distribution. |