My Project
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CGDIGraphics Class Reference

Public Member Functions

void SetRenderTarget (TextureEntity *pEntity)
 this will internally create the CGDIDC object from the render target texture. More...
 
TextureEntityGetRenderTarget ()
 
HRESULT Render ()
 render to the current DC
 
void Invalidate (bool bInvalidate=true)
 Invalidate the graphics, causing the entire render target to be redrawn at the next render call.
 
bool IsInvalidated ()
 whether it is invalidated
 
CGDIPenGetCurrentPen ()
 get the current pen object More...
 
void SetCurrentPen (const CGDIPen &pen)
 set the current pen object More...
 
CGDIPenCreatePen (string name)
 create a new pen object in the pen pools More...
 
CGDIPenGetPen (string name)
 get a new pen object in the pen pools
 
bool SaveAs (const char *filename)
 save the current texture to disk file. More...
 
bool LoadFromTexture (TextureEntity *pTexture)
 load the texture from a disk image.The current graphics will be reset. More...
 
TextureEntityGetDiskTexture ()
 get the current disk texture. More...
 
void Reset ()
 reset to be reused. More...
 
HRESULT Clear (const Color &color)
 Clears the current render target of the CGDIGraphics.
 
HRESULT DrawLine (const CGDIPen *pen, const Vector3 &point1, const Vector3 &point2)
 Draw a line with a specific pen, the operation is pending If point1=point2, the line will not draw.
 
HRESULT DrawLines (const CGDIPen *pen, const Vector3 *points, int nNumPoints)
 
HRESULT DrawImage (GUITextureElement *pElement, RECT *prcDest, float depth)
 
HRESULT DrawPoint (const CGDIPen *pen, const Vector3 &point)
 Draw a point with a specific pen, the operation is pending.
 
void Undo (int nStep=1)
 undo a certain amount of steps
 
void Redo (int nStep=1)
 redo a certain amount of steps
 
void SetClip (const CGDIRegion &region)
 Set the current clipping rectangle for the path.
 
const CGDIRegionGetClip () const
 
CGDIDCLockDC ()
 
void UnlockDC ()
 
HRESULT RestoreDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has been reset, which will happen after a lost device scenario. More...
 
HRESULT InvalidateDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has entered a lost state and before IDirect3DDevice9::Reset is called. More...
 

Protected Member Functions

HRESULT CalculatePath (CGDIGraphicsPath &pPath)
 

Protected Attributes

CGDIDCm_pDC
 Calculate the two vertices for one end of a given line. More...
 
bool m_bLocked
 
bool m_bInvalidated
 if this is true, the graphics will be redrawn at the next render frame
 
CGDIGraphicsPath m_path
 
CGDIRegion m_region
 
asset_ptr< TextureEntitym_pDiskTexture
 the texture entity that is saved and persistent to disk file. More...
 
CGDIPen m_currentPen
 the current pen object
 
map< string, CGDIPenm_pens
 available pens
 

Member Function Documentation

§ CreatePen()

CGDIPen * CGDIGraphics::CreatePen ( string  name)

create a new pen object in the pen pools

Parameters
name
Returns
NULL may be returned if pen is not valid

§ GetCurrentPen()

CGDIPen* ParaEngine::CGDIGraphics::GetCurrentPen ( )
inline

get the current pen object

Returns

§ GetDiskTexture()

TextureEntity * CGDIGraphics::GetDiskTexture ( )

get the current disk texture.

NULL may be returned.

§ InvalidateDeviceObjects()

HRESULT CGDIGraphics::InvalidateDeviceObjects ( )

This callback function will be called immediately after the Direct3D device has entered a lost state and before IDirect3DDevice9::Reset is called.

Resources created in the OnResetDevice callback should be released here, which generally includes all D3DPOOL_DEFAULT resources. See the "Lost Devices" section of the documentation for information about lost devices.

§ LoadFromTexture()

bool CGDIGraphics::LoadFromTexture ( TextureEntity pTexture)

load the texture from a disk image.The current graphics will be reset.

§ Reset()

void CGDIGraphics::Reset ( )

reset to be reused.

Nothing except the disk texture will be drawn.

§ RestoreDeviceObjects()

HRESULT CGDIGraphics::RestoreDeviceObjects ( )

This callback function will be called immediately after the Direct3D device has been reset, which will happen after a lost device scenario.

This is the best location to create D3DPOOL_DEFAULT resources since these resources need to be reloaded whenever the device is lost. Resources created here should be released in the OnLostDevice callback.

§ SaveAs()

bool CGDIGraphics::SaveAs ( const char *  filename)

save the current texture to disk file.

When we saved the current graphics to disk, we will also reset the graphics object to disk.

§ SetCurrentPen()

void ParaEngine::CGDIGraphics::SetCurrentPen ( const CGDIPen pen)
inline

set the current pen object

Parameters
pen

§ SetRenderTarget()

void CGDIGraphics::SetRenderTarget ( TextureEntity pEntity)

this will internally create the CGDIDC object from the render target texture.

Member Data Documentation

§ m_pDC

CGDIDC* ParaEngine::CGDIGraphics::m_pDC
protected

Calculate the two vertices for one end of a given line.

Parameters
point1,point2[in] the first and second point of a line. If the two points are the same, it will be treated as a point. In this case, nState=0 will return zero vertices;
vex1,vex2[out] the return vertices;
pPen[in] pointer to the pen used to draw this line.
nStateSpecify which cap we like nState=0: no cap, the return vertices are based on the first point, this is for the middle points of a polyline. nState=-1 start cap, the return vertices are the start cap based on the first point; nState=1 end cap, the return vertices are the end cap based on the second point;

§ m_pDiskTexture

asset_ptr<TextureEntity> ParaEngine::CGDIGraphics::m_pDiskTexture
protected

the texture entity that is saved and persistent to disk file.


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