ImageConverter namespace used for image buffer manipulation. This is particular used in the Texture class (e.g. for "setFormat", "setSize" etc.). More...
Functions | |
SP_EXPORT void | setImageColorKey (u8 *ImageBuffer, s32 Width, s32 Height, const video::color &Color, s32 Tolerance) |
SP_EXPORT bool | checkImageSize (dim::size2di &InputSize) |
Get the correct image size (2^x). | |
SP_EXPORT s32 | getMipmapLevelsCount (s32 Width, s32 Height) |
Get the count of mipmap levels. | |
template<typename T , s32 DefVal> | |
void | invertImageColors (T *ImageBuffer, u32 ImageBufferSize) |
Inverts the colors. | |
template<typename T > | |
void | flipImageColors (T *ImageBuffer, s32 Width, s32 Height, s32 FormatSize) |
Flips the color values (BGR -> RGB). | |
template<typename T > | |
void | flipImageHorz (T *ImageBuffer, s32 Width, s32 Height, s32 FormatSize) |
Flips the image data on the x-axis. | |
template<typename T > | |
void | flipImageVert (T *ImageBuffer, s32 Width, s32 Height, s32 FormatSize) |
Flips the image data on the y-axis. | |
template<typename T > | |
void | scaleImage (const T *SrcImageBuffer, s32 SrcWidth, s32 SrcHeight, T *DestImageBuffer, s32 DestWidth, s32 DestHeight, s32 FormatSize) |
Copies the source image in a scaled form to the destination image. | |
template<typename T > | |
void | scaleImage (T *&ImageBuffer, s32 Width, s32 Height, s32 NewWidth, s32 NewHeight, s32 FormatSize) |
Scales the image to a new size. | |
template<typename T > | |
void | halveImage (T *&ImageBuffer, s32 Width, s32 Height, s32 FormatSize) |
Scales the image to a half size (smooth). | |
template<typename T , s32 DefVal> | |
void | convertImageFormat (T *&ImageBuffer, s32 Width, s32 Height, s32 OldFormatSize, s32 NewFormatSize) |
Converts the image data formats (e.g. RGB -> RGBA). | |
template<typename T > | |
void | blurImage (T *&ImageBuffer, s32 Width, s32 Height, s32 FormatSize) |
Blurs the image data (for mipmap levels). | |
template<typename T > | |
void | turnImage (T *ImageBuffer, s32 Width, s32 Height, s32 FormatSize, const EImageTurnDegrees Degree) |
Turns the image data in 90°, 180° or 270°. | |
template<typename T , s32 DefVal> | |
void | convertImageGrayToAlpha (T *ImageBuffer, s32 Width, s32 Height) |
template<typename T > | |
bool | appendImageBufferBottom (T *&ImageBuffer, const T *AdditionalBuffer, s32 Width, s32 Height, s32 FrameWidth, s32 FrameHeight, s32 FormatSize) |
template<typename T > | |
bool | appendImageBufferRight (T *&ImageBuffer, const T *AdditionalBuffer, s32 Width, s32 Height, s32 FrameWidth, s32 FrameHeight, s32 FormatSize) |
template<typename T > | |
void | copySubBufferToBuffer (T *DestBuffer, const T *SrcBuffer, const dim::size2di &DestSize, u32 FormatSize, const dim::point2di &Pos, const dim::size2di &Size) |
template<typename T > | |
void | copyBufferToSubBuffer (T *DestBuffer, const T *SrcBuffer, const dim::size2di &SrcSize, u32 FormatSize, const dim::point2di &Pos, const dim::size2di &Size) |
ImageConverter namespace used for image buffer manipulation. This is particular used in the Texture class (e.g. for "setFormat", "setSize" etc.).
bool sp::video::ImageConverter::appendImageBufferBottom | ( | T *& | ImageBuffer, | |
const T * | AdditionalBuffer, | |||
s32 | Width, | |||
s32 | Height, | |||
s32 | FrameWidth, | |||
s32 | FrameHeight, | |||
s32 | FormatSize | |||
) |
Appends the given image buffer to the bottom of the base image buffer. If the new frame's size does not fit it will be scaled and the pixel format will be adjusted as well.
[in,out] | ImageBuffer | Pointer to the base image buffer. This buffer will be re-allocated. |
[in] | NewFrame | Constant pointer to the image buffer which is to be appended. |
[in] | Width | Width of the base image buffer. |
[in] | Height | Height of the base image buffer. |
[in] | FrameWidth | Width of the frame image buffer. |
[in] | FrameHeight | Height of the frame image buffer. |
[in] | FormatSize | Format size of the base image buffer (1, 2, 3 or 4). |
bool sp::video::ImageConverter::appendImageBufferRight | ( | T *& | ImageBuffer, | |
const T * | AdditionalBuffer, | |||
s32 | Width, | |||
s32 | Height, | |||
s32 | FrameWidth, | |||
s32 | FrameHeight, | |||
s32 | FormatSize | |||
) |
Appends the given image buffer to the bottom of the base image buffer. If the new frame's size does not fit it will be scaled and the pixel format will be adjusted as well. For more information look at "appendImageBufferBottom".
void sp::video::ImageConverter::blurImage | ( | T *& | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize | |||
) |
Blurs the image data (for mipmap levels).
SP_EXPORT bool sp::video::ImageConverter::checkImageSize | ( | dim::size2di & | InputSize | ) |
Get the correct image size (2^x).
void sp::video::ImageConverter::convertImageFormat | ( | T *& | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | OldFormatSize, | |||
s32 | NewFormatSize | |||
) |
Converts the image data formats (e.g. RGB -> RGBA).
void sp::video::ImageConverter::convertImageGrayToAlpha | ( | T * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height | |||
) |
Converts the gray values from the given image buffer into alpha values. After this conversion, each pixel will be white and only the alpha channel contains information about the image.
void sp::video::ImageConverter::copyBufferToSubBuffer | ( | T * | DestBuffer, | |
const T * | SrcBuffer, | |||
const dim::size2di & | SrcSize, | |||
u32 | FormatSize, | |||
const dim::point2di & | Pos, | |||
const dim::size2di & | Size | |||
) |
void sp::video::ImageConverter::copySubBufferToBuffer | ( | T * | DestBuffer, | |
const T * | SrcBuffer, | |||
const dim::size2di & | DestSize, | |||
u32 | FormatSize, | |||
const dim::point2di & | Pos, | |||
const dim::size2di & | Size | |||
) |
Copies a part area from the SubBuffer to the ImageBuffer.
DestBuffer,: | Destination image buffer. | |
SrcBuffer,: | Source image buffer. | |
DestSize,: | Destination image buffer size. | |
FormatSize,: | Format size of both destination- and source buffer. Must be 1, 2, 3 or 4. | |
Pos,: | Position where the source buffer is to be copied into the destination buffer. | |
Size,: | Size of the source image buffer. |
void sp::video::ImageConverter::flipImageColors | ( | T * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize | |||
) |
Flips the color values (BGR -> RGB).
void sp::video::ImageConverter::flipImageHorz | ( | T * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize | |||
) |
Flips the image data on the x-axis.
void sp::video::ImageConverter::flipImageVert | ( | T * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize | |||
) |
Flips the image data on the y-axis.
SP_EXPORT s32 sp::video::ImageConverter::getMipmapLevelsCount | ( | s32 | Width, | |
s32 | Height | |||
) |
Get the count of mipmap levels.
void sp::video::ImageConverter::halveImage | ( | T *& | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize | |||
) |
Scales the image to a half size (smooth).
void sp::video::ImageConverter::invertImageColors | ( | T * | ImageBuffer, | |
u32 | ImageBufferSize | |||
) |
Inverts the colors.
void sp::video::ImageConverter::scaleImage | ( | const T * | SrcImageBuffer, | |
s32 | SrcWidth, | |||
s32 | SrcHeight, | |||
T * | DestImageBuffer, | |||
s32 | DestWidth, | |||
s32 | DestHeight, | |||
s32 | FormatSize | |||
) |
Copies the source image in a scaled form to the destination image.
void sp::video::ImageConverter::scaleImage | ( | T *& | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | NewWidth, | |||
s32 | NewHeight, | |||
s32 | FormatSize | |||
) |
Scales the image to a new size.
SP_EXPORT void sp::video::ImageConverter::setImageColorKey | ( | u8 * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
const video::color & | Color, | |||
s32 | Tolerance = 0 | |||
) |
Sets the color key of the given image buffer. The format size must be 4.
[in,out] | ImageBuffer | Pointer to the image buffer which is to be modified. |
[in] | Width | Width of the image buffer. |
[in] | Height | Height of the image buffer. |
[in] | Color | Specifies the color key. Each pixel with the same RGB color components will get the new alpha channel (Color.Alpha). |
[in] | Tolerance | Specifies the tolerance factor. Each pixel will get the new alpha channel when the RGB color components are in the same range (if PixelColor = ColorKey +/- Tolerance). By default 0. |
void sp::video::ImageConverter::turnImage | ( | T * | ImageBuffer, | |
s32 | Width, | |||
s32 | Height, | |||
s32 | FormatSize, | |||
const EImageTurnDegrees | Degree | |||
) |
Turns the image data in 90°, 180° or 270°.