00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 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 as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * $Log: imageppm.h,v $ 00023 * Revision 1.3 2005/10/25 22:24:05 martius 00024 * data constructor 00025 * store method 00026 * 00027 * Revision 1.2 2005/09/13 13:22:08 martius 00028 * *** empty log message *** 00029 * 00030 * Revision 1.1 2005/08/26 09:34:35 robot2 00031 * ppm image lib 00032 * 00033 * Revision 1.1 2005/08/02 13:18:33 fhesse 00034 * function for drawing geoms 00035 * * 00036 * * 00037 ***************************************************************************/ 00038 #ifndef __IMAGEPPM_H 00039 #define __IMAGEPPM_H 00040 00041 00042 class ImagePPM { 00043 00044 private: 00045 int image_width, image_height; 00046 unsigned char *image_data; 00047 00048 public: 00049 ImagePPM (); 00050 /// data must contain width*height*3 (RGB) values! 00051 ImagePPM (int width, int height, unsigned char* data); 00052 ~ImagePPM(); 00053 int loadImage(char *filename); // load from PPM file (returns 0 if error) 00054 int storeImage(char *filename); // store to PPM file (returns 0 if error) 00055 int width() { return image_width; } 00056 int height() { return image_height; } 00057 unsigned char *data() { return image_data; } 00058 00059 }; 00060 00061 #endif