Provided by: libimage-base-bundle-perl_1.0.7-3.5_all bug

NAME

       Image::Base - base class for loading, manipulating and saving images.

SYNOPSIS

       This class should not be used directly. Known inheritors are Image::Xbm and Image::Xpm.

           use Image::Xpm ;

           my $i = Image::Xpm->new( -file => 'test.xpm' ) ;
           $i->line( 1, 1, 3, 7, 'red' ) ;
           $i->ellipse( 3, 3, 6, 7, '#ff00cc' ) ;
           $i->rectangle( 4, 2, 9, 8, 'blue' ) ;

       If you want to create your own algorithms to manipulate images in terms of (x,y,colour)
       then you could extend this class (without changing the file), like this:

           # Filename: mylibrary.pl
           package Image::Base ; # Switch to this class to build on it.

           sub mytransform {
               my $self  = shift ;
               my $class = ref( $self ) || $self ;

               # Perform your transformation here; might be drawing a line or filling
               # a rectangle or whatever... getting/setting pixels using $self->xy().
           }

           package main ; # Switch back to the default package.

       Now if you "require" mylibrary.pl after you've "use"d Image::Xpm or any other Image::Base
       inheriting classes then all these classes will inherit your "mytransform()" method.

DESCRIPTION

   new_from_image()
           my $bitmap = Image::Xbm->new( -file => 'bitmap.xbm' ) ;
           my $pixmap = $bitmap->new_from_image( 'Image::Xpm', -cpp => 1 ) ;
           $pixmap->save( 'pixmap.xpm' ) ;

       Note that the above will only work if you've installed Image::Xbm and Image::Xpm, but will
       work correctly for any image object that inherits from Image::Base and respects its API.

       You can use this method to transform an image to another image of the same type but with
       some different characteristics, e.g.

           my $p = Image::Xpm->new( -file => 'test1.xpm' ) ;
           my $q = $p->new_from_image( ref $p, -cpp => 2, -file => 'test2.xpm' ) ;
           $q->save ;

   line()
           $i->line( $x0, $y0, $x1, $y1, $colour ) ;

       Draw a line from point ($x0,$y0) to point ($x1,$y1) in colour $colour.

   ellipse()
           $i->ellipse( $x0, $y0, $x1, $y1, $colour ) ;

       Draw an oval enclosed by the rectangle whose top left is ($x0,$y0) and bottom right is
       ($x1,$y1) using a line colour of $colour.

   rectangle()
           $i->rectangle( $x0, $y0, $x1, $y1, $colour, $fill ) ;

       Draw a rectangle whose top left is ($x0,$y0) and bottom right is ($x1,$y1) using a line
       colour of $colour. If $fill is true then the rectangle will be filled.

   new()
       Virtual - must be overridden.

       Recommend that it at least supports "-file" (filename), "-width" and "-height".

   new_from_serialised()
       Not implemented. Recommended for inheritors. Should accept a string serialised using
       serialise() and return an object (reference).

   serialise()
       Not implemented. Recommended for inheritors. Should return a string representation
       (ideally compressed).

   get()
           my $width = $i->get( -width ) ;
           my( $hotx, $hoty ) = $i->get( -hotx, -hoty ) ;

       Get any of the object's attributes. Multiple attributes may be requested in a single call.

       See "xy" get/set colours of the image itself.

   set()
       Virtual - must be overridden.

       Set any of the object's attributes. Multiple attributes may be set in a single call; some
       attributes are read-only.

       See "xy" get/set colours of the image itself.

   xy()
       Virtual - must be overridden. Expected to provide the following functionality:

           $i->xy( 4, 11, '#123454' ) ;    # Set the colour at point 4,11
           my $v = $i->xy( 9, 17 ) ;       # Get the colour at point 9,17

       Get/set colours using x, y coordinates; coordinates start at 0.

       When called to set the colour the value returned is class specific; when called to get the
       colour the value returned is the colour name, e.g. 'blue' or '#f0f0f0', etc, e.g.

           $colour = xy( $x, $y ) ;  # e.g. #123456
           xy( $x, $y, $colour ) ;   # Return value is class specific

       We don't normally pick up the return value when setting the colour.

   load()
       Virtual - must be overridden. Expected to provide the following functionality:

           $i->load ;
           $i->load( 'test.xpm' ) ;

       Load the image whose name is given, or if none is given load the image whose name is in
       the "-file" attribute.

   save()
       Virtual - must be overridden. Expected to provide the following functionality:

           $i->save ;
           $i->save( 'test.xpm' ) ;

       Save the image using the name given, or if none is given save the image using the name in
       the "-file" attribute. The image is saved in xpm format.

CHANGES

       2000/05/05

       Added some basic drawing methods. Minor documentation changes.

       2000/05/04

       Created.

AUTHOR

       Mark Summerfield. I can be contacted as <summer@perlpress.com> - please include the word
       'imagebase' in the subject line.

COPYRIGHT

       Copyright (c) Mark Summerfield 2000. All Rights Reserved.

       This module may be used/distributed/modified under the LGPL.