It is possible to draw with graphics primitives onto images. Such
primitives include boxes, arcs, circles, polygons and lines. The
coordinate system in Imager has the origin C<(0,0)> in the upper left
-corner of an image. For non antialiasing operation all coordinates are
-rounded towards the nearest integer. For antialiased operations floating
+corner of an image with co-ordinates increasing to the right and
+bottom. For non antialiasing operation all coordinates are rounded
+towards the nearest integer. For antialiased operations floating
point coordinates are used.
Drawing is assumed to take place in a coordinate system of infinite
objects, an reference to an array containing Imager::Color::Float
objects or a scalar containing packed color data.
+If C<type> is C<index> then this can either be a reference to an array
+of palette color indexes or a scalar containing packed indexes.
+
See L</"Packed Color Data"> for information on the format of packed
color data.
You can use float or 8bit samples with any image.
+If this is 'index' then pixels should be either an array of palette
+color indexes or a packed string of color indexes.
+
=back
Returns the number of pixels set.
type - the type of pixel data to return. Default: C<8bit>.
-Permited values are C<8bit> and C<float>.
+Permited values are C<8bit> and C<float> and C<index>.
=back
In list context this method will return a list of Imager::Color
objects when I<type> is C<8bit>, or a list of Imager::Color::Float
-objects when I<type> if C<float>.
+objects when I<type> if C<float>, or a list of integers when I<type>
+is C<index>.
In scalar context this returns a packed 8-bit pixels when I<type> is
C<8bit>, or a list of packed floating point pixels when I<type> is
-C<float>.
+C<float>, or packed palette color indexes when I<type> is C<index>.
The values of samples for which the image does not have channels is
undefined. For example, for a single channel image the values of
my $packed_float_pixel = pack("dddd", $red, $blue, $green, $alpha);
+If you use a I<type> parameter of C<index> then the values are palette
+color indexes, not sample values:
+
+ my $im = Imager->new(xsize => 100, ysize => 100, type => 'paletted');
+ my $black_index = $im->addcolors(colors => [ 'black' ]);
+ my $red_index = $im->addcolors(colors => [ 'red' ]);
+ # 2 pixels
+ my $packed_index_data = pack("C*", $black_index, $red_index);
+ $im->setscanline(y => $y, pixels => $packed_index_data, type => 'index');
+
=head1 BUGS
box, arc, do not support antialiasing yet. Arc, is only filled as of