Guiliani  Version 2.5 revision 7293 (documentation build 13)
GfxEnv.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef __GFXENV_H__
11#define __GFXENV_H__
12
13#include "eC_Types.h"
14#include "eC_String.h"
15
16#include "GUICommonEnums.h"
17#include "eC_TList_doubleLinked.h"
18
19#include "GUIRect.h"
20
21#include "GUILayerConfig.h"
22
23#include "GUIComponentManager.h"
24
25#define GETGFXENV CGUIComponentManager::GetInstance().GetGfxEnv()
26
27class CGfxWrap;
28
53{
54 // for calling destructor
55 friend class CGUIComponentManager;
56
57public:
60 {
63 };
64
65public:
76 static eC_Bool CreateInstance(
77 const SurfaceMode_t& eSurfaceMode,
78 const CGUICommonEnums::ImageType_t& eScreenFormat,
79 const eC_UInt& uiWidth,
80 const eC_UInt& uiHeight,
81 const eC_UInt& uiBufferCount = 1,
82 void** ppkBuffers = NULL,
83 const eC_Bool& bResizable = false);
84
86 static void DeleteInstance();
87
93 virtual void SetScreenSize(
94 const eC_UInt& uiWidth,
95 const eC_UInt& uiHeight);
96
100 virtual void SetVSyncEnabled(const eC_Bool& bVSyncEnabled);
101
105 virtual eC_Bool IsCreated() const;
106
111
116
120 virtual eC_UInt GetWidth() const;
121
125 virtual eC_UInt GetHeight() const;
126
130 virtual eC_UByte GetBPP() const;
131
135 virtual eC_Bool IsResizable() const;
136
140 virtual eC_Bool NeedsManualMerge() const;
141
145 virtual eC_Bool SupportsCopy() const;
146
150 virtual eC_UInt GetBufferCount() const;
151
155 virtual void** GetFrameBuffers() const { return m_ppkBuffers; }
156
160 virtual eC_Bool IsVSyncEnabled() const { return m_bVSyncEnabled; }
161
167 virtual eC_Bool RefreshScreen(const CGUIRect& rkInvalidatedArea) { return false; }
168
173 virtual eC_Bool RefreshScreen(const eC_TListDoubleLinked<CGUIRect>& kInvalidatedRectList);
174
178 virtual void SetCliprect(const CGUIRect& rkNewClipRect) {}
179
183 virtual void SetWindowCaption(const eC_String& kCaption) {}
184
188 virtual eC_Bool SwapBuffers() { return false; }
189
194 virtual eC_UInt InitDisplay() { return 1; }
195
199 virtual void DeInitDisplay() {}
200
209 eC_Bool GetLayerIndexForID(const eC_UInt& uiLayerID, eC_UInt& ruiLayerIndex) const;
210
218 eC_Bool SetActiveLayerID(const eC_UInt& uiLayerID, const eC_Bool& bMarkAsModified = false);
219
224 eC_UInt GetActiveLayerID() const;
225
231 eC_Bool IsLayerModified(const eC_UInt& uiLayerID) const;
232
242 virtual eC_Bool UpdateLayerBuffers(const eC_UInt& uiLayerID, void* pkRenderBuffer, void* pkDisplayBuffer, const eC_UInt& uiWidth, const eC_UInt& uiHeight);
243
248 void AddMainLayer(const eC_UInt& uiLayerID = 0, const eC_Bool& bCached = false);
249
254 void SetMainLayerProperties(const eC_UInt& uiLayerID, const eC_Bool& bCached);
255
261 eC_Bool AddLayer(const LayerConfiguration_t& kLayerConfig);
262
267
272 eC_UInt GetNumberOfLayers() const;
273
280 eC_Bool GetLayerConfig(const eC_UInt& uiLayerIndex, LayerConfiguration_t& rkLayerConfig) const;
281
288 eC_Bool GetLayerConfigForID(const eC_UInt& uiLayerID, LayerConfiguration_t& rkLayerConfig) const;
289
296
303 eC_Bool SetLayerVisible(const eC_UInt& uiLayerID, const eC_Bool& bVisible);
304
310 eC_Bool IsLayerVisible(const eC_UInt& uiLayerID) const;
311
319 eC_Bool SetLayerPosition(const eC_UInt& uiLayerID, const eC_Int& iXPos, const eC_Int& iYPos);
320
328 eC_Bool GetLayerPosition(const eC_UInt& uiLayerID, eC_Int& iXPos, eC_Int& iYPos);
329
337 eC_Bool SetLayerVisibleSize(const eC_UInt& uiLayerID, const eC_UInt& uiWidth, const eC_UInt& uiHeight);
338
346 eC_Bool GetLayerVisibleSize(const eC_UInt& uiLayerID, eC_UInt& uiWidth, eC_UInt& uiHeight);
347
355 eC_Bool SetLayerVisiblePos(const eC_UInt& uiLayerID, const eC_Int& iXPos, const eC_Int& iYPos);
356
363 eC_Bool SetLayerAlpha(const eC_UInt& uiLayerID, const eC_UByte& ubAlpha);
364
370 eC_UByte GetLayerAlpha(const eC_UInt& uiLayerID) const;
371
380 eC_Bool SetLayerChromaKey(const eC_UInt& uiLayerID, const eC_Bool& bChromaKeyActive, const eC_UInt& uiChromaKey, const eC_UByte& ubAlpha);
381
390 eC_Bool GetLayerChromaKey(const eC_UInt& uiLayerID, eC_Bool& bChromaKeyActive, eC_UInt& uiChromaKey, eC_UByte& ubAlpha) const;
391
400 eC_Bool GetLayerBufferSize(const eC_UInt& uiLayerID, eC_UInt& uiWidth, eC_UInt& uiHeight, eC_UByte& ubBPP);
401
408 virtual void UpdateLayer(const LayerConfiguration_t& kLayerConfig, const LayerUpdate_t& eUpdateReason) {}
409
415 void* GetRenderBuffer(const eC_UInt& uiLayerID) const;
416
422 void* GetDisplayBuffer(const eC_UInt& uiLayerID) const;
423
428 void InvalidateLayer(const eC_UInt& uiLayerID);
429
434
440 void SetObjectForLayerID(const eC_UInt& uiLayerID, CGUIObject* pkObject);
441
447 void SetGlobalAlpha(const eC_UByte& ubGlobalAlpha);
448
453 eC_UByte GetGlobalAlpha() const;
454
460 eC_UByte ApplyGlobalAlpha(const eC_UByte& ubAlpha) const;
461
465 virtual void StartOfRefresh() {}
466
471 virtual void EndOfRefresh() {}
472
477 void SetMainLayerID(const eC_UInt& uiLayerID);
478
483 eC_UInt GetMainLayerID() const;
484
490 eC_Bool IsMainLayer(const eC_UInt& uiLayerID) const;
491
495 virtual eC_Bool IsNull() { return false; }
496
500 void SetGfxWrap(CGfxWrap* pkGfxWrap) { m_pkGfxWrap = pkGfxWrap; }
501
506 eC_UByte GetBytesPerPixel(const CGUICommonEnums::ImageType_t& ePixFormat) const;
507
511 virtual void SetDevice(void* pkDevice) {}
512
516 virtual void* GetMergeBuffer() const { return NULL; }
517
518protected:
529 const SurfaceMode_t& eSurfaceMode,
530 const CGUICommonEnums::ImageType_t& eScreenFormat,
531 const eC_UInt& uiWidth,
532 const eC_UInt& uiHeight,
533 const eC_UInt& uiBufferCount = 1,
534 void** ppkBuffers = NULL,
535 const eC_Bool& bResizable = false);
536
539 virtual ~CGfxEnv();
540
544 eC_UByte GetBPPFromScreenFormat() const;
545
553 virtual void InitLayer(const LayerConfiguration_t& kLayerConfig) {}
554
564 const CGUICommonEnums::ImageType_t& eColorFormat,
565 const eC_UInt& uiWidth, const eC_UInt& uiHeight,
566 const eC_UInt& uiBufferCount,
567 void** ppkBuffers);
568
569protected:
572 eC_UInt m_uiWidth;
573 eC_UInt m_uiHeight;
574 eC_UByte m_ubBPP;
577 eC_Bool m_bResizable;
580
581protected:
582 eC_TArray<LayerConfiguration_t> m_akLayers;
585
587
591};
592#endif
ImageType_t
Definition: GUICommonEnums.h:80
central component-manager
Definition: GUIComponentManager.h:62
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
Definition: GfxEnv.h:53
eC_UInt GetNumberOfLayers() const
virtual void SetVSyncEnabled(const eC_Bool &bVSyncEnabled)
virtual eC_Bool IsVSyncEnabled() const
Definition: GfxEnv.h:160
void ** m_ppkBuffers
buffers for the main-screen
Definition: GfxEnv.h:576
virtual SurfaceMode_t GetSurfaceMode() const
virtual eC_Bool SwapBuffers()
Definition: GfxEnv.h:188
eC_Bool m_bVSyncEnabled
if vsync is enabled
Definition: GfxEnv.h:590
eC_Bool AddLayer(const LayerConfiguration_t &kLayerConfig)
eC_Bool SetLayerVisible(const eC_UInt &uiLayerID, const eC_Bool &bVisible)
SurfaceMode_t m_eSurfaceMode
surface mode
Definition: GfxEnv.h:570
eC_Bool GetLayerConfigForMainLayer(LayerConfiguration_t &rkLayerConfig) const
void SetMainLayerID(const eC_UInt &uiLayerID)
virtual void DeInitDisplay()
Definition: GfxEnv.h:199
void SetObjectForLayerID(const eC_UInt &uiLayerID, CGUIObject *pkObject)
eC_UByte m_ubGlobalAlpha
global alpha for blending
Definition: GfxEnv.h:589
eC_Bool GetLayerIndexForID(const eC_UInt &uiLayerID, eC_UInt &ruiLayerIndex) const
eC_Bool SetLayerPosition(const eC_UInt &uiLayerID, const eC_Int &iXPos, const eC_Int &iYPos)
void SetMainLayerProperties(const eC_UInt &uiLayerID, const eC_Bool &bCached)
eC_Bool GetLayerChromaKey(const eC_UInt &uiLayerID, eC_Bool &bChromaKeyActive, eC_UInt &uiChromaKey, eC_UByte &ubAlpha) const
eC_UByte m_ubBPP
BPP of the surface.
Definition: GfxEnv.h:574
eC_Int m_iMainLayerID
id of main-layer
Definition: GfxEnv.h:588
void SetGlobalAlpha(const eC_UByte &ubGlobalAlpha)
void UpdateMainLayer(const CGUICommonEnums::ImageType_t &eColorFormat, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &uiBufferCount, void **ppkBuffers)
virtual void UpdateLayer(const LayerConfiguration_t &kLayerConfig, const LayerUpdate_t &eUpdateReason)
Definition: GfxEnv.h:408
void * GetDisplayBuffer(const eC_UInt &uiLayerID) const
virtual eC_Bool NeedsManualMerge() const
virtual eC_UInt GetWidth() const
virtual void SetDevice(void *pkDevice)
Definition: GfxEnv.h:511
void * GetRenderBuffer(const eC_UInt &uiLayerID) const
virtual eC_Bool RefreshScreen(const eC_TListDoubleLinked< CGUIRect > &kInvalidatedRectList)
virtual void StartOfRefresh()
Definition: GfxEnv.h:465
virtual void SetScreenSize(const eC_UInt &uiWidth, const eC_UInt &uiHeight)
eC_Bool m_bNeedsManualMerge
if supports merge
Definition: GfxEnv.h:578
virtual void SetCliprect(const CGUIRect &rkNewClipRect)
Definition: GfxEnv.h:178
eC_Bool SetLayerVisiblePos(const eC_UInt &uiLayerID, const eC_Int &iXPos, const eC_Int &iYPos)
void InvalidateLayer(const eC_UInt &uiLayerID)
eC_Bool SetActiveLayerID(const eC_UInt &uiLayerID, const eC_Bool &bMarkAsModified=false)
eC_Bool GetLayerConfigForID(const eC_UInt &uiLayerID, LayerConfiguration_t &rkLayerConfig) const
SurfaceMode_t
Definition: GfxEnv.h:60
@ SM_OPENGL
use OpenGL for surface
Definition: GfxEnv.h:61
@ SM_FRAMEBUFFER
use framebuffer for surface
Definition: GfxEnv.h:62
eC_Bool m_bResizable
resizable
Definition: GfxEnv.h:577
virtual void EndOfRefresh()
Definition: GfxEnv.h:471
virtual eC_UInt InitDisplay()
Definition: GfxEnv.h:194
eC_Bool GetLayerPosition(const eC_UInt &uiLayerID, eC_Int &iXPos, eC_Int &iYPos)
eC_UInt GetActiveLayerID() const
eC_UByte GetLayerAlpha(const eC_UInt &uiLayerID) const
virtual eC_Bool IsNull()
Definition: GfxEnv.h:495
eC_UByte ApplyGlobalAlpha(const eC_UByte &ubAlpha) const
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)
eC_Bool SetLayerAlpha(const eC_UInt &uiLayerID, const eC_UByte &ubAlpha)
eC_UByte GetGlobalAlpha() const
eC_Bool SetLayerChromaKey(const eC_UInt &uiLayerID, const eC_Bool &bChromaKeyActive, const eC_UInt &uiChromaKey, const eC_UByte &ubAlpha)
void AddMainLayer(const eC_UInt &uiLayerID=0, const eC_Bool &bCached=false)
virtual eC_Bool IsResizable() const
virtual void * GetMergeBuffer() const
Definition: GfxEnv.h:516
static void DeleteInstance()
called to destroy and detach GfxEnv
eC_UInt GetMainLayerID() const
virtual ~CGfxEnv()
eC_Bool m_bSupportsCopy
if supports copy
Definition: GfxEnv.h:579
virtual eC_Bool IsCreated() const
eC_Bool SetLayerVisibleSize(const eC_UInt &uiLayerID, const eC_UInt &uiWidth, const eC_UInt &uiHeight)
virtual eC_Bool SupportsCopy() const
eC_Bool GetLayerConfig(const eC_UInt &uiLayerIndex, LayerConfiguration_t &rkLayerConfig) const
virtual eC_UInt GetHeight() const
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 eC_Bool UpdateLayerBuffers(const eC_UInt &uiLayerID, void *pkRenderBuffer, void *pkDisplayBuffer, const eC_UInt &uiWidth, const eC_UInt &uiHeight)
eC_TArray< LayerConfiguration_t > m_akLayers
: *DCLayer_t, one DCLayer_t struct per layer storing general settings
Definition: GfxEnv.h:582
eC_UByte GetBPPFromScreenFormat() const
eC_UByte GetBytesPerPixel(const CGUICommonEnums::ImageType_t &ePixFormat) const
void InitLayers()
eC_UInt m_uiBufferCount
number of buffers used
Definition: GfxEnv.h:575
virtual CGUICommonEnums::ImageType_t GetColorFormat() const
virtual eC_Bool RefreshScreen(const CGUIRect &rkInvalidatedArea)
Definition: GfxEnv.h:167
eC_UInt m_uiActiveLayerIndex
index of currentl< active layer
Definition: GfxEnv.h:584
CGfxWrap * m_pkGfxWrap
pointer to GfxWrapper
Definition: GfxEnv.h:586
CGUICommonEnums::ImageType_t m_eColorFormat
color-format
Definition: GfxEnv.h:571
eC_Bool IsMainLayer(const eC_UInt &uiLayerID) const
virtual void InitLayer(const LayerConfiguration_t &kLayerConfig)
Definition: GfxEnv.h:553
eC_UInt m_uiWidth
width of the surface
Definition: GfxEnv.h:572
eC_Bool IsLayerModified(const eC_UInt &uiLayerID) const
eC_UInt m_uiHeight
height of the surface
Definition: GfxEnv.h:573
eC_Bool IsLayerVisible(const eC_UInt &uiLayerID) const
virtual void SetWindowCaption(const eC_String &kCaption)
Definition: GfxEnv.h:183
virtual eC_UByte GetBPP() const
eC_UInt m_uiActiveLayerID
: unsigned int = Active Layer
Definition: GfxEnv.h:583
eC_Bool GetLayerBufferSize(const eC_UInt &uiLayerID, eC_UInt &uiWidth, eC_UInt &uiHeight, eC_UByte &ubBPP)
void SetGfxWrap(CGfxWrap *pkGfxWrap)
Definition: GfxEnv.h:500
eC_Bool GetLayerVisibleSize(const eC_UInt &uiLayerID, eC_UInt &uiWidth, eC_UInt &uiHeight)
virtual eC_UInt GetBufferCount() const
void UpdateLayerPositions()
virtual void ** GetFrameBuffers() const
Definition: GfxEnv.h:155
The graphics wrapper base class.
Definition: GfxWrap.h:84
Definition: GUILayerConfig.h:37