Robot Simulator of the Robotics Group for Self-Organization of Control: imageppm.h Source File

# imageppm.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00003  *    Georg Martius  <georg dot martius at web dot de>                     *
    00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00006  *    Ralf Der       <ralfder at mis dot mpg dot de>                       *
    00007  *                                                                         *
    00008  *   This program is free software; you can redistribute it and/or modify  *
    00009  *   it under the terms of the GNU General Public License as published by  *
    00010  *   the Free Software Foundation; either version 2 of the License, or     *
    00011  *   (at your option) any later version.                                   *
    00012  *                                                                         *
    00013  *   This program is distributed in the hope that it will be useful,       *
    00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00016  *   GNU General Public License for more details.                          *
    00017  *                                                                         *
    00018  *   You should have received a copy of the GNU General Public License     *
    00019  *   along with this program; if not, write to the                         *
    00020  *   Free Software Foundation, Inc.,                                       *
    00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00022  *                                                                         *
    00023  ***************************************************************************/
    00024 #ifndef __IMAGEPPM_H
    00025 #define __IMAGEPPM_H
    00026
    00027 #include <string>
    00028
    00029 class ImagePPM {
    00030
    00031 private:
    00032   int image_width, image_height;
    00033   unsigned char *image_data;
    00034
    00035 public:
    00036   ImagePPM ();
    00037   /// data must contain width*height*3 (RGB) values!
    00038   ImagePPM (int width, int height, unsigned char* data);
    00039   ~ImagePPM();
    00040   int loadImage(const std::string& filename); // load from PPM file (returns 0 if error)
    00041   int storeImage(const std::string& filename); // store to PPM file (returns 0 if error)
    00042   int width()           { return image_width;  }
    00043   int height()          { return image_height; }
    00044   unsigned char *data() { return image_data;   }
    00045
    00046 };
    00047
    00048 #endif