Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
imageppm.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __IMAGEPPM_H
25 #define __IMAGEPPM_H
26 
27 #include <string>
28 
29 class ImagePPM {
30 
31 private:
32  int image_width, image_height;
33  unsigned char *image_data;
34 
35 public:
36  ImagePPM ();
37  /// data must contain width*height*3 (RGB) values!
38  ImagePPM (int width, int height, unsigned char* data);
39  ~ImagePPM();
40  int loadImage(const std::string& filename); // load from PPM file (returns 0 if error)
41  int storeImage(const std::string& filename); // store to PPM file (returns 0 if error)
42  int width() { return image_width; }
43  int height() { return image_height; }
44  unsigned char *data() { return image_data; }
45 
46 };
47 
48 #endif
Definition: imageppm.h:29
unsigned char * data()
Definition: imageppm.h:44
int loadImage(const std::string &filename)
Definition: imageppm.cpp:80
~ImagePPM()
Definition: imageppm.cpp:153
ImagePPM()
Definition: imageppm.cpp:69
int width()
Definition: imageppm.h:42
int storeImage(const std::string &filename)
Definition: imageppm.cpp:129
int height()
Definition: imageppm.h:43