Tk

 view release on metacpan or  search on metacpan

pod/Photo.pod  view on Meta::CPAN


=item I<$image>-E<gt>B<copy>(I<sourceImage> ?,I<option value(s) ...>?)

Copies a region from the image called I<$sourceImage> (which must
be a photo image) to the image called I<$image>, possibly with
pixel zooming and/or subsampling.  If no options are specified, this
method copies the whole of I<$sourceImage> into I<$image>,
starting at coordinates (0,0) in I<$image>.  The following
options may be specified:

=over 8

=item B<-from> =E<gt> I<x1, y1, ? ,x2, y2?>

Specifies a rectangular sub-region of the source image to be copied.
(I<x1,y1>) and (I<x2,y2>) specify diagonally opposite corners of
the rectangle.  If I<x2> and I<y2> are not specified, the
default value is the bottom-right corner of the source image.  The
pixels copied will include the left and top edges of the specified
rectangle but not the bottom or right edges.  If the B<-from>
option is not given, the default is the whole source image.

=item B<-to> =E<gt> I<x1, y1, ?, x2, y2?>

Specifies a rectangular sub-region of the destination image to be
affected.  (I<x1,y1>) and (I<x2,y2>) specify diagonally opposite
corners of the rectangle.  If I<x2> and I<y2> are not specified,
the default value is (I<x1,y1>) plus the size of the source
region (after subsampling and zooming, if specified).  If I<x2> and
I<y2> are specified, the source region will be replicated if
necessary to fill the destination region in a tiled fashion.

=item B<-shrink>

Specifies that the size of the destination image should be reduced, if
necessary, so that the region being copied into is at the bottom-right
corner of the image.  This option will not affect the width or height
of the image if the user has specified a non-zero value for the
B<-width> or B<-height> configuration option, respectively.

=item B<-zoom> =E<gt> I<x, y>

Specifies that the source region should be magnified by a factor of
I<x> in the X direction and I<y> in the Y direction.  If I<y>
is not given, the default value is the same as I<x>.  With this
option, each pixel in the source image will be expanded into a block
of I<x> x I<y> pixels in the destination image, all the same
color.  I<x> and I<y> must be greater than 0.

=item B<-subsample> =E<gt> I<x, y>

Specifies that the source image should be reduced in size by using
only every I<x>th pixel in the X direction and I<y>th pixel in
the Y direction.  Negative values will cause the image to be flipped
about the Y or X axes, respectively.  If I<y> is not given, the
default value is the same as I<x>.

=item B<-compositingrule> =E<gt> I<rule>

Specifies how transparent pixels in the source image are combined with
the destination image.  When a compositing rule of I<overlay> is
set, the old contents of the destination image are visible, as if the
source image were printed on a piece of transparent film and placed
over the top of the destination.  When a compositing rule of I<set>
is set, the old contents of the destination image are discarded and
the source image is used as-is.  The default compositing rule is
I<overlay>.

=back

=item I<$image>-E<gt>B<data>(?I<option value(s), ...>?)

Returns image data in the form of a string.
The following options may be specified:

=over 8

=item B<-background> =E<gt> I< color>

If the color is specified, the data will not contain any transparency
information. In all transparent pixels the color will be replaced by
the specified color.

=item B<-format> =E<gt> I<format-name>

Specifies the name of the image file format handler to be used.
Specifically, this method searches
for the first handler whose name matches a initial substring of
I<format-name> and which has the capability to read this image data.
If this option is not given, this method uses the first
handler that has the capability to read the image data.

=item B<-from> =E<gt> I<x1, y1, ?, x2, y2?>

Specifies a rectangular region of I<$image> to be 
returned.  If only I<x1> and I<y1> are specified, the region
extends from I<(x1,y1)> to the bottom-right corner of
I<$image>.  If all four coordinates are given, they specify
diagonally opposite corners of the rectangular region, including x1,y1
and excluding x2,y2.  The default,
if this option is not given, is the whole image.

=item B<-grayscale>

If this options is specified, the data will not contain color
information. All pixel data will be transformed into grayscale.

=back

=item I<$image>-E<gt>B<get>(I<x, y>)

Returns the color of the pixel at coordinates (I<x>,I<y>) in the
image as a list of three integers between 0 and 255, representing the
red, green and blue components respectively.

=item I<$image>-E<gt>B<put>(I<data> ?,B<-format>=E<gt>I<format-name>? ?,B<-to>=E<gt>I< x1 y1 ?x2 y2?>?)

Sets pixels in I<$image> to the data specified in I<data>.
This command first searches the list of image file format handlers for
a handler that can interpret the data in I<data>, and then reads
the image encoded within into I<$image> (the destination image).
If I<data> does not match any known format, an attempt to interpret
it as a (top-to-bottom) list of scan-lines is made, with each
scan-line being a (left-to-right) list of pixel colors (see
B<Tk_GetColor> for a description of valid colors.)  Every scan-line
must be of the same length.  Note that when I<data> is a single
color name, you are instructing Tk to fill a rectangular region with



( run in 0.879 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )