Go to the documentation of this file.
26 #include <ignition/math/Color.hh>
43 "UNKNOWN_PIXEL_FORMAT",
71 UNKNOWN_PIXEL_FORMAT = 0,
98 const std::string &_format);
102 public:
explicit Image(
const std::string &_filename=
"");
105 public:
virtual ~
Image();
110 public:
int Load(
const std::string &_filename);
114 public:
void SavePNG(
const std::string &_filename);
121 public:
void SetFromData(
const unsigned char *_data,
123 unsigned int _height,
129 public:
void GetData(
unsigned char **_data,
130 unsigned int &_count)
const;
136 public:
void GetRGBData(
unsigned char **_data,
137 unsigned int &_count)
const;
141 public:
unsigned int GetWidth()
const;
145 public:
unsigned int GetHeight()
const;
149 public:
unsigned int GetBPP()
const;
153 public:
int GetPitch()
const;
157 public: std::string GetFilename()
const;
161 public: PixelFormat GetPixelFormat()
const;
168 public:
Color GetPixel(
unsigned int _x,
unsigned int _y)
const
175 public: ignition::math::Color Pixel(
const unsigned int _x,
176 const unsigned int _y)
const;
199 public:
void Rescale(
int _width,
int _height);
203 public:
bool Valid() const;
206 private:
void GetDataImpl(
unsigned char **_data,
unsigned int &_count,
207 FIBITMAP *_img) const;
211 private: static
int count;
214 private: FIBITMAP *bitmap;
217 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.
common
Definition: FuelModelDatabase.hh:37
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:66
static Image::PixelFormat ConvertPixelFormat(const std::string &_format)
Convert a string to a Image::PixelFormat.
PixelFormat
Pixel formats enumeration.
Definition: Image.hh:69
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:41
int Load(const std::string &_filename)
Load an image.
ignition::math::Color MaxColor() const
Get the max color.