My Project
|
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... | |
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.
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.
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.
bool CGDIEngine::DrawImage | ( | Gdiplus::Image * | image, |
float | x, | ||
float | y, | ||
float | width, | ||
float | height | ||
) |
draw image at given position.
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.
Gdiplus::Bitmap * CGDIEngine::LoadTexture | ( | const string & | filename | ) |
load a texture.
it will cache the file in memory.
filename | if filename is "256", it is render target |
Gdiplus::Bitmap * CGDIEngine::LoadTexture | ( | const string & | filename, |
int | nFileFormat | ||
) |
load a texture.
it will cache the file in memory.
filename | if filename is "256", it is render target |
nFileFormat | one of the FREE_IMAGE_FORMAT. |
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.
colorKey | if 0 no color key is used. for black color key use 0xff000000 |