Hi Paul,

Thanks for your tips, though not sure about how to for some?

I used sprintf instead of casting as I want to add the path?

I was only intending to read from 1 file. If I use readfromfile outside of
the loop then the path/filename is added to the previous image and I end up
with a block of black where 0-9 etc., has been superimposed on each image?

I was using utf8 for extra language support, ie Russian, Chinese & Japanese.
I didn't think the plain one supported these?

I though that close() wrote and destroyed the image? Perhaps this is why my
memory allocation gets bigger and bigger? How do I destroy the image at the
end of the routine?

If my questions sound a bit dumb it's because I am new to programming.

Thanks for your help,

Graham.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Blackburn
Sent: Friday, September 17, 2004 7:06 AM
To: [EMAIL PROTECTED]
Subject: Re: [PNGwriter-users] readfromfile

Hi,

I'd like to suggest a few ideas. These are not related to your issue's 
solution, but they might be tips you have overlooked (or not).

You can achieve the same number-indexed png filenames with 
pngwriter_rename(), just cast the iteration variable i to an unsigned 
long int, and use it as the argument for pngwriter_rename(). The .png 
extension will be added automatically.

You don't need to readfromfile() inside the loop, though perhaps you 
were planning on reading from different files later on?

Unless you specifically need the UTF-8 plot_text function, you might 
want to use the plain one. No specific reason for this hint, really.

close() and write_png() are in fact identical. Just different names for 
mnemonic reasons.


I hope these tips are useful.


Paul


On 15 Sep 2004, at 14:58, <[EMAIL PROTECTED]> wrote:

> This program crashes my machine (winxp with MSVC++ 7.10) when using
> burro.png. I notice the memory build up and up and then it dies. I has 
> only
> happened since I began experimenting with readfromfile. Have I done
> something wrong or is there a problem here?

> // xbnbt_test_png.cpp
> //
>
> #include <pngwriter.h>
>
> void test ()
> {
>       pngwriter image( 1, 1, 0.0, "out.png" );
>       image.setcompressionlevel( 0 );
>       char cName[255];
>       
>       for( int i = 0; i != 1000; i++ )
>       {
>               sprintf( cName, "%d.png", i );
>
>               std::cout << "Writing: " << cName;
>
>               image.pngwriter_rename( cName );
>
>               image.readfromfile( "burro.png" );
>
>               image.plot_text_utf8( "arial.ttf", 14 ,4 ,4, 0.0, cName,
> 0.0, 0.0, 0.0 );
>
>               image.write_png();
>                       
>               std::cout << "        Done.\n";
>       }
>       image.close( );
> }
>                       
> int main()
> {
>       test();
>
>       system("PAUSE");
> }
>
> For some reason it crashes at image 508.
>
> Permissions are fine.
>
> Not sure how to send a backtrace but I will find out.
>



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
http://pngwriter.sourceforge.net/
PNGwriter-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pngwriter-users




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
http://pngwriter.sourceforge.net/
PNGwriter-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pngwriter-users

Reply via email to