Adonthell  0.4
pnm.h
Go to the documentation of this file.
1 /*
2  $Id: pnm.h,v 1.10 2001/06/29 20:40:18 gnurou Exp $
3 
4  Copyright (C) 1999/2000/2001 The Adonthell Project
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 
16 /**
17  * @file pnm.h
18  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
19  *
20  * @brief Declares the pnm static class.
21  *
22  *
23  */
24 
25 #include "types.h"
26 
27 /**
28  * Allow reading and writing PNM files.
29  *
30  */
31 class pnm
32 {
33 public:
34  /**
35  * Reads a PNM %image from an opened file.
36  *
37  * @warning
38  * The returned pointer is allocated by this function with calloc ().
39  * Don't forget to free () it when you don't need it anymore!
40  *
41  * @param file opened file from which to read.
42  * @param length pointer to the integer which will contain the %image's length.
43  * @param height pointer to the integer which will contain the %image's height.
44  *
45  * @return allocated pointer containing the PNM %image.
46  */
47  static void *get (SDL_RWops * file, u_int16 * length, u_int16 * height);
48 
49  /**
50  * Saves a PNM %image into an opened file.
51  *
52  * @param file the opened file to write the PNM %image to.
53  * @param image the PNM %image data.
54  * @param length the length of the %image to write.
55  * @param height the height of the %image to write.
56  */
57  static void put (SDL_RWops * file, void *image, u_int16 length, u_int16 height);
58 
59 private:
60 
61  /// Go to the next file's line.
62  static void pnm_gotonextline (SDL_RWops * file);
63 
64  /// Skip PNM comments.
65  static int pnm_checkforcomment (SDL_RWops * file);
66 };
Declares some basic types.
#define u_int16
16 bits long unsigned integer
Definition: types.h:32
Allow reading and writing PNM files.
Definition: pnm.h:31
static void put(SDL_RWops *file, void *image, u_int16 length, u_int16 height)
Saves a PNM image into an opened file.
Definition: pnm.cc:78
Image manipulation class.
Definition: image.h:41