Go to the documentation of this file.
34 #include <FreeImage.h>
36 #include <ignition/math/Color.hh>
52 "UNKNOWN_PIXEL_FORMAT",
80 UNKNOWN_PIXEL_FORMAT = 0,
107 const std::string &_format);
111 public:
explicit Image(
const std::string &_filename=
"");
114 public:
virtual ~
Image();
119 public:
int Load(
const std::string &_filename);
123 public:
void SavePNG(
const std::string &_filename);
130 public:
void SetFromData(
const unsigned char *_data,
132 unsigned int _height,
138 public:
void GetData(
unsigned char **_data,
139 unsigned int &_count)
const;
145 public:
void GetRGBData(
unsigned char **_data,
146 unsigned int &_count)
const;
150 public:
unsigned int GetWidth()
const;
154 public:
unsigned int GetHeight()
const;
158 public:
unsigned int GetBPP()
const;
162 public:
int GetPitch()
const;
166 public: std::string GetFilename()
const;
170 public: PixelFormat GetPixelFormat()
const;
177 public:
Color GetPixel(
unsigned int _x,
unsigned int _y)
const
184 public: ignition::math::Color Pixel(
const unsigned int _x,
185 const unsigned int _y)
const;
208 public:
void Rescale(
int _width,
int _height);
212 public:
bool Valid() const;
215 private:
void GetDataImpl(
unsigned char **_data,
unsigned int &_count,
216 FIBITMAP *_img) const;
220 private: static
int count;
223 private: FIBITMAP *bitmap;
226 private: std::
string fullName;
ignition::math::Color AvgColor()
Get the average color.
unsigned int GetBPP() const
Get the size of one pixel in bits.
Color GetAvgColor() GAZEBO_DEPRECATED(9.0)
Get the average color.
bool Valid() const
Returns whether this is a valid image.
Forward declarations for the common classes.
Definition: Animation.hh:26
Color GetPixel(unsigned int _x, unsigned int _y) const GAZEBO_DEPRECATED(9.0)
Get a pixel color value.
void GetRGBData(unsigned char **_data, unsigned int &_count) const
Get only the RGB data from the image.
Image(const std::string &_filename="")
Constructor.
void Rescale(int _width, int _height)
Rescale the image.
void GetData(unsigned char **_data, unsigned int &_count) const
Get the image as a data array.
Encapsulates an image.
Definition: Image.hh:75
static Image::PixelFormat ConvertPixelFormat(const std::string &_format)
Convert a string to a Image::PixelFormat.
PixelFormat
Pixel formats enumeration.
Definition: Image.hh:78
Color GetMaxColor() const GAZEBO_DEPRECATED(9.0)
Get the max color.
PixelFormat GetPixelFormat() const
Get the pixel format.
std::string GetFilename() const
Get the full filename of the image.
void SavePNG(const std::string &_filename)
Save the image in PNG format.
virtual ~Image()
Destructor.
Defines a color.
Definition: Color.hh:36
unsigned int GetWidth() const
Get the width.
ignition::math::Color Pixel(const unsigned int _x, const unsigned int _y) const
Get a pixel color value.
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
unsigned int GetHeight() const
Get the height.
void SetFromData(const unsigned char *_data, unsigned int _width, unsigned int _height, Image::PixelFormat _format)
Set the image from raw data.
static std::string PixelFormatNames[]
String names for the pixel formats.
Definition: Image.hh:50
int Load(const std::string &_filename)
Load an image.
ignition::math::Color MaxColor() const
Get the max color.