Re: [fpc-pascal]How to load a png image

2003-12-22 Thread Karim
Thanks you Michalis. 
The main libpng page seems to be down, but I will check it out. 
I`m looking for a small and easy loadable image format. I think, png will
do the job well. 

Greetings   Karim 


On Sun, 21 Dec 2003 23:26:08 +0100, "Michalis Kamburelis"
<[EMAIL PROTECTED]> said:
> Karim wrote:
> > Hello 
> > 
> > I want to know, how to load a png image with freepascal ?
> > There is a png libpng package shipped with FreePascal, but I cannot find
> > any examples or docs. 
> 
> Pascal unit Libpng is just a wrapper that calls functions from 
> libpng.so. Documentation for libpng is available at the official page of 
> libpng, http://www.libpng.org, you will most likely be interested in 
> this document:
>http://www.libpng.org/pub/png/libpng-1.2.5-manual.html
> 
> > Or are there any onther simple image formats that can be loaded into a
> > freepascal program ?
> 
> Well, everything can be loaded into a Pascal program...
> 
> The simplest possible image format is ppm (it is just a small header + 
> array of RGB values for each pixel) - if you are on UNIX-like system and 
> have installed proper documentation then
>man ppm
> should give you a simple specification of ppm format. You may also take 
> a look at it's cousins, pbm, pgm and the most general one, pnm.
> 
> Regards,
> Michalis
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-- 
  Karim
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]opening files from a text list

2003-12-22 Thread DONALD PEDDER
   Firstly, my current challenge, and then some responses to some other
comments that were made.

> > replace result:= by scanblack:=
>
>That was the missing piece of the puzzle. Thank you (and to Anton
> too)!

   I've started actually writing my code now (I have a very busy life, so
it sometimes takes a while to get back to things), and I am having issues
in reading numbers. e.g. "49ers at Giants 16 13" (I know I didn't mention
this to begin with, but I didn't think reading the score would be an
issue, and it is).
   When I've read everything up to the score (using scanblack/scanwhite),
and then do "read(line,awayscore)" the program hangs (using read now, as I
want to read the number and not a word). Experimentation showed me it was
waiting for standard input, even though I've specified to read from the
line I have scanned in. :-\
   I know the result of scanblack is a string and not a number, so would I
modify it to (hopefully) also read in numbers? Can I make it do both, or
would I perhaps write another function to read numbers? I don't know if
the latter would work, given that "read(line," isn't working.


> What happens if the "Mighty Ducks" or the "White Sox"--or my favorite,
> "Eat at Joe's" play?

   Not an issue as the only person who'll be using this program is me. :-)
The input format is totally determined by me, and the code written
accordingly (the input format is often even chosen to make the code
easiest).


> @Donald: There ARE problems when reading numbers, e. g. "1000.0" is
> sometimes written as "1000,0", "1'000.0", "1,000.00" or even
> "1,000.--".

   Right, yet Pascal implements reading numbers as long as it is digits
only. If you don't have digits only, then you know you'll have to write
extra code to cope (perhaps reformatting the file first before processing,
which is what I do with some of my stuff).
   Why not have a similar approach with reading words? A word is either
something that is entirely a-z,A-Z, or anything space-delimited. Anything
outside of that case (whichever approach is taken), just like with numbers
with non-digits in them, you write extra code, but at least when the
format allows it you have an easy way to read words (something which I now
have with this scanblack code, which makes life much easier than it was
:-) ).

thanks,
   DONALD.

E-mail   - [EMAIL PROTECTED]
BIG DON's Home-page  - http://jedi.apana.org.au/~jims_son
Pedder Passer Rating - http://jedi.apana.org.au/~jims_son/PPR
AusNFL mailing-list  - http://jedi.apana.org.au/mailman/listinfo/ausnfl

"What I always wanted is to be accepted, not understood" - MAN RAY

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]opening files from a text list

2003-12-22 Thread DONALD PEDDER
>When I've read everything up to the score (using scanblack/scanwhite),
> and then do "read(line,awayscore)" the program hangs (using read now, as I
> want to read the number and not a word).

   P.S. "awayscore" IS defined as an integer, in case anyone is going to
ask me if I've defined it correctly. "scanblack" returns a string, so I
don't know how to return a number when required ("read(line,awayscore)"
not working was un-expected - I guess maybe you can't read a number from
a string, only from standard input/text file).

dp.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]opening files from a text list

2003-12-22 Thread Anton Tichawa
Hello!

On Monday 22 December 2003 19:37, DONALD PEDDER wrote:
>When I've read everything up to the score (using scanblack/scanwhite),
> and then do "read(line,awayscore)" the program hangs (using read now, as I
> want to read the number and not a word). Experimentation showed me it was
> waiting for standard input, even though I've specified to read from the
> line I have scanned in. :-\
>I know the result of scanblack is a string and not a number, so would I
> modify it to (hopefully) also read in numbers? Can I make it do both, or
> would I perhaps write another function to read numbers? I don't know if
> the latter would work, given that "read(line," isn't working.

You can convert a string s, previously read in by scanblack, to a number:

var
  number: integer;
  code: integer;
begin
  // (read in string s)
  val(s, number, code);
  if code <> 0 then begin
// error: the string s is not valid
  end;

(This is just from memory - I didn't test it.)

Ciao,

Anton.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal