-- $Date: 2004/02/23 08:44:24 $
-- $Revision: 1.13 $
-- $Author: jcrocholl $

with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;

with Gray_Images; use Gray_Images;

package PGM is

   -- Raised if the magic number is not P5.
   Expect_P5 : exception;

   -- Raised if the maxval is not 255.
   Expect_Maxval_255 : exception;

   -- Read a gray image from a portable graymap stream.
   function Read
     (Stream : in Stream_Access-- Read from this stream.
     return Gray_Image_Access;   -- The newly created image.

   -- Read a gray image from a portable graymap file.
   function Read
     (Filename : in String)    -- Open a file with this name.
     return Gray_Image_Access-- The newly created image.

   -- Write a gray image to a portable graymap stream.
   procedure Write
     (Stream : in Stream_Access;              -- Write to this stream.
      Image  : access Gray_Image'Class); -- Write this image to the stream.

   -- Write a gray image to a portable graymap file.
   procedure Write
     (Filename : in String;                     -- Create a file with this name.
      Image    : access Gray_Image'Class); -- Write this image to the file.

   -- Write a gray image to a portable graymap file on standard output.
   procedure Write
     (Image : access Gray_Image'Class); -- Write this image to stdout.

end PGM;