Functions

sp::video::ImageConverter Namespace Reference

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)

Detailed Description

ImageConverter namespace used for image buffer manipulation. This is particular used in the Texture class (e.g. for "setFormat", "setSize" etc.).


Function Documentation

template<typename T >
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.

Parameters:
[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).
Returns:
True on success. Otherwise false when the arguments are invalid.
Todo:
This function has not been tested yet!
template<typename T >
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".

See also:
appendImageBufferBottom
Todo:
Not implemented yet!
template<typename T >
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).

template<typename T , s32 DefVal>
void sp::video::ImageConverter::convertImageFormat ( T *&  ImageBuffer,
s32  Width,
s32  Height,
s32  OldFormatSize,
s32  NewFormatSize 
)

Converts the image data formats (e.g. RGB -> RGBA).

template<typename T , s32 DefVal>
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.

template<typename T >
void sp::video::ImageConverter::copyBufferToSubBuffer ( T *  DestBuffer,
const T *  SrcBuffer,
const dim::size2di &  SrcSize,
u32  FormatSize,
const dim::point2di &  Pos,
const dim::size2di &  Size 
)
template<typename T >
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.

Parameters:
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.
template<typename T >
void sp::video::ImageConverter::flipImageColors ( T *  ImageBuffer,
s32  Width,
s32  Height,
s32  FormatSize 
)

Flips the color values (BGR -> RGB).

template<typename T >
void sp::video::ImageConverter::flipImageHorz ( T *  ImageBuffer,
s32  Width,
s32  Height,
s32  FormatSize 
)

Flips the image data on the x-axis.

template<typename T >
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.

template<typename T >
void sp::video::ImageConverter::halveImage ( T *&  ImageBuffer,
s32  Width,
s32  Height,
s32  FormatSize 
)

Scales the image to a half size (smooth).

template<typename T , s32 DefVal>
void sp::video::ImageConverter::invertImageColors ( T *  ImageBuffer,
u32  ImageBufferSize 
)

Inverts the colors.

template<typename T >
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.

template<typename T >
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.

Parameters:
[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.
template<typename T >
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°.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines