I've found and fixed the problem relating to brect. I've committed the
new version of GD.pd to the CVS.

If you check out the latest CVS version of PDL, you should get the fixed
version. I tested with your code (although I don't have your Generic.ttf
file), and it seems to work fine.

-Judd


On Thu, 2007-01-04 at 12:55 -0600, Judd Taylor wrote:
> Zentara,
>       Sorry for the delayed response, I've been out sick for a while now. 
> 
>       The quick response is that you _could_ use the the GD lib to write the
> image to a file, and then read it in using the PDL::IO::GD's read_png()
> function to generate a PDL var from that.
> 
>       As the guy who wrote PDL::IO::GD, however, I'm pretty biased that I'd
> rather get to the bottom of the $brect problem. During the original
> development of the PDL::IO::GD library, I didn't have a working FreeType
> 2.X installation, so I was unable to test those functions (StringFT, and
> StringTTF) properly. I think FT2.X is working on my current machine, so
> I'm looking at the problem right now.
> 
>       Brect comes directly from the GD C library. It appears to want a int[8]
> array pointer, and I'm not certain that's being handled properly by the
> interface generator.
> 
>       I'll post some more info after running some more tests.
> 
> Thanks!
>       Judd
> 
> 
> On Tue, 2006-12-26 at 09:42 -0500, zentara wrote:
> > Hi,
> > 
> > I have a couple of related questions about reading from
> > in memory images, that might be obtained from a network
> > connection, or other means, that are stored in scalar
> > variables( not written to file).
> > 
> > First Question, what is $brect ?
> > I know about PDL::IO::GD, and I was trying to make
> > some images with it, that would be directly converted to
> > piddles without writing to file. I ran into this $brect thing,
> > and can't figure it out.
> > #########################################################
> > #!/usr/bin/perl
> > use PDL::IO::GD;
> > use strict;
> > use warnings;
> > my $im = PDL::IO::GD->new( { x => 50, y => 50, true_color=>1 } );
> > my $black = $im->ColorAllocate( 0, 0, 0 );
> > my $white = $im->ColorAllocate( 255, 255, 255 );
> > # Draw a rectangle:
> > $im->FilledRectangle( 0, 0, 50, 50, $white );
> > # Add some text:
> > #$im->String( gdFontGetLarge(), 20, 20, 'Z', $black );          #works
> > my $brect;  # assuming it contains the returned bounds of the string?
> > $im->StringFT($brect, $black,"./Generic.ttf",12,0,25,25,'Z');  #seg faults
> > $im->write_Png( "$0.png" );
> > ###########################################################
> > 
> > Second Question:
> > I gave up on PDL::IO::GD and went back to GD.
> > I can output to a scalar, but how do I convert that to a piddle?
> > #############################################################
> > #!/usr/bin/perl
> > use GD;
> > use strict;
> > use warnings;
> > 
> > GD::Image->trueColor(1);
> > my ($w, $h) = (50, 50);
> > my $img = GD::Image->new($w, $h);
> > my $white = $img->colorAllocate(255,255,255);
> > my $black = $img->colorAllocate(0,0,0);
> > $img->filledRectangle(0,0,50,50,$white);
> > $img->stringFT($black,"./Generic.ttf",12,0,25,25,'Z');
> > my $out;
> > open (IMG, ">", \$out);
> > print IMG $img->png;
> > close IMG;
> > #############################################################
> > 
> > So $out now contains the binary png, and it may have come from the net,
> > or wherever. How do I read that into a piddle?
> > 
> > It seems all the IO methods take filenames only. 
> > The PDL::IO::FlexRaw module seems closet, but it
> > seems it should be easier. :-)
> > If anyone can share some pointers, I would be grateful.
> > 
> > Thanks,
> > zentara
> > 
-- 
____________________________
Judd Taylor
Software Engineer

Orbital Systems, Ltd.
8304 Esters Blvd, Suite 870
Irving, TX 75063-2209

[EMAIL PROTECTED]
(469) 442-1767 x127


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to