On Tue, Apr 20, 2010 at 9:28 AM, Judd Taylor <[email protected]> wrote:
> Puneet,
>
> You are exactly correct. The code generator has a few functions where
> it pluralizes a function name to indicate that it will operate on
> piddles of the required args.
> I just did some quick tests in the perldl shell to verify that this
> does indeed work, and it does indeed work.
>
> When I did the test, the color I used was not a piddle (ie it was a
> simple perl scalar, with the index of the color that was allocated for
> that gdImage). This worked due to some of the PDL::PP or threading magic
> that David was mentioning earlier.
>
Very nice, but I am unclear about the above sentence...
So, you are saying that in your test, you *didn't* use a piddle for
the color value (just as David didn't). Is that correct? I would want
to use a piddle, because I would want a different color for every dot.
I would calculate the value of the color using the values of the
variables that I want to map. Actually, ideally, a hypothetical
command like so would be tremendously useful...
$x = pdl @x; # x coords
$y = pdl @y, # y coords
$var = pdl @var; # the var that is to be mapped
$lut = pdl lookup table; # for every value of $var, retrieve the color
from the lut
$image->gdImageSetPixels( $x, $y, $var, $lut );
from my personal perspective, an even better option would be to
integrate this with PostGIS like so
1> $sth->$dbh(prepare("SELECT x, y, var FROM table WHERE whatever");
2> my $sth->execute;
3> my $res = $sth->fetchall_arrayref;
4>
5> convert $res to piddle here.
6>
7> Then,
8>
9> $image->gdImageSetPixels( $res, $lut );
I can drum up the lines 1 through 8 above myself, but 9 would be a
very useful addition to the GIS toolbox.
> -Judd
>
>
> On Tue, 2010-04-20 at 00:09 -0500, P Kishor wrote:
>> Hi Judd,
>>
>> I am looking for documentation on $image->SetPixels( $x(pdl), $y(pdl),
>> $color(pdl) ) and other related commands such as
>> $image->FilledRectangles( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
>> $color(pdl) ). Your instructions say that these are aliases for
>> commands in the GD library that start with 'gdImage', but there is no
>> gdImageSetPixels in GD. I am assuming the pluralized version sets
>> pixels at the points represented by the entire piddles, but I can't
>> grok the usage/syntax for this.
>>
>> what is $x(pdl)? Is that a 1D pdl of all the x coords in the image,
>> essentially a list of x coords? I have gone through the source code of
>> your module, and I don't see anything except the following --
>>
>> # Allow operation on these member function on piddles as well:
>> #int gdImageGetPixel (gdImagePtr im, int x, int y);
>> generate_pp_def_members( <<'ENDMEMBERS' );
>> ..
>> void gdImageSetPixel (gdImagePtr im, int x, int y, int color);
>> ..
>> void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2,
>> int y2, int color);
>> ..
>> ENDMEMBERS
>>
> --
> ____________________________
> Judd Taylor
> Software Engineer
>
> Orbital Systems, Ltd.
> 3807 Carbon Rd.
> Irving, TX 75038-3415
>
> [email protected]
> (972) 915-3669 x127
>
--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl