Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cSurfaceInfo Class Reference

#include <cSurfaceInfo.h>

Public Member Functions

 cSurfaceInfo (PIXELS_t cx=0, PIXELS_t cy=0, size_t uPitchBytes=0, SURF_FORM_TYPE ePixelFormat=SURF_FORM_UNKNOWN)
 
 cSurfaceInfo (const cSurfaceBitmapInfo *pBMI)
 
 cSurfaceInfo (struct tagBITMAPINFOHEADER *pBMI)
 
 cSurfaceInfo (const tagBITMAPINFO *pBMI)
 
PIXELS_t get_Width () const noexcept
 
PIXELS_t get_Height () const noexcept
 
PIXELS_t get_HeightRaw () const noexcept
 
bool isTopDown () const noexcept
 
cWinSize get_Size () const noexcept
 
size_t get_PitchBytes () const noexcept
 
void put_PitchBytes (size_t uPitchBytes) noexcept
 
SURF_FORM_TYPE get_PixelFormat () const noexcept
 
size_t get_SurfaceSize () const noexcept
 
BIT_SIZE_t get_BitsPerPixel () const noexcept
 
size_t get_BytesPerPixel () const noexcept
 
bool isValidInfo () const noexcept
 
bool isReasonableInfo () const noexcept
 
bool IsEqual (const cSurfaceInfo &rInfo) const noexcept
 
void SetSurfaceInfo (const cSurfaceInfo &rInfo)
 
void InitSurfaceInfo (PIXELS_t cx=0, PIXELS_t cy=0, size_t uPitchBytes=0, SURF_FORM_TYPE ePixelFormat=SURF_FORM_UNKNOWN) noexcept
 
void InitAligned (PIXELS_t cx, PIXELS_t cy, size_t nAlignBytes, SURF_FORM_TYPE ePixelFormat)
 
void SetBitmapInfo (const cSurfaceBitmapInfo *pBMI)
 
void SetBitmapInfo (const struct tagBITMAPINFOHEADER *pBMI)
 
void SetBitmapInfo (const tagBITMAPINFO *pBMI)
 

Static Public Member Functions

static BIT_SIZE_t GRAYCALL GetBitsPerPixel (SURF_FORM_TYPE ePixelFormat) noexcept
 
static COLOR_ELEM_t GRAYCALL GetColorElements (SURF_FORM_TYPE ePixelFormat) noexcept
 
static SURF_FORM_TYPE GRAYCALL GetPixelFormat (int iBitsPerPixel, int iColorElements)
 
static constexpr size_t CvtBitsToAlignedBytes (UINT nBitsTotal, size_t nAlignBytes) noexcept
 

Static Public Attributes

static const PIXELS_t kMaxX = 8 * 1024
 
static const PIXELS_t kMaxY = 8 * 1024
 

Detailed Description

image/surface/frame format info/description. size+stride+pixel format. SURF_FORM_TYPE is never a compressed format. Similar to D3DSURFACE_DESC or tagBITMAPINFOHEADER (cSurfaceBitmapInfo)

Constructor & Destructor Documentation

◆ cSurfaceInfo() [1/4]

GrayLib::cSurfaceInfo::cSurfaceInfo ( PIXELS_t  cx = 0,
PIXELS_t  cy = 0,
size_t  uPitchBytes = 0,
SURF_FORM_TYPE  ePixelFormat = SURF_FORM_UNKNOWN 
)
inline

◆ cSurfaceInfo() [2/4]

GrayLib::cSurfaceInfo::cSurfaceInfo ( const cSurfaceBitmapInfo pBMI)
inline

◆ cSurfaceInfo() [3/4]

GrayLib::cSurfaceInfo::cSurfaceInfo ( struct tagBITMAPINFOHEADER *  pBMI)
inline

◆ cSurfaceInfo() [4/4]

GrayLib::cSurfaceInfo::cSurfaceInfo ( const tagBITMAPINFO *  pBMI)
inline

Member Function Documentation

◆ CvtBitsToAlignedBytes()

static constexpr size_t GrayLib::cSurfaceInfo::CvtBitsToAlignedBytes ( UINT  nBitsTotal,
size_t  nAlignBytes 
)
inlinestaticconstexprnoexcept

cSurfaceInfo:: nBitsTotal = bits per pixel * total number of pixels in row = total bits in row. e.g. nAlignBytes = sizeof(UINT32) ASSUME nBitsTotal is multiple of 8?

Returns
size_t Bytes padded out to nAlignBytes

◆ get_BitsPerPixel()

BIT_SIZE_t GrayLib::cSurfaceInfo::get_BitsPerPixel ( ) const
inlinenoexcept

◆ get_BytesPerPixel()

size_t GrayLib::cSurfaceInfo::get_BytesPerPixel ( ) const
inlinenoexcept

◆ get_Height()

PIXELS_t GrayLib::cSurfaceInfo::get_Height ( void  ) const
inlinenoexcept

height in pixels not bytes. Always positive. remove any top-down indicator.

◆ get_HeightRaw()

PIXELS_t GrayLib::cSurfaceInfo::get_HeightRaw ( ) const
inlinenoexcept

height in pixels not bytes. <0 = NOT TopDown(). Opposite of GDI.

◆ get_PitchBytes()

size_t GrayLib::cSurfaceInfo::get_PitchBytes ( ) const
inlinenoexcept

row width in bytes not pixels. (AKA Pitch, Stride or BytesPerRow)

◆ get_PixelFormat()

SURF_FORM_TYPE GrayLib::cSurfaceInfo::get_PixelFormat ( ) const
inlinenoexcept

the pixel format.

◆ get_Size()

cWinSize GrayLib::cSurfaceInfo::get_Size ( ) const
inlinenoexcept

◆ get_SurfaceSize()

size_t GrayLib::cSurfaceInfo::get_SurfaceSize ( ) const
inlinenoexcept

size for the full image in bytes.

◆ get_Width()

PIXELS_t GrayLib::cSurfaceInfo::get_Width ( void  ) const
inlinenoexcept

width in pixels not bytes.

◆ GetBitsPerPixel()

BIT_SIZE_t GRAYCALL GrayLib::cSurfaceInfo::GetBitsPerPixel ( SURF_FORM_TYPE  ePixelFormat)
staticnoexcept

Get Size of a pixel. similar to D3DFORM BIT_ENUM_t

◆ GetColorElements()

COLOR_ELEM_t GRAYCALL GrayLib::cSurfaceInfo::GetColorElements ( SURF_FORM_TYPE  ePixelFormat)
staticnoexcept

◆ GetPixelFormat()

SURF_FORM_TYPE GRAYCALL GrayLib::cSurfaceInfo::GetPixelFormat ( int  iBitsPerPixel,
int  iColorElements 
)
static

Try to determine pixel format from some other format info.

Note
GDI+ doesn't use GDI COLORREF RGB() order. In fact surface does.

◆ InitAligned()

void GrayLib::cSurfaceInfo::InitAligned ( PIXELS_t  cx,
PIXELS_t  cy,
size_t  nAlignBytes,
SURF_FORM_TYPE  ePixelFormat 
)
inline

make sure the pitch is nAlignBytes bytes aligned. e.g. nAlignBytes = sizeof(UINT32)

◆ InitSurfaceInfo()

void GrayLib::cSurfaceInfo::InitSurfaceInfo ( PIXELS_t  cx = 0,
PIXELS_t  cy = 0,
size_t  uPitchBytes = 0,
SURF_FORM_TYPE  ePixelFormat = SURF_FORM_UNKNOWN 
)
inlinenoexcept

◆ IsEqual()

bool GrayLib::cSurfaceInfo::IsEqual ( const cSurfaceInfo rInfo) const
inlinenoexcept

◆ isReasonableInfo()

bool GrayLib::cSurfaceInfo::isReasonableInfo ( ) const
inlinenoexcept

Check for reasonable limits. allow null.

Note
0 values are allowed for a null format.

◆ isTopDown()

bool GrayLib::cSurfaceInfo::isTopDown ( ) const
inlinenoexcept

Opposite of default GDI. cy positive = y=0=top of image. normal format?

◆ isValidInfo()

bool GrayLib::cSurfaceInfo::isValidInfo ( ) const
inlinenoexcept

Check against arbitrary max.

◆ put_PitchBytes()

void GrayLib::cSurfaceInfo::put_PitchBytes ( size_t  uPitchBytes)
inlinenoexcept

Sometimes we don't discover pitch bytes until later. adjust it.

◆ SetBitmapInfo() [1/3]

void GrayLib::cSurfaceInfo::SetBitmapInfo ( const cSurfaceBitmapInfo pBMI)

Set the cSurfaceInfo from a _WIN32 tagBITMAPINFO or tagBITMAPINFOHEADER. reverse of SetSurfaceInfo ignore compressed format info. assume this is the format that will hold the non compress info once decompressed.

◆ SetBitmapInfo() [2/3]

void GrayLib::cSurfaceInfo::SetBitmapInfo ( const struct tagBITMAPINFOHEADER *  pBMI)
inline

◆ SetBitmapInfo() [3/3]

void GrayLib::cSurfaceInfo::SetBitmapInfo ( const tagBITMAPINFO *  pBMI)
inline

◆ SetSurfaceInfo()

void GrayLib::cSurfaceInfo::SetSurfaceInfo ( const cSurfaceInfo rInfo)
inline

Member Data Documentation

◆ kMaxX

const PIXELS_t GrayLib::cSurfaceInfo::kMaxX = 8 * 1024
static

◆ kMaxY

const PIXELS_t GrayLib::cSurfaceInfo::kMaxY = 8 * 1024
static

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