|
Posted by Zhiliang Hu on November 4, 2004, 1:02 pm
Please log in for more thread options
I am starter on graphics programming. I got both books "Graphics
Programming with Perl" (by Martien Verbruggen) and "Perl Graphics
Programming" (by Shawn Wallace) but still have difficulties to figure
out how to draw a simple graph like in this example:
http://www.genome.iastate.edu/~hu/example.jpg (horizontal distances
are not critical and should be self-scalable but vertical positions
should be precise).
I tried out examples in the books as well as found on various web
sites -- they work great in the way "they were designed for". I tried
to twick the codes for what I intended to let it do ... without luck
to get anything close to what I wanted. Could someone kindly suggest
a right module and perhaps with hints to help me get started on right
track?
Thanks in advance!
Zhiliang
|
|
Posted by Zhiliang Hu on November 4, 2004, 11:23 pm
Please log in for more thread options
I found simply use "GD" is a good start for my purpose (I went too far
as to try GD::Graph::lines etc among others).
However I have a further question: to build hyperlinks for certain
texts/areas on an image made on-the-fly, is there anything else
besides using "image map"?
Zhiliang
zhilianghu@yahoo.com (Zhiliang Hu) wrote in message
> I am starter on graphics programming. I got both books "Graphics
> Programming with Perl" (by Martien Verbruggen) and "Perl Graphics
> Programming" (by Shawn Wallace) but still have difficulties to figure
> out how to draw a simple graph like in this example:
> http://www.genome.iastate.edu/~hu/example.jpg (horizontal distances
> are not critical and should be self-scalable but vertical positions
> should be precise).
>
> I tried out examples in the books as well as found on various web
> sites -- they work great in the way "they were designed for". I tried
> to twick the codes for what I intended to let it do ... without luck
> to get anything close to what I wanted. Could someone kindly suggest
> a right module and perhaps with hints to help me get started on right
> track?
>
> Thanks in advance!
>
> Zhiliang
|
|
Posted by Zhiliang Hu on November 5, 2004, 11:16 am
Please log in for more thread options I am testing on a simple perl using GD as following:
#!/usr/bin/perl
use GD;
my $newimg = GD::Image->new(400,400,$yellow);
my $white = $newimg->colorAllocate(255, 255, 255); #<--See comment
my $black = $newimg->colorAllocate( 0, 0, 0);
my $red = $newimg->colorAllocate(255, 0, 0);
my $blue = $newimg->colorAllocate( 0, 0, 255);
$newimg->rectangle(0, 0, 399, 399, $red);
$newimg->line(80, 29, 85, 29, $black);
$newimg->line(80, 19, 80, 393, $black);
print "Content-type: image/pngnn";
print $newimg->png;
-- It seems the first "colorAllocate" line in the program determines
the background color? I switched the "colorAllocate" lines - the
background color always follows that of the *first colorAllocate
line". I have not found it documented somewhere. I thought there
should be more obvious way to set background color ...
Is this the way it should be? Any comments?
Zhiliang
|
| Similar Threads | Posted | | [RFC] New module: Graphics::ColorUtils | November 13, 2006, 2:23 pm |
| Graphics Display Message board using Perl? | May 18, 2007, 5:04 pm |
| proper way to include constants; as module or include file? | October 24, 2004, 10:50 pm |
| Perl programmer needed | June 22, 2006, 2:12 am |
| Module name advice: Run::Emacs for probing emacs & running elisp | March 6, 2008, 6:15 pm |
| Net::SFTP and Net::SSH::Perl hangs or disconnets. Help needed. | October 25, 2004, 2:39 am |
| Stream filtering Module/Language needed | September 24, 2007, 5:34 pm |
| What module is needed to allow scripts to post to HTTPS sites? | August 2, 2006, 8:06 am |
| Namcespace advice sought for libevent wrapper | August 14, 2004, 8:26 am |
| Seeking Namespace Advice (MVS OS/390 Mainframe Util.) | March 23, 2005, 8:49 am |
|