Slaven Rezić
and 1 contributors


Tk::CanvasFig - additional Tk::Canvas methods for dealing with figs


    use Tk::CanvasFig;
    $canvas->fig(-file => $filename, -imagedir => $filename."-images");


This module adds another method to the Tk::Canvas namespace: fig. The fig method creates a xfig compatible file from the given canvas. The output is written to a file if the -file option is specified, otherwise it is returned as a string. The creation of images is only supported if the -imagedir option is specified.



The file name for the FIG output. If this option is not specified, then the result will be returned as a string.


If images are included in the canvas, then they will be written into the directory specified by this option. The directory has to exist. If this option is not specified, no images are created.


The image type for the images created in -imagedir. By default, xpm is used, but every Tk-supported and xfig-supported image type can be used. Note that a plain xfig build does not have xpm support. Also note that xfig uses external programs for decoding other file formats like gif or ppm, so this can be *very* slow if you have a lot of images in the canvas. If netpbm with ppmtopcx is installed, the image type pcx can be used, for which xfig does not need an external program. See also "BUGS".


Not all canvas items are implemented (grid, groups).

Not everything is perfect.

xfig 3.2.3d dumps core if xpm images with more than 256 colors are used. If you have such images, you have to use another -imagetype.

Transparency will only be handled in xpm images correctly. This is because netpbm programs does not handle transparency.


Tk, Tk::Canvas, xfig(1)


Slaven Rezic <>


Copyright (c) 1998, 2001, 2002, 2009 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.