Hi Graham,


On 17 Sep 2004, at 11:51, Graham Fairweather wrote:


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

Ah, true, in that case you're absolutely correct.


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?

Ah, of course, I hadn't thought of that. How about this idea: Create two instances. Load one with readfromfile().


The program might be something like

create temp
create master

master.readfromfile("burro.png");

loop:
 {
temp = master;
temp.plot_text_utf8();
temp.write_png();
}


And you're done! I've used the assignment operator = to easily set temp's contents to that of master. This is much faster than reading the file every time in the loop.




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

No, it doesn't, you are right in using the UTF8 version if you want to support other languages.



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?


Ah, I fell for this misconception a while ago (despite the fact that I myself wrote the library, go figure), but if you check the PNGwriter source code, you'll notice that all it does is write the image to disk. The instance's destructor is called when (as far as I can remember) when no other piece of memory refers to it, or at the end of the scope, just like any other variable, so in theory no, you don't need to destroy the instance.

If you are sure that your memory allocation increases constantly, then I can go and take a look in the PNGwriter source code, to see if something's amiss, perhaps there's a memory leak. On the other hand, it may just be the way the compiler has compiled the program. I'm not much of an expert on these matters, but if you say that the program's memory use increases drastically, then I'll take a look and see what I can find.



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

Oh, don't worry about that, I'm only an amateur programmer myself :-)




Paul



-------------------------------------------------------
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