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

#include <cSurface.h>

Inheritance diagram for GrayLib::cSurface:
GrayLib::cSurfaceBase Gray::cMemBlock

Public Member Functions

 cSurface () noexcept
 
virtual ~cSurface ()
 
HRESULT LoadRawGrey (cStreamInput &stmIn, PIXELS_t cx, PIXELS_t cy, SURF_FORM_TYPE ePixelFormat=SURF_FORM_D16)
 
HRESULT LoadRawGrey (const FILECHAR_t *pszFilename, PIXELS_t cx, PIXELS_t cy, SURF_FORM_TYPE ePixelFormat=SURF_FORM_D16)
 
HRESULT CreateSurface (const cSurfaceInfo &rInfo)
 
HRESULT CreateSurfaceAlign (PIXELS_t cx, PIXELS_t cy, size_t nAlignBytes, SURF_FORM_TYPE ePixelFormat)
 
virtual void SetEmpty ()
 
virtual HRESULT SetCopySurface (const cSurfaceBase &Surf)
 
HRESULT InitTestPattern (SURF_FORM_TYPE ePixelFormat)
 
 UNITTEST_FRIEND (cSurface)
 
- Public Member Functions inherited from GrayLib::cSurfaceBase
 cSurfaceBase () noexcept
 
 cSurfaceBase (void *pPixelData, const cSurfaceInfo &rInfo)
 
 cSurfaceBase (void *pPixelData, PIXELS_t cx, PIXELS_t cy, size_t uPitchBytes, SURF_FORM_TYPE ePixelFormat)
 
virtual ~cSurfaceBase ()
 
HRESULT SaveRaw (cStreamOutput &file)
 
HRESULT SaveRaw (const FILECHAR_t *pszFilename)
 
bool isValidCheck () const noexcept
 
const cSurfaceInfoget_Info () const noexcept
 
void put_Info (const cSurfaceInfo &rInfo)
 
size_t get_PitchBytes () const noexcept
 
PIXELS_t get_Width () const noexcept
 
PIXELS_t get_Height () const noexcept
 
bool isTopDown () const noexcept
 
SURF_FORM_TYPE get_PixelFormat () const noexcept
 
bool isValidPixelData () const noexcept
 basic attributes. More...
 
void * get_PixelData () const noexcept
 
BYTE * get_PixelBytes () const noexcept
 
void put_PixelData (void *pPixelData) noexcept
 
void * GetLinePtrRaw (PIXELS_t y) const noexcept
 
BYTE * GetLinePtrByte (PIXELS_t y) const noexcept
 
void * GetLinePtr (PIXELS_t y) const noexcept
 
void * GetNextLine (const void *pLinePtr) const noexcept
 
bool IsValidPixPtr (const void *p) const noexcept
 
BYTE * GetPixPtr (const void *pvLine, PIXELS_t x, size_t sizePixel) const noexcept
 
BYTE * GetPixPtr (PIXELS_t x, PIXELS_t y, size_t sizePixel) const noexcept
 
COLOR16_tGetPixPtr16 (PIXELS_t x, PIXELS_t y) const noexcept
 
BYTE * GetPixPtr (PIXELS_t x, PIXELS_t y) const noexcept
 
bool Lock ()
 
void Unlock ()
 
bool GetPixColor1 (const void *pvLine, PIXELS_t x) const
 
void SetPixColor1 (void *pvLine, PIXELS_t x, bool b)
 
BYTE GetPixColor8 (const void *pvLine, PIXELS_t x) const noexcept
 
void SetPixColor8 (void *pvLine, PIXELS_t x, BYTE bColor) noexcept
 
COLOR16_t GetPixColor16 (const void *pvLine, PIXELS_t x) const noexcept
 
void SetPixColor16 (void *pvLine, PIXELS_t x, COLOR16_t wColor) noexcept
 
COLOR16_t GetPixColor16G (const void *pvLine, PIXELS_t x) const
 
COLOR16_t GetPixColor16G (PIXELS_t x, PIXELS_t y) const
 
void SetPixColor16G (void *pvLine, PIXELS_t x, COLOR16_t wVal)
 
void SetPixColor16G (PIXELS_t x, PIXELS_t y, COLOR16_t wVal)
 
COLORREF GetPixColor24g (const void *pvLine, PIXELS_t x) const noexcept
 
D3DCOLOR GetPixColor24d (const void *pvLine, PIXELS_t x) const noexcept
 
void SetPixColor24g (void *pvLine, PIXELS_t x, COLORREF dwColor) noexcept
 
void SetPixColor24d (void *pvLine, PIXELS_t x, D3DCOLOR dwColor) noexcept
 
COLORREF GetPixColor32 (const void *pvLine, PIXELS_t x) const noexcept
 
void SetPixColor32 (void *pvLine, PIXELS_t x, COLORREF dwColor) noexcept
 
COLORREF GetPixColorRef (const void *pvLine, PIXELS_t x) const
 
COLORREF GetPixColorRef (PIXELS_t x, PIXELS_t y) const
 
void SetPixColorRef (void *pvLine, PIXELS_t x, COLORREF c)
 
void SetPixColorRef (PIXELS_t x, PIXELS_t y, COLORREF c)
 
void ScrollPixels (PIXELS_t cx, PIXELS_t cy)
 
void FillColor (COLORREF colorBack)
 
void SwapTopBottom ()
 
void SetErase ()
 
virtual HRESULT SetPixelData (const cSurfaceBase &rSurfSrc)
 
void SetCopyFrom (const cSurfaceBase &TexSrc, PIXELS_t itxs=0, PIXELS_t itys=0, bool bTextureXReverse=false, bool bTextureYReverse=false, bool bColorReverse=false)
 
void CopyTo (cSurfaceBase &TexDst, PIXELS_t itxs=0, PIXELS_t itys=0, bool bTextureXReverse=false, bool bTextureYReverse=false) const
 
HRESULT InitTestPattern ()
 
 UNITTEST_FRIEND (cSurfaceBase)
 

Public Attributes

cHeapBlock m_Pixels
 Allocated memory for the surface pixels. m_pPixelData. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cSurfaceBase
static bool GetPixColor1P (const void *pvLine, PIXELS_t x) noexcept
 
static void SetPixColor1P (void *pvLine, PIXELS_t x, bool b) noexcept
 
- Protected Member Functions inherited from GrayLib::cSurfaceBase
cSurfaceBaseoperator= (const cSurfaceBase &rSurf)
 
bool InitSurfaceInfo (const cSurfaceInfo &rInfo)
 
bool InitSurfaceAlign (PIXELS_t cx, PIXELS_t cy, size_t nAlignBytes, SURF_FORM_TYPE ePixelFormat)
 
bool InitSurfacePitch (PIXELS_t cx, PIXELS_t cy, size_t uPitchBytes, SURF_FORM_TYPE ePixelFormat)
 
- Protected Member Functions inherited from Gray::cMemBlock
 cMemBlock () noexcept
 
 cMemBlock (const void *pData, size_t nSize) noexcept
 
 cMemBlock (const cMemBlock &block) noexcept
 
 cMemBlock (const cMemBlock *pBlock) noexcept
 
size_t get_DataSize () const noexcept
 
void * get_Data () const noexcept
 
BYTE * get_DataBytes () const noexcept
 
char * get_DataA () const noexcept
 
 operator const BYTE * () const noexcept
 
bool isValidPtr () const noexcept
 
bool IsValidIndex (size_t i) const noexcept
 
bool IsValidIndex2 (size_t i) const noexcept
 
bool IsValidPtr (const void *p) const noexcept
 
bool IsValidPtr2 (const void *p) const noexcept
 
bool IsZeros () const noexcept
 
bool IsEqualData (const void *pData, size_t nSize) const noexcept
 
bool IsEqualData (const cMemBlock *pData) const noexcept
 
bool IsEqualData (const cMemBlock &data) const noexcept
 
BYTE * GetOffset (size_t nOffset) const
 
const void * get_DataEnd () const noexcept
 
void put_DataPtr (void *pStart) noexcept
 
void put_Size (size_t nSize) noexcept
 
void SetBlock (void *pData, size_t nSize) noexcept
 
void SetEmptyBlock () noexcept
 
void InitZeros () noexcept
 
StrLen_t ConvertToString (char *pszDst, StrLen_t iDstSizeMax) const
 
- Static Protected Member Functions inherited from Gray::cMemBlock
static COMPARE_t __stdcall Compare (const void *pData1, size_t iLen1, const void *pData2, size_t iLen2)
 
- Protected Attributes inherited from GrayLib::cSurfaceBase
cSurfaceInfo m_Info
 the image size, pitch and pixel format for m_pPixelData below. More...
 
- Protected Attributes inherited from Gray::cMemBlock
size_t m_nSize
 size_t of m_pData in bytes. May be determined at runtime. More...
 
void * m_pData
 

Detailed Description

Surface where i own/manage the pixel data in system memory. Probably not loaded from file. Use this for temporary working images. not really the same as cImageBase Don't bother with DirectX compatibility here

Constructor & Destructor Documentation

◆ cSurface()

GrayLib::cSurface::cSurface ( )
noexcept

◆ ~cSurface()

GrayLib::cSurface::~cSurface ( )
virtual

m_Mem FreeSurface should be automatic.

Member Function Documentation

◆ CreateSurface()

HRESULT GrayLib::cSurface::CreateSurface ( const cSurfaceInfo rInfo)

allocate space for a frame of a certain format.

◆ CreateSurfaceAlign()

HRESULT GrayLib::cSurface::CreateSurfaceAlign ( PIXELS_t  cx,
PIXELS_t  cy,
size_t  nAlignBytes,
SURF_FORM_TYPE  ePixelFormat 
)

Create a working surface in main memory for rendering this would work better if it lived on the video card e.g. nAlignBytes = sizeof(UINT32)

◆ InitTestPattern()

HRESULT GrayLib::cSurface::InitTestPattern ( SURF_FORM_TYPE  ePixelFormat)

256 x 256 pixels, green = 0

  • ePixelFormat = SURF_FORM_RGB888

◆ LoadRawGrey() [1/2]

HRESULT GrayLib::cSurface::LoadRawGrey ( const FILECHAR_t pszFilename,
PIXELS_t  cx,
PIXELS_t  cy,
SURF_FORM_TYPE  ePixelFormat = SURF_FORM_D16 
)

Load a RAW gray image file.

◆ LoadRawGrey() [2/2]

HRESULT GrayLib::cSurface::LoadRawGrey ( cStreamInput stmIn,
PIXELS_t  cx,
PIXELS_t  cy,
SURF_FORM_TYPE  ePixelFormat = SURF_FORM_D16 
)

◆ SetCopySurface()

HRESULT GrayLib::cSurface::SetCopySurface ( const cSurfaceBase Surf)
virtual

Copy the generic surface. Destroy existing surface.

Reimplemented from GrayLib::cSurfaceBase.

◆ SetEmpty()

void GrayLib::cSurface::SetEmpty ( )
virtual

free all dynamic memory used.

Reimplemented from GrayLib::cSurfaceBase.

◆ UNITTEST_FRIEND()

GrayLib::cSurface::UNITTEST_FRIEND ( cSurface  )

Member Data Documentation

◆ m_Pixels

cHeapBlock GrayLib::cSurface::m_Pixels

Allocated memory for the surface pixels. m_pPixelData.


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