37 #ifndef OMPL_UTIL_PPM_
38 #define OMPL_UTIL_PPM_
51 unsigned char red, green, blue;
54 bool operator==(
const Color c)
56 return red == c.red && green == c.green && blue == c.blue;
111 return pixels_[row * width_ + col];
117 return pixels_[row * width_ + col];
121 std::vector<Color> pixels_;
123 unsigned int height_;
Load and save .ppm files.
void saveFile(const char *filename)
Save image data to a .ppm file. Throw an exception in case of an error.
unsigned int getWidth() const
Get the width of the loaded image.
Color & getPixel(const int row, const int col)
Directly access a pixel in the image.
const std::vector< Color > & getPixels() const
Get read-only access to the pixels in the image. To access a pixel at coordinate (row,col), use getPixels()[row * getWidth() + col].
void setHeight(unsigned int height)
Set the height for the loaded image. This must eventually match the number of pixels, if saveFile() gets called.
void loadFile(const char *filename)
Load a .ppm file. Throw an exception in case of an error.
unsigned int getHeight() const
Get the height of the loaded image.
void setWidth(unsigned int width)
Set the width for the loaded image. This must eventually match the number of pixels, if saveFile() gets called.
const Color & getPixel(const int row, const int col) const
Directly access a pixel in the image.
std::vector< Color > & getPixels()
Get write access to the pixels in the image. To access a pixel at coordinate (row,col), use getPixels()[row * getWidth() + col]. This must eventually match the width & height set by setWidth() and setHeight().