#include <GfxEnv.h>
Public Types | |
enum | SurfaceMode_t { SM_OPENGL , SM_FRAMEBUFFER } |
Public Member Functions | |
eC_Bool | AddLayer (const LayerConfiguration_t &kLayerConfig) |
void | AddMainLayer (const eC_UInt &uiLayerID=0, const eC_Bool &bCached=false) |
eC_UByte | ApplyGlobalAlpha (const eC_UByte &ubAlpha) const |
virtual void | DeInitDisplay () |
virtual void | EndOfRefresh () |
eC_UInt | GetActiveLayerID () const |
virtual eC_UByte | GetBPP () const |
virtual eC_UInt | GetBufferCount () const |
eC_UByte | GetBytesPerPixel (const CGUICommonEnums::ImageType_t &ePixFormat) const |
virtual CGUICommonEnums::ImageType_t | GetColorFormat () const |
void * | GetDisplayBuffer (const eC_UInt &uiLayerID) const |
virtual void ** | GetFrameBuffers () const |
eC_UByte | GetGlobalAlpha () const |
virtual eC_UInt | GetHeight () const |
eC_UByte | GetLayerAlpha (const eC_UInt &uiLayerID) const |
eC_Bool | GetLayerBufferSize (const eC_UInt &uiLayerID, eC_UInt &uiWidth, eC_UInt &uiHeight, eC_UByte &ubBPP) |
eC_Bool | GetLayerChromaKey (const eC_UInt &uiLayerID, eC_Bool &bChromaKeyActive, eC_UInt &uiChromaKey, eC_UByte &ubAlpha) const |
eC_Bool | GetLayerConfig (const eC_UInt &uiLayerIndex, LayerConfiguration_t &rkLayerConfig) const |
eC_Bool | GetLayerConfigForID (const eC_UInt &uiLayerID, LayerConfiguration_t &rkLayerConfig) const |
eC_Bool | GetLayerConfigForMainLayer (LayerConfiguration_t &rkLayerConfig) const |
eC_Bool | GetLayerIndexForID (const eC_UInt &uiLayerID, eC_UInt &ruiLayerIndex) const |
eC_Bool | GetLayerPosition (const eC_UInt &uiLayerID, eC_Int &iXPos, eC_Int &iYPos) |
eC_Bool | GetLayerVisibleSize (const eC_UInt &uiLayerID, eC_UInt &uiWidth, eC_UInt &uiHeight) |
eC_UInt | GetMainLayerID () const |
virtual void * | GetMergeBuffer () const |
eC_UInt | GetNumberOfLayers () const |
void * | GetRenderBuffer (const eC_UInt &uiLayerID) const |
virtual SurfaceMode_t | GetSurfaceMode () const |
virtual eC_UInt | GetWidth () const |
virtual eC_UInt | InitDisplay () |
void | InitLayers () |
void | InvalidateLayer (const eC_UInt &uiLayerID) |
virtual eC_Bool | IsCreated () const |
eC_Bool | IsLayerModified (const eC_UInt &uiLayerID) const |
eC_Bool | IsLayerVisible (const eC_UInt &uiLayerID) const |
eC_Bool | IsMainLayer (const eC_UInt &uiLayerID) const |
virtual eC_Bool | IsNull () |
virtual eC_Bool | IsResizable () const |
virtual eC_Bool | IsVSyncEnabled () const |
virtual eC_Bool | NeedsManualMerge () const |
virtual eC_Bool | RefreshScreen (const CGUIRect &rkInvalidatedArea) |
virtual eC_Bool | RefreshScreen (const eC_TListDoubleLinked< CGUIRect > &kInvalidatedRectList) |
eC_Bool | SetActiveLayerID (const eC_UInt &uiLayerID, const eC_Bool &bMarkAsModified=false) |
virtual void | SetCliprect (const CGUIRect &rkNewClipRect) |
virtual void | SetDevice (void *pkDevice) |
void | SetGfxWrap (CGfxWrap *pkGfxWrap) |
void | SetGlobalAlpha (const eC_UByte &ubGlobalAlpha) |
eC_Bool | SetLayerAlpha (const eC_UInt &uiLayerID, const eC_UByte &ubAlpha) |
eC_Bool | SetLayerChromaKey (const eC_UInt &uiLayerID, const eC_Bool &bChromaKeyActive, const eC_UInt &uiChromaKey, const eC_UByte &ubAlpha) |
eC_Bool | SetLayerPosition (const eC_UInt &uiLayerID, const eC_Int &iXPos, const eC_Int &iYPos) |
eC_Bool | SetLayerVisible (const eC_UInt &uiLayerID, const eC_Bool &bVisible) |
eC_Bool | SetLayerVisiblePos (const eC_UInt &uiLayerID, const eC_Int &iXPos, const eC_Int &iYPos) |
eC_Bool | SetLayerVisibleSize (const eC_UInt &uiLayerID, const eC_UInt &uiWidth, const eC_UInt &uiHeight) |
void | SetMainLayerID (const eC_UInt &uiLayerID) |
void | SetMainLayerProperties (const eC_UInt &uiLayerID, const eC_Bool &bCached) |
void | SetObjectForLayerID (const eC_UInt &uiLayerID, CGUIObject *pkObject) |
virtual void | SetScreenSize (const eC_UInt &uiWidth, const eC_UInt &uiHeight) |
virtual void | SetVSyncEnabled (const eC_Bool &bVSyncEnabled) |
virtual void | SetWindowCaption (const eC_String &kCaption) |
virtual void | StartOfRefresh () |
virtual eC_Bool | SupportsCopy () const |
virtual eC_Bool | SwapBuffers () |
virtual void | UpdateLayer (const LayerConfiguration_t &kLayerConfig, const LayerUpdate_t &eUpdateReason) |
virtual eC_Bool | UpdateLayerBuffers (const eC_UInt &uiLayerID, void *pkRenderBuffer, void *pkDisplayBuffer, const eC_UInt &uiWidth, const eC_UInt &uiHeight) |
void | UpdateLayerPositions () |
Static Public Member Functions | |
static eC_Bool | CreateInstance (const SurfaceMode_t &eSurfaceMode, const CGUICommonEnums::ImageType_t &eScreenFormat, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &uiBufferCount=1, void **ppkBuffers=NULL, const eC_Bool &bResizable=false) |
static void | DeleteInstance () |
called to destroy and detach GfxEnv | |
Protected Member Functions | |
CGfxEnv (const SurfaceMode_t &eSurfaceMode, const CGUICommonEnums::ImageType_t &eScreenFormat, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &uiBufferCount=1, void **ppkBuffers=NULL, const eC_Bool &bResizable=false) | |
virtual | ~CGfxEnv () |
eC_UByte | GetBPPFromScreenFormat () const |
virtual void | InitLayer (const LayerConfiguration_t &kLayerConfig) |
void | UpdateMainLayer (const CGUICommonEnums::ImageType_t &eColorFormat, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &uiBufferCount, void **ppkBuffers) |
Protected Attributes | |
eC_TArray< LayerConfiguration_t > | m_akLayers |
: *DCLayer_t, one DCLayer_t struct per layer storing general settings | |
eC_Bool | m_bNeedsManualMerge |
if supports merge | |
eC_Bool | m_bResizable |
resizable | |
eC_Bool | m_bSupportsCopy |
if supports copy | |
eC_Bool | m_bVSyncEnabled |
if vsync is enabled | |
CGUICommonEnums::ImageType_t | m_eColorFormat |
color-format | |
SurfaceMode_t | m_eSurfaceMode |
surface mode | |
eC_Int | m_iMainLayerID |
id of main-layer | |
CGfxWrap * | m_pkGfxWrap |
pointer to GfxWrapper | |
void ** | m_ppkBuffers |
buffers for the main-screen | |
eC_UByte | m_ubBPP |
BPP of the surface. | |
eC_UByte | m_ubGlobalAlpha |
global alpha for blending | |
eC_UInt | m_uiActiveLayerID |
: unsigned int = Active Layer | |
eC_UInt | m_uiActiveLayerIndex |
index of currentl< active layer | |
eC_UInt | m_uiBufferCount |
number of buffers used | |
eC_UInt | m_uiHeight |
height of the surface | |
eC_UInt | m_uiWidth |
width of the surface | |
Friends | |
class | CGUIComponentManager |
This is the base-class for all GfxEnvXXX-classes dealing with environment used by the GfxWrap
This class is used to set up the environment for the actual GfxWrap with a generic interface. It will provide the size, buffers and all necessary data. Additionally it will hold all hardware layers.
Typical order of events:
After the frame has been drawn by the GfxWrap into the currently active render-buffer the refresh is done Inside the refresh the following things are done for each layer
After that EndOfRefresh and RefreshScreen with each invalidated region is called
Depending on the actual underlying API UpdateLayerBuffers can be used to execute cache-invalidation on the buffers currently used for drawing. Additionally the switch of buffers for the display-hardware can be done.
In EndOfRefresh the switch of all used buffers should already be done, thus it can be used to wait for a vertical sync-signal.
RefreshScreen can be used to copy the regions that have been redrawn in the last frame over to the new drawing-buffer to start the next frame.
|
protected |
Constructor
eSurfaceMode | OpenGL or Framebuffer |
eScreenFormat | screen-format |
uiWidth | width |
uiHeight | height |
uiBufferCount | number of buffers to use |
ppkBuffers | buffers to use |
bResizable | true if resizable |
|
protectedvirtual |
Destructor
eC_Bool CGfxEnv::AddLayer | ( | const LayerConfiguration_t & | kLayerConfig | ) |
Add layer to internal configuration. should only be called during startup of application
kLayerConfig | layer-configuration |
void CGfxEnv::AddMainLayer | ( | const eC_UInt & | uiLayerID = 0 , |
const eC_Bool & | bCached = false |
||
) |
Set information for the main-layer
uiLayerID | the id for the layer (default: 0) |
bCached | true if the layer-memory is cached (default: false) |
eC_UByte CGfxEnv::ApplyGlobalAlpha | ( | const eC_UByte & | ubAlpha | ) | const |
Calculate the alpha-value according to the global alpha
ubAlpha | input alpha-value |
|
static |
Create Instance
eSurfaceMode | surface-mode |
eScreenFormat | screen-format |
uiWidth | width |
uiHeight | height |
uiBufferCount | number of buffers to use |
ppkBuffers | pointers to buffers |
bResizable | true if resizable |
|
inlinevirtual |
De-Initialize display
Reimplemented in CGfxEnvDAVE.
|
inlinevirtual |
This will be called when all layers have been refreshed. To wait for V-sync this would be the right place.
Reimplemented in CGfxEnvCDC, CGfxEnvCDCDI, CGfxEnvDAVE, CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL2, and CGfxEnvWin.
eC_UInt CGfxEnv::GetActiveLayerID | ( | ) | const |
Return the id of the currently active layer
|
virtual |
Get the BPP of the surface
|
protected |
Get the number of bits per pixel from the screen-format
|
virtual |
Get number of used buffers
eC_UByte CGfxEnv::GetBytesPerPixel | ( | const CGUICommonEnums::ImageType_t & | ePixFormat | ) | const |
Return the number of bytes per pixel for pixel-format
ePixFormat |
|
virtual |
Retrieve the Screen-Format (e.g. RGB565)
void * CGfxEnv::GetDisplayBuffer | ( | const eC_UInt & | uiLayerID | ) | const |
Get the currently active buffer which is used for display
uiLayerID | id of layer |
|
inlinevirtual |
return the used framebuffer if any
Reimplemented in CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL, CGfxEnvSDL2, and CGfxEnvWin.
eC_UByte CGfxEnv::GetGlobalAlpha | ( | ) | const |
Return the currently set global alpha-value
|
virtual |
eC_UByte CGfxEnv::GetLayerAlpha | ( | const eC_UInt & | uiLayerID | ) | const |
Get the current alpha-value for the given layer.
uiLayerID | id of layer |
eC_Bool CGfxEnv::GetLayerBufferSize | ( | const eC_UInt & | uiLayerID, |
eC_UInt & | uiWidth, | ||
eC_UInt & | uiHeight, | ||
eC_UByte & | ubBPP | ||
) |
Get the size of the buffer attached to the given layer.
uiLayerID | id of layer |
uiWidth | width of layer |
uiHeight | height of layer |
ubBPP | bytes per pixel |
eC_Bool CGfxEnv::GetLayerChromaKey | ( | const eC_UInt & | uiLayerID, |
eC_Bool & | bChromaKeyActive, | ||
eC_UInt & | uiChromaKey, | ||
eC_UByte & | ubAlpha | ||
) | const |
Get the current chroma-key settings for the given layer.
uiLayerID | id of layer |
bChromaKeyActive | true if chroma-keying is active |
uiChromaKey | the color for chroma-keying |
ubAlpha | alpha-value for replacement |
eC_Bool CGfxEnv::GetLayerConfig | ( | const eC_UInt & | uiLayerIndex, |
LayerConfiguration_t & | rkLayerConfig | ||
) | const |
Get configuration for given layer. Note: this will need an index instead of id
uiLayerIndex | index of layer in internal data |
rkLayerConfig | configuation of layer |
eC_Bool CGfxEnv::GetLayerConfigForID | ( | const eC_UInt & | uiLayerID, |
LayerConfiguration_t & | rkLayerConfig | ||
) | const |
Get configuration for layer with given ID
uiLayerID | id of layer |
rkLayerConfig | configuation of layer |
eC_Bool CGfxEnv::GetLayerConfigForMainLayer | ( | LayerConfiguration_t & | rkLayerConfig | ) | const |
Get configuration for main-layer
rkLayerConfig | configuation of layer |
eC_Bool CGfxEnv::GetLayerIndexForID | ( | const eC_UInt & | uiLayerID, |
eC_UInt & | ruiLayerIndex | ||
) | const |
—— layer functionality ——
Get the internal index for given layer-id
uiLayerID | id of requested layer |
ruiLayerIndex | internal index |
eC_Bool CGfxEnv::GetLayerPosition | ( | const eC_UInt & | uiLayerID, |
eC_Int & | iXPos, | ||
eC_Int & | iYPos | ||
) |
Get the current position for the given layer
uiLayerID | id of layer |
iXPos | x-position |
iYPos | y-position |
eC_Bool CGfxEnv::GetLayerVisibleSize | ( | const eC_UInt & | uiLayerID, |
eC_UInt & | uiWidth, | ||
eC_UInt & | uiHeight | ||
) |
Get the visible size for the given layer
uiLayerID | id of layer |
uiWidth | visible width |
uiHeight | visible height |
eC_UInt CGfxEnv::GetMainLayerID | ( | ) | const |
Return the ID of the main-layer
|
inlinevirtual |
eC_UInt CGfxEnv::GetNumberOfLayers | ( | ) | const |
Return number of configured layers
void * CGfxEnv::GetRenderBuffer | ( | const eC_UInt & | uiLayerID | ) | const |
Get the currently active buffer which is used for rendering
uiLayerID | id of layer |
|
virtual |
Retrieve the Surface-Mode
|
virtual |
|
inlinevirtual |
|
inlineprotectedvirtual |
Initialize layer this can be used to execute platform-specific code is called when layer gets added to DCWrap
kLayerConfig | layer-configuration |
Reimplemented in CGfxEnvDAVE.
void CGfxEnv::InitLayers | ( | ) |
Initialize layers after all layers have been added
void CGfxEnv::InvalidateLayer | ( | const eC_UInt & | uiLayerID | ) |
Refresh layer after content has been changed. This applies merely to layers containing user-defined content
uiLayerID | id of layer to refresh |
|
virtual |
Is surface created
Reimplemented in CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL, and CGfxEnvSDL2.
eC_Bool CGfxEnv::IsLayerModified | ( | const eC_UInt & | uiLayerID | ) | const |
Return if layer was recently modified
uiLayerID | id of layer |
eC_Bool CGfxEnv::IsLayerVisible | ( | const eC_UInt & | uiLayerID | ) | const |
Get current visibility of layer
uiLayerID | id of layer |
eC_Bool CGfxEnv::IsMainLayer | ( | const eC_UInt & | uiLayerID | ) | const |
Return if layer is set to be used as main-layer
uiLayerID | id of layer |
|
inlinevirtual |
|
virtual |
Get Resizable
|
inlinevirtual |
Return if VSync is enabled
|
virtual |
Get if merge is needed
|
inlinevirtual |
Refresh the screen within the given invalidate area. This can be used to copy regions of the display-buffer to the drawing-buffer
rkInvalidatedArea | This area will be refreshed. |
Reimplemented in CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL, and CGfxEnvWin.
|
virtual |
Refresh multiple parts of the screen
kInvalidatedRectList | invalidated areas |
eC_Bool CGfxEnv::SetActiveLayerID | ( | const eC_UInt & | uiLayerID, |
const eC_Bool & | bMarkAsModified = false |
||
) |
Set the given layer-id as the active all following access for rendering will be sent to the layer
uiLayerID | id of layer |
bMarkAsModified | layer will be marked as modified upon switch (default: false) |
|
inlinevirtual |
Set the clip rectangle.
rkNewClipRect | The new clipping rectangle. |
Reimplemented in CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, and CGfxEnvSDL.
|
inlinevirtual |
|
inline |
Set the GfxWrapper
pkGfxWrap |
void CGfxEnv::SetGlobalAlpha | ( | const eC_UByte & | ubGlobalAlpha | ) |
Set the global alpha-value, which is used to correctly blend the layers during a transition
ubGlobalAlpha |
eC_Bool CGfxEnv::SetLayerAlpha | ( | const eC_UInt & | uiLayerID, |
const eC_UByte & | ubAlpha | ||
) |
Set the alpha-value for blending between layer for the given layer.
uiLayerID | id of layer |
ubAlpha | alpha-value |
eC_Bool CGfxEnv::SetLayerChromaKey | ( | const eC_UInt & | uiLayerID, |
const eC_Bool & | bChromaKeyActive, | ||
const eC_UInt & | uiChromaKey, | ||
const eC_UByte & | ubAlpha | ||
) |
Set the chroma-key for blending between layer for the given layer.
uiLayerID | id of layer |
bChromaKeyActive | true if chroma-keying is active |
uiChromaKey | the color for chroma-keying |
ubAlpha | alpha-value for replacement |
eC_Bool CGfxEnv::SetLayerPosition | ( | const eC_UInt & | uiLayerID, |
const eC_Int & | iXPos, | ||
const eC_Int & | iYPos | ||
) |
Set the position for the given layer
uiLayerID | id of layer |
iXPos | x-position |
iYPos | y-position |
eC_Bool CGfxEnv::SetLayerVisible | ( | const eC_UInt & | uiLayerID, |
const eC_Bool & | bVisible | ||
) |
Set the layer to visible
uiLayerID | id of layer |
bVisible | visibility of layer |
eC_Bool CGfxEnv::SetLayerVisiblePos | ( | const eC_UInt & | uiLayerID, |
const eC_Int & | iXPos, | ||
const eC_Int & | iYPos | ||
) |
Set the visible position for the given layer
uiLayerID | id of layer |
iXPos | x-position |
iYPos | y-position |
eC_Bool CGfxEnv::SetLayerVisibleSize | ( | const eC_UInt & | uiLayerID, |
const eC_UInt & | uiWidth, | ||
const eC_UInt & | uiHeight | ||
) |
Set the visible size for the given layer
uiLayerID | id of layer |
uiWidth | visible width |
uiHeight | visible height |
void CGfxEnv::SetMainLayerID | ( | const eC_UInt & | uiLayerID | ) |
This will set the id of the main-layer
uiLayerID | id of layer |
void CGfxEnv::SetMainLayerProperties | ( | const eC_UInt & | uiLayerID, |
const eC_Bool & | bCached | ||
) |
Set the configuration of the main-layer
uiLayerID | set layer-id (default: 0) |
bCached | set to true if layer-memory is cached (default: false) |
void CGfxEnv::SetObjectForLayerID | ( | const eC_UInt & | uiLayerID, |
CGUIObject * | pkObject | ||
) |
This will link an object to a specific layer. this info is used in UpdateLayerPositions
uiLayerID | id of layer |
pkObject | pointer to object |
|
virtual |
Set the screen-size this will normally result in recreating the surfaces
uiWidth | |
uiHeight |
Reimplemented in CGfxEnvSDL, and CGfxEnvSDL2.
|
virtual |
Set if VSync is enabled
bVSyncEnabled | set to true if VSync is enabled |
|
inlinevirtual |
Set the window caption
kCaption |
Reimplemented in CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL, CGfxEnvSDL2, and CGfxEnvWin.
|
inlinevirtual |
This will be called at the start of refresh
Reimplemented in CGfxEnvDAVE.
|
virtual |
Get if copy is supported
|
inlinevirtual |
Swap buffers
Reimplemented in CGfxEnvEGL, CGfxEnvFBDevice, CGfxEnvFBDeviceRZA2M, CGfxEnvSDL, CGfxEnvSDL2, and CGfxEnvWin.
|
inlinevirtual |
Update layer according to reason. This will be called when attributes of the layer (position, size, etc) have changed
kLayerConfig | configuration of updated layer |
eUpdateReason | reason of update |
Reimplemented in CGfxEnvDAVE.
|
virtual |
Update buffers for layer
uiLayerID | id of layer |
pkRenderBuffer | currently used buffer for rendering |
pkDisplayBuffer | currently used buffer for display |
uiWidth | width of layer |
uiHeight | height of layer |
Reimplemented in CGfxEnvCDC, CGfxEnvCDCDI, and CGfxEnvDAVE.
void CGfxEnv::UpdateLayerPositions | ( | ) |
This will update the positions for all layers, BEFORE the redraw is done.
|
protected |
Update settings of main-layer
eColorFormat | color-format |
uiWidth | width |
uiHeight | height |
uiBufferCount | number of buffers |
ppkBuffers | pointer to buffers |