Flavio Poletti


Graphics::Potrace::Raster::Importer - vectorial exporter base class for Graphics::Potrace


version 0.76


This is a base class for building up raster importers. One example of using this base class is shipped directly in the distribution as Graphics::Potrace::Raster::Ascii.

You only need to override one of three methods: "load_handle" or "load_data".

In this class these two methods are both defined in terms of the other, so that you can really override only one of them and get the other one for free.



Clears the currently set target raster (see "target").


Checks whether the object has a target bitmap for load operations or not. See also "target".


   my $bitmap = $importer->load_data($scalar);

Import data from a scalar variable. The format the data inside the $scalar depends on the particular derived class.


   my $bitmap = $importer->load(data => $scalar);
   my $bitmap = $importer->load(file => $filename);
   my $bitmap = $importer->load(fh => $filehandle);

Import data from a scalar, a file or a filehandle. The format of the data in the file/filehandle depends on the derived class. This method leverages upon /load_data and "load_handle". In this way you can use one single method and decide what you want to pass in exactly.


   my $bitmap = $importer->load_handle($filehandle);

Import data from a filehandle. This functionality is already covered by "load" above, but this method is more useful for overriding in derived classes.


   my $i = Graphics::Potrace::Raster::Importer->new(%args);

Constructor. The only common parameter that you can set is target, corresponding to set "target".


   my $raster = $importer->target();

Quasi-accessor for setting the target bitmap for the import. This is a quasi-accessor because if no target is currently defined (you can check it with /has_target) then a new one will be provided each time you call this method.


Flavio Poletti <polettix@cpan.org>


Copyright (C) 2011-2015 by Flavio Poletti polettix@cpan.org.

This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program 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.