![]() |
PhoenixPNG
0.1.0
Set of tools to ease use of png file
|
Class which manipulate png image. More...
#include <PImagePng.h>
Public Types | |
enum | ColorType { RGB = PNG_COLOR_TYPE_RGB , RGBA = PNG_COLOR_TYPE_RGB_ALPHA } |
Public Member Functions | |
void | clear () |
Clear the image and buffer. | |
bool | createImage (size_t width, size_t height, PImagePng::ColorType colorType=PImagePng::RGB) |
Create an image. | |
void | fill (color_t red, color_t green, color_t blue, color_t alpha=255) |
Fill the image with the given color. | |
void | getColor (size_t idxWidth, size_t idxHeight, color_t &red, color_t &green, color_t &blue) const |
Get the color of the pixel at (idxWidth, idxHeight) | |
void | getColor (size_t idxWidth, size_t idxHeight, color_t &red, color_t &green, color_t &blue, color_t &alpha) const |
Get the color of the pixel at (idxWidth, idxHeight) | |
png_byte * | getData () |
Get the buffer data of the current PImagePng. | |
const png_byte * | getData () const |
Get the buffer data of the current PImagePng. | |
unsigned int | getHeight () const |
Get the height of the image. | |
NbColorByte | getNbBytePerPixel () const |
Get the number of bytes per pixel. | |
unsigned int | getWidth () const |
Get the width of the image. | |
PImagePng & | operator= (const PImagePng &other) |
Definition of equal operator of PImagePng. | |
PImagePng () | |
Default constructor of PImagePng. | |
PImagePng (const PImagePng &other) | |
Copy constructor of PImagePng. | |
bool | read (const PPath &fileName) |
Read the given png image. | |
template<typename T> | |
void | setColor (const T *matValue, size_t nbRow, size_t nbCol, const PColorMap &colorMap) |
Set the color of the image by respect to a given matrix of values and the colorMap. | |
void | setColor (size_t idxWidth, size_t idxHeight, color_t red, color_t green, color_t blue) |
Set the color of the pixel at (idxWidth, idxHeight) | |
void | setColor (size_t idxWidth, size_t idxHeight, color_t red, color_t green, color_t blue, color_t alpha) |
Set the color of the pixel at (idxWidth, idxHeight) | |
bool | write (const PPath &fileName) |
Write a png file. | |
virtual | ~PImagePng () |
Destructor of PImagePng. | |
Protected Member Functions | |
void | copyPImagePng (const PImagePng &other) |
Copy function of PImagePng. | |
Private Member Functions | |
void | initialisationPImagePng () |
Initialisation function of the class PImagePng. | |
Private Attributes | |
png_byte * | p_buffer |
Buffer use to store the image data. | |
PImagePng::ColorType | p_colorType |
Type of the color of the current image. | |
png_image | p_image |
Png image. | |
NbColorByte | p_nbBytePerPixel |
Number of bytes per pixel (3 for RGB, 4 for RGBA) | |
Class which manipulate png image.
Definition at line 19 of file PImagePng.h.
enum PImagePng::ColorType |
Enumerator | |
---|---|
RGB | |
RGBA |
Definition at line 21 of file PImagePng.h.
PImagePng::PImagePng | ( | ) |
Default constructor of PImagePng.
Definition at line 12 of file PImagePng.cpp.
References initialisationPImagePng().
Referenced by copyPImagePng(), operator=(), and PImagePng().
PImagePng::PImagePng | ( | const PImagePng & | other | ) |
Copy constructor of PImagePng.
other | : class to copy |
Definition at line 19 of file PImagePng.cpp.
References copyPImagePng(), initialisationPImagePng(), and PImagePng().
|
virtual |
Destructor of PImagePng.
Definition at line 25 of file PImagePng.cpp.
References clear().
void PImagePng::clear | ( | ) |
Clear the image and buffer.
Definition at line 122 of file PImagePng.cpp.
References p_buffer, and p_image.
Referenced by ~PImagePng().
|
protected |
Copy function of PImagePng.
other | : class to copy |
Definition at line 232 of file PImagePng.cpp.
References createImage(), getHeight(), getWidth(), p_buffer, p_colorType, p_nbBytePerPixel, and PImagePng().
Referenced by operator=(), and PImagePng().
bool PImagePng::createImage | ( | size_t | width, |
size_t | height, | ||
PImagePng::ColorType | colorType = PImagePng::RGB ) |
Create an image.
width | : width of the image |
height | : height of the image |
colorType | : color type of the image (ex RGB) |
Definition at line 44 of file PImagePng.cpp.
References p_buffer, p_colorType, p_image, p_nbBytePerPixel, RGB, and RGBA.
Referenced by copyPImagePng().
Fill the image with the given color.
red | : red proportion |
green | : green proportion |
blue | : blue proportion |
alpha | : transparence proportion |
Definition at line 136 of file PImagePng.cpp.
References p_image, and setColor().
void PImagePng::getColor | ( | size_t | idxWidth, |
size_t | idxHeight, | ||
color_t & | red, | ||
color_t & | green, | ||
color_t & | blue ) const |
Get the color of the pixel at (idxWidth, idxHeight)
idxWidth | : index of the pixel on the image width | |
idxHeight | : index of the pixel on the image height | |
[out] | red | : red proportion |
[out] | green | : green proportion |
[out] | blue | : blue proportion |
Definition at line 181 of file PImagePng.cpp.
References getColor().
Referenced by getColor().
void PImagePng::getColor | ( | size_t | idxWidth, |
size_t | idxHeight, | ||
color_t & | red, | ||
color_t & | green, | ||
color_t & | blue, | ||
color_t & | alpha ) const |
Get the color of the pixel at (idxWidth, idxHeight)
idxWidth | : index of the pixel on the image width | |
idxHeight | : index of the pixel on the image height | |
[out] | red | : red proportion |
[out] | green | : green proportion |
[out] | blue | : blue proportion |
[out] | alpha | : alpha proportion |
Definition at line 194 of file PImagePng.cpp.
References p_buffer, p_image, and p_nbBytePerPixel.
png_byte * PImagePng::getData | ( | ) |
const png_byte * PImagePng::getData | ( | ) | const |
unsigned int PImagePng::getHeight | ( | ) | const |
Get the height of the image.
Definition at line 212 of file PImagePng.cpp.
References p_image.
Referenced by copyPImagePng().
NbColorByte PImagePng::getNbBytePerPixel | ( | ) | const |
Get the number of bytes per pixel.
Definition at line 227 of file PImagePng.cpp.
References p_nbBytePerPixel.
unsigned int PImagePng::getWidth | ( | ) | const |
Get the width of the image.
Definition at line 207 of file PImagePng.cpp.
References p_image.
Referenced by copyPImagePng().
|
private |
Initialisation function of the class PImagePng.
Definition at line 238 of file PImagePng.cpp.
References p_buffer, p_image, and p_nbBytePerPixel.
Referenced by PImagePng(), and PImagePng().
Definition of equal operator of PImagePng.
other | : class to copy |
Definition at line 33 of file PImagePng.cpp.
References copyPImagePng(), and PImagePng().
bool PImagePng::read | ( | const PPath & | fileName | ) |
Read the given png image.
fileName | : name of the file to be read |
Definition at line 74 of file PImagePng.cpp.
References check_is_png(), p_buffer, p_colorType, p_image, p_nbBytePerPixel, RGB, and RGBA.
void PImagePng::setColor | ( | const T * | matValue, |
size_t | nbRow, | ||
size_t | nbCol, | ||
const PColorMap & | colorMap ) |
Set the color of the image by respect to a given matrix of values and the colorMap.
matValue | : matrix of value to be used to colorize the PImagePng |
nbRow | : number of rows of the matrix |
nbCol | : number of columns of the matrix |
colorMap | : PColorMap to be used to convert values in color |
Definition at line 20 of file PImagePng_impl.h.
References PColorMap::interpolate(), p_image, and setColor().
void PImagePng::setColor | ( | size_t | idxWidth, |
size_t | idxHeight, | ||
color_t | red, | ||
color_t | green, | ||
color_t | blue ) |
Set the color of the pixel at (idxWidth, idxHeight)
idxWidth | : index of the pixel on the image width |
idxHeight | : index of the pixel on the image height |
red | : red proportion |
green | : green proportion |
blue | : blue proportion |
Definition at line 151 of file PImagePng.cpp.
References setColor().
Referenced by fill(), setColor(), and setColor().
void PImagePng::setColor | ( | size_t | idxWidth, |
size_t | idxHeight, | ||
color_t | red, | ||
color_t | green, | ||
color_t | blue, | ||
color_t | alpha ) |
Set the color of the pixel at (idxWidth, idxHeight)
idxWidth | : index of the pixel on the image width |
idxHeight | : index of the pixel on the image height |
red | : red proportion |
green | : green proportion |
blue | : blue proportion |
alpha | : alpha proportion |
Definition at line 164 of file PImagePng.cpp.
References p_buffer, p_image, and p_nbBytePerPixel.
bool PImagePng::write | ( | const PPath & | fileName | ) |
Write a png file.
fileName | : name fo the png file to be written |
Definition at line 112 of file PImagePng.cpp.
|
private |
Buffer use to store the image data.
Definition at line 65 of file PImagePng.h.
Referenced by clear(), copyPImagePng(), createImage(), getColor(), getData(), getData(), initialisationPImagePng(), read(), setColor(), and write().
|
private |
Type of the color of the current image.
Definition at line 69 of file PImagePng.h.
Referenced by copyPImagePng(), createImage(), and read().
|
private |
Png image.
Definition at line 63 of file PImagePng.h.
Referenced by clear(), createImage(), fill(), getColor(), getHeight(), getWidth(), initialisationPImagePng(), read(), setColor(), setColor(), and write().
|
private |
Number of bytes per pixel (3 for RGB, 4 for RGBA)
Definition at line 67 of file PImagePng.h.
Referenced by copyPImagePng(), createImage(), getColor(), getNbBytePerPixel(), initialisationPImagePng(), read(), and setColor().