Adonthell 0.4
|
00001 /* 00002 $Id: pnm.h,v 1.10 2001/06/29 20:40:18 gnurou Exp $ 00003 00004 Copyright (C) 1999/2000/2001 The Adonthell Project 00005 Part of the Adonthell Project http://adonthell.linuxgames.com 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 00016 /** 00017 * @file pnm.h 00018 * @author Alexandre Courbot <alexandrecourbot@linuxgames.com> 00019 * 00020 * @brief Declares the pnm static class. 00021 * 00022 * 00023 */ 00024 00025 #include "types.h" 00026 00027 /** 00028 * Allow reading and writing PNM files. 00029 * 00030 */ 00031 class pnm 00032 { 00033 public: 00034 /** 00035 * Reads a PNM %image from an opened file. 00036 * 00037 * @warning 00038 * The returned pointer is allocated by this function with calloc (). 00039 * Don't forget to free () it when you don't need it anymore! 00040 * 00041 * @param file opened file from which to read. 00042 * @param length pointer to the integer which will contain the %image's length. 00043 * @param height pointer to the integer which will contain the %image's height. 00044 * 00045 * @return allocated pointer containing the PNM %image. 00046 */ 00047 static void *get (SDL_RWops * file, u_int16 * length, u_int16 * height); 00048 00049 /** 00050 * Saves a PNM %image into an opened file. 00051 * 00052 * @param file the opened file to write the PNM %image to. 00053 * @param image the PNM %image data. 00054 * @param length the length of the %image to write. 00055 * @param height the height of the %image to write. 00056 */ 00057 static void put (SDL_RWops * file, void *image, u_int16 length, u_int16 height); 00058 00059 private: 00060 00061 /// Go to the next file's line. 00062 static void pnm_gotonextline (SDL_RWops * file); 00063 00064 /// Skip PNM comments. 00065 static int pnm_checkforcomment (SDL_RWops * file); 00066 };