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 {
  Orientation::Degrees90,
  Orientation::Degrees180,
  Orientation::Degrees270,
  Orientation::VerticalFlip,
  Orientation::HorizontalFlip
}
 

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

◆ Orientation

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

Enumerator
Degrees90 

Performs a 90 degrees rotation.

Degrees180 

Performs a 180 degrees rotation.

Degrees270 

Performs a 270 degrees rotation.

VerticalFlip 

Performs a flip vertically.

HorizontalFlip 

Performs a flip horizontally.

Member Function Documentation

◆ AddBitmaps()

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.

◆ BitmapToPNG()

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.

◆ Reorient()

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

Performs a transformation on pBitmap as defined in angle.

See also
CYIBitmapUtilities::Orientation

◆ RGB2BGR()

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.

◆ SavePNG()

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.

◆ SubtractBitmaps()

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: