Looked in CPAN and didnt see anything.
Thanks
Could be overkill, but a Tk::Canvas allows you to dump the contents of
the canvas as a postscript file. It is part of Tk which is a GUI
toolkit, so you won't find all of the functionality offered by
graphics-specific modules like GD.
--Ala
Not a Perl solution, but I use MetaPost
(http://cm.bell-labs.com/who/hobby/MetaPost.html).
It looks like there's a PostScript::Simple module
(http://search.cpan.org/~mcnewton/PostScript-Simple-0.06/).
Jon
#!/bin/perl
use warnings;
use strict;
my $text='Why not learn Postscript?';
print <<ENDPS;
%!PS
%
% define a handy subroutine to scale units
%
/inch { 72 mul } def
%
% draw a blue rectangle
%
0 0 1 setrgbcolor
1 inch 8 inch moveto
6 inch 8 inch lineto
6 inch 9 inch lineto
1 inch 9 inch lineto
closepath
fill
%
% write some text
%
1.8 inch 8.4 inch moveto
/Helvetica findfont 22 scalefont setfont
1 setgray
($text) show
%
% emit page
%
showpage
ENDPS
>BCC wrote:
>
>> Does anyone know of a perl module like GD that will allow me to draw
>> with colors and shapes and save it as a postscript file? GD doesnt give
>> me that option unfortunately.
>>
>> Looked in CPAN and didnt see anything.
Create a tk Canvas, and create what you want, then use the
postscript method to save it. A typical "save" routine looks something
like this:
##########################################
$main->Button(
-text => "Save",
-command => [sub {
$canvas->update;
my @capture=();
my ($x0,$y0,$x1,$y1)=$canvas->bbox('all');
@capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x0);
$canvas->postscript(-colormode=>'color',
-file=>$0.'.ps',
-rotate=>0,
-width=>800,
-height=>500,
@capture);
}
] )->pack;
###########################################
Now you have a wide variety of options on how to generate
your Canvas. You can do it programatically, or use some sort
of mouse-GUI.
For examples of that,
http://perlmonks.thepen.com/176475.html
or
ged at
http://www.duehl.de/christian/perl/ged.html
The cpan module Tk::WorldCanvas might be helpful too.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html