imageppm.h

Go to the documentation of this file.
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.4  2006/07/14 12:23:56  martius
00024  *   selforg becomes HEAD
00025  *
00026  *   Revision 1.3.4.1  2006/05/28 22:14:57  martius
00027  *   heightfield included
00028  *
00029  *   Revision 1.3  2005/10/25 22:24:05  martius
00030  *   data constructor
00031  *   store method
00032  *
00033  *   Revision 1.2  2005/09/13 13:22:08  martius
00034  *   *** empty log message ***
00035  *
00036  *   Revision 1.1  2005/08/26 09:34:35  robot2
00037  *   ppm image lib
00038  *
00039  *   Revision 1.1  2005/08/02 13:18:33  fhesse
00040  *   function for drawing geoms
00041  *                                                                 *
00042  *                                                                         *
00043  ***************************************************************************/
00044 #ifndef __IMAGEPPM_H
00045 #define __IMAGEPPM_H
00046 
00047 #include <string>
00048 
00049 class ImagePPM {
00050 
00051 private:
00052   int image_width, image_height;
00053   unsigned char *image_data;
00054 
00055 public:
00056   ImagePPM ();  
00057   /// data must contain width*height*3 (RGB) values!
00058   ImagePPM (int width, int height, unsigned char* data);  
00059   ~ImagePPM();
00060   int loadImage(const std::string& filename); // load from PPM file (returns 0 if error)
00061   int storeImage(const std::string& filename); // store to PPM file (returns 0 if error)
00062   int width()           { return image_width;  }
00063   int height()          { return image_height; }
00064   unsigned char *data() { return image_data;   }
00065 
00066 };
00067 
00068 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7