NAME
Gimp::Tile - The Tile family of functions.
SYNOPSIS
use Gimp; # Gimp::Tile is part of Gimp
DESCRIPTION
Tiles are the basic building blocks of all Gimp drawable. Each drawable consists of a grid of tiles, eahc tile having the same size. The size of a tile is always the same (it's hardcoded in your Gimp program).
The gimp_tile_width
and gimp_tile_height
functions return the current width/height of a tile (at the moment, this is 64x64).
How do I get a tile? First, you have to grab a GDrawable structure. You can get one from any drawable, by calling the get
function:
my $gdrawable = $drawable->get;
in a sense, <$gdrawable> contains all tiles. Changes you make to them might not be reflected in the image until you destroy this variable. (Thats the reason I used "my" int he above example. Once $gdrawable gets out of scope, the drawable in the gimp automatically gets updated).
To get access to a tile, you have to call get_tile
or get_tile2
. get_tile
expects row/column numbers of the tile, while get_tile2
expects pixel coordinates and will return the tile that pixel is in:
my $tile = $gdrawable->get_tile2(75,60,1,0);
The data
method returns and sets the raw pixel data.
$packed_data = $tile->data; # you don't want this, use Gimp::PDL $tile->data($packed_data); # and modify the tile
BUGS
Reference counting should make sure the GDrawable is released only when no tile/region is around any longer. Should be relatively easy. Also, the Regions should automatically call update. This bugs section should go into Gimp(3), instead. Huh, all is wrong somewhow...
AUTHOR
Marc Lehmann <pcg@goof.com>
SEE ALSO
perl(1), Gimp(1), Gimp::PixelRgn(3),