You.i Engine
CYIBitmapUtilities Class Reference

Detailed Description

Utility class used to perform image operations in software. Not using GPU / hardware acceleration.

#include <graphics/YiBitmapUtilities.h>

Public Types

enum  ORIENTATION {
  DEGREES_90,
  DEGREES_180,
  DEGREES_270,
  VERTICAL_FLIP,
  HORIZONTAL_FLIP
}
 

Static Public Member Functions

static bool RGB2BGR (CYIBitmap *pBitmap)
 
static bool Reorient (CYIBitmap *pBitmap, ORIENTATION angle)
 
static bool SavePNG (const CYIBitmap *pBitmap, const CYIString &filename)
 
static bool BitmapToPNG (const CYIBitmap *pBitmap, std::vector< uint8_t > *pOut)
 
static bool AddBitmaps (CYIBitmap *pBitmapDest, const CYIBitmap *pBitmapSrc)
 
static bool SubtractBitmaps (CYIBitmap *pBitmapDest, const CYIBitmap *pBitmapSrc)
 

Member Enumeration Documentation

Used by Reorient() to determine how to rotate or flip the image.

Enumerator
DEGREES_90 

Performs a 90 degrees rotation.

DEGREES_180 

Performs a 180 degrees rotation.

DEGREES_270 

Performs a 270 degrees rotation.

VERTICAL_FLIP 

Performs a flip vertically.

HORIZONTAL_FLIP 

Performs a flip horizontally.

Member Function Documentation

static bool CYIBitmapUtilities::AddBitmaps ( CYIBitmap pBitmapDest,
const CYIBitmap pBitmapSrc 
)
static

Adds two 32-bit buffers of the same size. Adds each pixel in pBitmapSrc to pBitmapDest and replaces the pixels in pBitmapDest with the result.

Returns true if successful. Returns false if pBitmapDest or pBitmapSrc is nullptr.
Returns false if pBitmapDest and pBitmapSrc differ in size.
Returns false if pBitmapDest and pBitmapSrc is not 32-bit images.

static bool CYIBitmapUtilities::BitmapToPNG ( const CYIBitmap pBitmap,
std::vector< uint8_t > *  pOut 
)
static

Converts pBitmap to a PNG vector.

Returns true if the conversion is successful.
Returns false if pBitmap is not a 32-bit image or if the conversion fails.

static bool CYIBitmapUtilities::Reorient ( CYIBitmap pBitmap,
ORIENTATION  angle 
)
static

Performs a transformation on pBitmap as defined in angle.

See also
ORIENTATION
static bool CYIBitmapUtilities::RGB2BGR ( CYIBitmap pBitmap)
static

Converts all the pixels of pBitmap from RGB color to BGR color.

Returns true for a successful conversion.
Returns false if pBitmap is nullptr.

static bool CYIBitmapUtilities::SavePNG ( const CYIBitmap pBitmap,
const CYIString filename 
)
static

Save pBitmap to a file named filename. This function only works for 32-bit images.

Returns true if the file was successfully saved.
Returns false if the saves fails.
Returns false if pBitmap is not a 32-bit image.

static bool CYIBitmapUtilities::SubtractBitmaps ( CYIBitmap pBitmapDest,
const CYIBitmap pBitmapSrc 
)
static

Subtracts two 32-bit buffers of the same size. Subtracts each pixel in pBitmapSrc to pBitmapDest and replaces the pixels in pBitmapDest with the result.

Returns true if successful. Returns false if pBitmapDest or pBitmapSrc is nullptr.
Returns false if pBitmapDest and pBitmapSrc differ in size.
Returns false if pBitmapDest and pBitmapSrc is not 32-bit images.


The documentation for this class was generated from the following file: