Flavio Poletti > Graphics-Potrace-0.1.0_03 > Graphics::Potrace::Raster::Importer

Download:
Graphics-Potrace-0.1.0_03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1.0_03   Source   Latest Release: Graphics-Potrace-0.73

NAME ^

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

VERSION ^

version 0.1.0_03

DESCRIPTION ^

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.

INTERFACE ^

clear_target

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

has_target

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

load_data

   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.

load

   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.

load_handle

   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.

new

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

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

target

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

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.

AUTHOR ^

Flavio Poletti <polettix@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 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.

syntax highlighting: