KiCad PCB EDA Suite
|
Manage an 8-bit channel image. More...
#include <image.h>
Public Member Functions | |
IMAGE (unsigned int aXsize, unsigned int aYsize) | |
Construct a IMAGE based on image size. | |
IMAGE (const IMAGE &aSrcImage) | |
Construct a IMAGE based from an existing image. | |
~IMAGE () | |
void | Setpixel (int aX, int aY, unsigned char aValue) |
Set a value in a pixel position, position is clamped in accordance with the current clamp settings. | |
unsigned char | Getpixel (int aX, int aY) const |
Get the pixel value from pixel position, position is clamped in accord with the current clamp settings. | |
void | Hline (int aXStart, int aXEnd, int aY, unsigned char aValue) |
Draw a horizontal line. | |
void | CircleFilled (int aCx, int aCy, int aRadius, unsigned char aValue) |
void | CopyFull (const IMAGE *aImgA, const IMAGE *aImgB, IMAGE_OP aOperation) |
Perform a copy operation based on aOperation type. | |
void | Invert () |
Invert the values of this image <- (255 - this) | |
void | EfxFilter (IMAGE *aInImg, IMAGE_FILTER aFilterType) |
Apply a filter to the input image and store it in the image class. | |
void | EfxFilter_SkipCenter (IMAGE *aInImg, IMAGE_FILTER aFilterType, unsigned int aRadius) |
Apply a filter to the input image and store it in the image class. | |
void | SaveAsPNG (const wxString &aFileName) const |
Save image buffer to a PNG file into the working folder. | |
void | SetPixelsFromNormalizedFloat (const float *aNormalizedFloatArray) |
Set the current channel from a float normalized (0.0 - 1.0) buffer. | |
unsigned char * | GetBuffer () const |
Get the image buffer pointer. | |
unsigned int | GetWidth () const |
unsigned int | GetHeight () const |
Private Member Functions | |
bool | wrapCoords (int *aXo, int *aYo) const |
Calculate the coordinates points in accord with the current clamping settings. | |
void | plot8CircleLines (int aCx, int aCy, int aX, int aY, unsigned char aValue) |
Private Attributes | |
unsigned char * | m_pixels |
buffer to store the image 8bit-channel | |
unsigned int | m_width |
width of the image | |
unsigned int | m_height |
height of the image | |
unsigned int | m_wxh |
width * height precalc value | |
IMAGE_WRAP | m_wraping |
current wrapping type | |
IMAGE::IMAGE | ( | unsigned int | aXsize, |
unsigned int | aYsize | ||
) |
IMAGE::IMAGE | ( | const IMAGE & | aSrcImage | ) |
Construct a IMAGE based from an existing image.
It will make a copy the aSrcImage.
aSrcImage |
Definition at line 56 of file image.cpp.
References GetBuffer(), GetHeight(), GetWidth(), m_height, m_pixels, m_width, m_wraping, and m_wxh.
void IMAGE::CircleFilled | ( | int | aCx, |
int | aCy, | ||
int | aRadius, | ||
unsigned char | aValue | ||
) |
Definition at line 173 of file image.cpp.
References plot8CircleLines().
Referenced by RENDER_3D_OPENGL::initializeOpenGL().
Perform a copy operation based on aOperation type.
The available image operations.
aImgA | an image input. |
aImgB | an image input. |
aOperation | operation to perform |
void IMAGE::EfxFilter | ( | IMAGE * | aInImg, |
IMAGE_FILTER | aFilterType | ||
) |
Apply a filter to the input image and store it in the image class.
aInImg | input image |
aFilterType | filter type to apply |
void IMAGE::EfxFilter_SkipCenter | ( | IMAGE * | aInImg, |
IMAGE_FILTER | aFilterType, | ||
unsigned int | aRadius | ||
) |
Apply a filter to the input image and store it in the image class.
skip the circle center defined by radius
aInImg | input image |
aFilterType | filter type to apply |
aRadius | center circle that the effect will not be applied |
Definition at line 527 of file image.cpp.
References CLAMP, filter, FILTERS, Getpixel(), m_height, m_pixels, m_width, and m_wraping.
Referenced by RENDER_3D_OPENGL::initializeOpenGL().
unsigned char * IMAGE::GetBuffer | ( | ) | const |
Get the image buffer pointer.
Definition at line 73 of file image.cpp.
References m_pixels.
Referenced by IMAGE(), and OglLoadTexture().
|
inline |
Definition at line 214 of file image.h.
References m_height.
Referenced by IMAGE(), RENDER_3D_OPENGL::initializeOpenGL(), and OglLoadTexture().
unsigned char IMAGE::Getpixel | ( | int | aX, |
int | aY | ||
) | const |
Get the pixel value from pixel position, position is clamped in accord with the current clamp settings.
aX | x position |
aY | y position |
Definition at line 130 of file image.cpp.
References m_pixels, m_width, and wrapCoords().
Referenced by EfxFilter_SkipCenter().
|
inline |
Definition at line 213 of file image.h.
References m_width.
Referenced by IMAGE(), RENDER_3D_OPENGL::initializeOpenGL(), and OglLoadTexture().
void IMAGE::Hline | ( | int | aXStart, |
int | aXEnd, | ||
int | aY, | ||
unsigned char | aValue | ||
) |
void IMAGE::Invert | ( | ) |
|
private |
void IMAGE::SaveAsPNG | ( | const wxString & | aFileName | ) | const |
void IMAGE::Setpixel | ( | int | aX, |
int | aY, | ||
unsigned char | aValue | ||
) |
Set a value in a pixel position, position is clamped in accordance with the current clamp settings.
aX | x position |
aY | y position |
aValue | value to set the pixel |
Definition at line 123 of file image.cpp.
References m_pixels, m_width, and wrapCoords().
void IMAGE::SetPixelsFromNormalizedFloat | ( | const float * | aNormalizedFloatArray | ) |
|
private |
Calculate the coordinates points in accord with the current clamping settings.
aXo | X coordinate to be converted (output). |
aXo | Y coordinate to be converted (output). |
Definition at line 79 of file image.cpp.
References m_height, m_width, and m_wraping.
Referenced by Getpixel(), and Setpixel().
|
private |
height of the image
Definition at line 230 of file image.h.
Referenced by EfxFilter(), EfxFilter_SkipCenter(), GetHeight(), Hline(), IMAGE(), SaveAsPNG(), and wrapCoords().
|
private |
buffer to store the image 8bit-channel
Definition at line 228 of file image.h.
Referenced by CopyFull(), EfxFilter_SkipCenter(), GetBuffer(), Getpixel(), Hline(), IMAGE(), Invert(), SaveAsPNG(), Setpixel(), SetPixelsFromNormalizedFloat(), and ~IMAGE().
|
private |
width of the image
Definition at line 229 of file image.h.
Referenced by EfxFilter_SkipCenter(), Getpixel(), GetWidth(), Hline(), IMAGE(), SaveAsPNG(), Setpixel(), and wrapCoords().
|
private |
current wrapping type
Definition at line 232 of file image.h.
Referenced by EfxFilter(), EfxFilter_SkipCenter(), IMAGE(), and wrapCoords().
|
private |
width * height precalc value
Definition at line 231 of file image.h.
Referenced by CopyFull(), IMAGE(), Invert(), and SetPixelsFromNormalizedFloat().