Adonthell  0.4
pnm.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 1999/2000/2001 The Adonthell Project
3  Part of the Adonthell Project <http://adonthell.nongnu.org>
4 
5  Adonthell is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  Adonthell is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Adonthell. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 /**
21  * @file pnm.h
22  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
23  *
24  * @brief Declares the pnm static class.
25  *
26  *
27  */
28 
29 #include "types.h"
30 
31 /**
32  * Allow reading and writing PNM files.
33  *
34  */
35 class pnm
36 {
37 public:
38  /**
39  * Reads a PNM %image from an opened file.
40  *
41  * @warning
42  * The returned pointer is allocated by this function with calloc ().
43  * Don't forget to free () it when you don't need it anymore!
44  *
45  * @param file opened file from which to read.
46  * @param length pointer to the integer which will contain the %image's length.
47  * @param height pointer to the integer which will contain the %image's height.
48  *
49  * @return allocated pointer containing the PNM %image.
50  */
51  static void *get (SDL_RWops * file, u_int16 * length, u_int16 * height);
52 
53  /**
54  * Saves a PNM %image into an opened file.
55  *
56  * @param file the opened file to write the PNM %image to.
57  * @param image the PNM %image data.
58  * @param length the length of the %image to write.
59  * @param height the height of the %image to write.
60  */
61  static void put (SDL_RWops * file, void *image, u_int16 length, u_int16 height);
62 
63 private:
64 
65  /// Go to the next file's line.
66  static void pnm_gotonextline (SDL_RWops * file);
67 
68  /// Skip PNM comments.
69  static int pnm_checkforcomment (SDL_RWops * file);
70 };
Declares some basic types.
#define u_int16
16 bits long unsigned integer
Definition: types.h:38
Allow reading and writing PNM files.
Definition: pnm.h:35
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:80
Image manipulation class.
Definition: image.h:45