GD - colorAllocate

Posted on Fri Oct 20 07:41:46 2006 by cat
colorAllocate
hi, i have a 24x22 data matrix, i want to assign different color for each value to get a coloful grid. here is my code for color allocation:
for (my $ld = 1; $ld <= $#dataline; $ld++){ my $col = $dataline[$ld]; my $r = $grad_color[$col][0]; my $g = $grad_color[$col][1]; my $b = $grad_color[$col][2]; my $colorhere; $colorhere = $im -> colorAllocate($r, $g, $b); print "due $col,$r,$g,$b," if ($verbose == 1); $im->filledRectangle( $origin[0] + $factor*$ld, $origin[1] + $factor*$lineNo, $origin[0] + $factor + $factor*$ld, $origin[1] + $factor + $factor*$lineNo, $colorhere);
this way, i can only assign the right color to the first 12.5 row, all the others show only one color ( they are having differenct $r, $g and $g). it looks to me that the gd.pm has some limitation to assign colors. if it is true, what is the limitation ? thanks. yong
Write a response