My Project
Public Types | Public Member Functions | List of all members
ParaEngine::CGDIEngine Class Reference

this allows us to create another device, such as in a worker thread to perform some background work while the main directX device has other work to do. More...

#include <GDIEngine.h>

Public Types

typedef std::map< std::string, Gdiplus::Bitmap * > TextureAsset_Map_Type
 
typedef std::map< std::string, CGDIRenderTarget_ptr > RenderTarget_Map_Type
 

Public Member Functions

virtual HRESULT Create ()
 
virtual HRESULT Destroy ()
 
HRESULT Clear (const Color &color)
 
void SetTransform (const Gdiplus::Matrix *matTransform)
 set transform
 
bool Begin ()
 
bool DrawImage (Gdiplus::Image *image, float x, float y, float width, float height)
 draw image at given position. More...
 
bool DrawImage (Gdiplus::Image *image, float x, float y, float width, float height, DWORD dwColor)
 draw image and pre-multiply it with color. More...
 
void End ()
 
void TestMe ()
 
Gdiplus::Bitmap * LoadTexture (const string &filename)
 load a texture. More...
 
Gdiplus::Bitmap * LoadTexture (const string &filename, int nFileFormat)
 load a texture. More...
 
Gdiplus::Bitmap * LoadTexture (const string &filename, const string &fileextension)
 same as above, except that file format is determined by fileextension.
 
CGDIRenderTarget_ptr CreateGetRenderTarget (const std::string &sName, int nRenderTargetSize=256)
 create get a render target. More...
 
CGDIRenderTarget_ptr CreateGetRenderTargetBySize (int nRenderTargetSize=256)
 create get a render target whose name is tostring(size). More...
 
bool SetRenderTarget (CGDIRenderTarget_ptr pRenderTarget)
 set render target to a given texture.
 
bool SaveRenderTarget (const string &filename, int nWidth=256, int nHeight=256, bool bHasAlpha=true, DWORD colorKey=0)
 save the current render target to file. More...
 

Detailed Description

this allows us to create another device, such as in a worker thread to perform some background work while the main directX device has other work to do.

Member Function Documentation

§ CreateGetRenderTarget()

ParaEngine::CGDIRenderTarget_ptr ParaEngine::CGDIEngine::CreateGetRenderTarget ( const std::string &  sName,
int  nRenderTargetSize = 256 
)

create get a render target.

if a previously create render target exist, the second parameter nRenderTargetSize will be ignored.

§ CreateGetRenderTargetBySize()

ParaEngine::CGDIRenderTarget_ptr ParaEngine::CGDIEngine::CreateGetRenderTargetBySize ( int  nRenderTargetSize = 256)

create get a render target whose name is tostring(size).

For example, if size is 256, then a render target of "256" will be created and returned. this is a handy function to the above CreateGetRenderTarget() function.

§ DrawImage() [1/2]

bool CGDIEngine::DrawImage ( Gdiplus::Image *  image,
float  x,
float  y,
float  width,
float  height 
)

draw image at given position.

§ DrawImage() [2/2]

bool CGDIEngine::DrawImage ( Gdiplus::Image *  image,
float  x,
float  y,
float  width,
float  height,
DWORD  dwColor 
)

draw image and pre-multiply it with color.

This function uses ImageAttributes for color transformation, so it can be very very slow. Use it sparingly.

§ LoadTexture() [1/2]

Gdiplus::Bitmap * CGDIEngine::LoadTexture ( const string &  filename)

load a texture.

it will cache the file in memory.

Parameters
filenameif filename is "256", it is render target

§ LoadTexture() [2/2]

Gdiplus::Bitmap * CGDIEngine::LoadTexture ( const string &  filename,
int  nFileFormat 
)

load a texture.

it will cache the file in memory.

Parameters
filenameif filename is "256", it is render target
nFileFormatone of the FREE_IMAGE_FORMAT.

§ SaveRenderTarget()

bool CGDIEngine::SaveRenderTarget ( const string &  filename,
int  nWidth = 256,
int  nHeight = 256,
bool  bHasAlpha = true,
DWORD  colorKey = 0 
)

save the current render target to file.

Parameters
colorKeyif 0 no color key is used. for black color key use 0xff000000

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