Guiliani  Version 2.6 revision 7293 (documentation build 12)
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 SM_VULKAN,
64 };
65
66public:
77 static eC_Bool CreateInstance(
78 const SurfaceMode_t& eSurfaceMode,
79 const CGUICommonEnums::ImageType_t& eScreenFormat,
80 const eC_UInt& uiWidth,
81 const eC_UInt& uiHeight,
82 const eC_UInt& uiBufferCount = 1,
83 void** ppkBuffers = NULL,
84 const eC_Bool& bResizable = false);
85
87 static void DeleteInstance();
88
93 virtual void SetScreenPosition(const eC_UInt& uiX, const eC_UInt& uiY);
94
100 virtual void SetScreenSize(const eC_UInt& uiWidth, const eC_UInt& uiHeight);
101
105 virtual void SetVSyncEnabled(const eC_Bool& bVSyncEnabled);
106
110 virtual eC_Bool IsCreated() const;
111
116
121
125 virtual eC_UInt GetXPos() const;
126
130 virtual eC_UInt GetYPos() const;
131
135 virtual eC_UInt GetWidth() const;
136
140 virtual eC_UInt GetHeight() const;
141
145 virtual eC_UByte GetBPP() const;
146
150 virtual eC_Bool IsResizable() const;
151
155 virtual eC_Bool NeedsManualMerge() const;
156
160 virtual eC_Bool SupportsCopy() const;
161
165 virtual eC_UInt GetBufferCount() const;
166
170 virtual eC_String GetName() const;
171
175 virtual void** GetFrameBuffers() const { return m_ppkBuffers; }
176
180 virtual eC_Bool IsVSyncEnabled() const { return m_bVSyncEnabled; }
181
187 virtual eC_Bool RefreshScreen(const CGUIRect& rkInvalidatedArea) { return false; }
188
193 virtual eC_Bool RefreshScreen(const eC_TListDoubleLinked<CGUIRect>& kInvalidatedRectList);
194
198 virtual void SetCliprect(const CGUIRect& rkNewClipRect) {}
199
203 virtual void SetWindowCaption(const eC_String& kCaption) {}
204
208 virtual eC_Bool SwapBuffers() { return false; }
209
214 virtual eC_UInt InitDisplay() { return 1; }
215
219 virtual void DeInitDisplay() {}
220
229 eC_Bool GetLayerIndexForID(const eC_UInt& uiLayerID, eC_UInt& ruiLayerIndex) const;
230
238 eC_Bool SetActiveLayerID(const eC_UInt& uiLayerID, const eC_Bool& bMarkAsModified = false);
239
244 eC_UInt GetActiveLayerID() const;
245
251 eC_Bool IsLayerModified(const eC_UInt& uiLayerID) const;
252
262 virtual eC_Bool UpdateLayerBuffers(const eC_UInt& uiLayerID, void* pkRenderBuffer, void* pkDisplayBuffer, const eC_UInt& uiWidth, const eC_UInt& uiHeight);
263
268 void AddMainLayer(const eC_UInt& uiLayerID = 0, const eC_Bool& bCached = false);
269
274 void SetMainLayerProperties(const eC_UInt& uiLayerID, const eC_Bool& bCached);
275
281 eC_Bool AddLayer(const LayerConfiguration_t& kLayerConfig);
282
287
292 eC_UInt GetNumberOfLayers() const;
293
300 eC_Bool GetLayerConfig(const eC_UInt& uiLayerIndex, LayerConfiguration_t& rkLayerConfig) const;
301
308 eC_Bool GetLayerConfigForID(const eC_UInt& uiLayerID, LayerConfiguration_t& rkLayerConfig) const;
309
316
323 eC_Bool SetLayerVisible(const eC_UInt& uiLayerID, const eC_Bool& bVisible);
324
330 eC_Bool IsLayerVisible(const eC_UInt& uiLayerID) const;
331
339 eC_Bool SetLayerPosition(const eC_UInt& uiLayerID, const eC_Int& iXPos, const eC_Int& iYPos);
340
348 eC_Bool GetLayerPosition(const eC_UInt& uiLayerID, eC_Int& iXPos, eC_Int& iYPos);
349
357 eC_Bool SetLayerVisibleSize(const eC_UInt& uiLayerID, const eC_UInt& uiWidth, const eC_UInt& uiHeight);
358
366 eC_Bool GetLayerVisibleSize(const eC_UInt& uiLayerID, eC_UInt& uiWidth, eC_UInt& uiHeight);
367
375 eC_Bool SetLayerVisiblePos(const eC_UInt& uiLayerID, const eC_Int& iXPos, const eC_Int& iYPos);
376
383 eC_Bool SetLayerAlpha(const eC_UInt& uiLayerID, const eC_UByte& ubAlpha);
384
390 eC_UByte GetLayerAlpha(const eC_UInt& uiLayerID) const;
391
400 eC_Bool SetLayerChromaKey(const eC_UInt& uiLayerID, const eC_Bool& bChromaKeyActive, const eC_UInt& uiChromaKey, const eC_UByte& ubAlpha);
401
410 eC_Bool GetLayerChromaKey(const eC_UInt& uiLayerID, eC_Bool& bChromaKeyActive, eC_UInt& uiChromaKey, eC_UByte& ubAlpha) const;
411
420 eC_Bool GetLayerBufferSize(const eC_UInt& uiLayerID, eC_UInt& uiWidth, eC_UInt& uiHeight, eC_UByte& ubBPP);
421
428 virtual void UpdateLayer(const LayerConfiguration_t& kLayerConfig, const LayerUpdate_t& eUpdateReason) {}
429
435 void* GetRenderBuffer(const eC_UInt& uiLayerID) const;
436
442 void* GetDisplayBuffer(const eC_UInt& uiLayerID) const;
443
448 void InvalidateLayer(const eC_UInt& uiLayerID);
449
454
460 void SetObjectForLayerID(const eC_UInt& uiLayerID, CGUIObject* pkObject);
461
467 void SetGlobalAlpha(const eC_UByte& ubGlobalAlpha);
468
473 eC_UByte GetGlobalAlpha() const;
474
480 eC_UByte ApplyGlobalAlpha(const eC_UByte& ubAlpha) const;
481
485 virtual void StartOfRefresh() {}
486
491 virtual void EndOfRefresh() {}
492
497 void SetMainLayerID(const eC_UInt& uiLayerID);
498
503 eC_UInt GetMainLayerID() const;
504
510 eC_Bool IsMainLayer(const eC_UInt& uiLayerID) const;
511
515 virtual eC_Bool IsNull() { return false; }
516
520 void SetGfxWrap(CGfxWrap* pkGfxWrap) { m_pkGfxWrap = pkGfxWrap; }
521
526 eC_UByte GetBytesPerPixel(const CGUICommonEnums::ImageType_t& ePixFormat) const;
527
531 virtual void SetDevice(void* pkDevice) {}
532
536 virtual void* GetMergeBuffer() const { return NULL; }
537
541 virtual void* GetDisplayHandle() const { return NULL; }
542
546 virtual void* GetWindowHandle() const { return NULL; }
547
548protected:
559 const SurfaceMode_t& eSurfaceMode,
560 const CGUICommonEnums::ImageType_t& eScreenFormat,
561 const eC_UInt& uiWidth,
562 const eC_UInt& uiHeight,
563 const eC_UInt& uiBufferCount = 1,
564 void** ppkBuffers = NULL,
565 const eC_Bool& bResizable = false);
566
569 virtual ~CGfxEnv();
570
574 eC_UByte GetBPPFromScreenFormat() const;
575
583 virtual void InitLayer(const LayerConfiguration_t& kLayerConfig) {}
584
594 const CGUICommonEnums::ImageType_t& eColorFormat,
595 const eC_UInt& uiWidth, const eC_UInt& uiHeight,
596 const eC_UInt& uiBufferCount,
597 void** ppkBuffers);
598
599protected:
602 eC_UInt m_uiWidth;
603 eC_UInt m_uiHeight;
604 eC_UByte m_ubBPP;
607 eC_Bool m_bResizable;
610 eC_String m_kName;
611
612protected:
613 eC_TArray<LayerConfiguration_t> m_akLayers;
616
618
622};
623#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:81
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:180
void ** m_ppkBuffers
buffers for the main-screen
Definition: GfxEnv.h:606
virtual SurfaceMode_t GetSurfaceMode() const
virtual eC_Bool SwapBuffers()
Definition: GfxEnv.h:208
eC_Bool m_bVSyncEnabled
if vsync is enabled
Definition: GfxEnv.h:621
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:600
eC_Bool GetLayerConfigForMainLayer(LayerConfiguration_t &rkLayerConfig) const
void SetMainLayerID(const eC_UInt &uiLayerID)
virtual void DeInitDisplay()
Definition: GfxEnv.h:219
void SetObjectForLayerID(const eC_UInt &uiLayerID, CGUIObject *pkObject)
eC_UByte m_ubGlobalAlpha
global alpha for blending
Definition: GfxEnv.h:620
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:604
eC_Int m_iMainLayerID
id of main-layer
Definition: GfxEnv.h:619
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:428
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:531
void * GetRenderBuffer(const eC_UInt &uiLayerID) const
virtual void * GetWindowHandle() const
Definition: GfxEnv.h:546
virtual eC_Bool RefreshScreen(const eC_TListDoubleLinked< CGUIRect > &kInvalidatedRectList)
virtual void StartOfRefresh()
Definition: GfxEnv.h:485
virtual void SetScreenPosition(const eC_UInt &uiX, const eC_UInt &uiY)
virtual void SetScreenSize(const eC_UInt &uiWidth, const eC_UInt &uiHeight)
eC_Bool m_bNeedsManualMerge
if supports merge
Definition: GfxEnv.h:608
virtual eC_UInt GetYPos() const
virtual void SetCliprect(const CGUIRect &rkNewClipRect)
Definition: GfxEnv.h:198
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:607
virtual void EndOfRefresh()
Definition: GfxEnv.h:491
virtual eC_UInt InitDisplay()
Definition: GfxEnv.h:214
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:515
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:536
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:609
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:613
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:605
virtual CGUICommonEnums::ImageType_t GetColorFormat() const
virtual eC_Bool RefreshScreen(const CGUIRect &rkInvalidatedArea)
Definition: GfxEnv.h:187
eC_UInt m_uiActiveLayerIndex
index of currentl< active layer
Definition: GfxEnv.h:615
virtual void * GetDisplayHandle() const
Definition: GfxEnv.h:541
CGfxWrap * m_pkGfxWrap
pointer to GfxWrapper
Definition: GfxEnv.h:617
virtual eC_UInt GetXPos() const
CGUICommonEnums::ImageType_t m_eColorFormat
color-format
Definition: GfxEnv.h:601
eC_Bool IsMainLayer(const eC_UInt &uiLayerID) const
eC_String m_kName
name
Definition: GfxEnv.h:610
virtual eC_String GetName() const
virtual void InitLayer(const LayerConfiguration_t &kLayerConfig)
Definition: GfxEnv.h:583
eC_UInt m_uiWidth
width of the surface
Definition: GfxEnv.h:602
eC_Bool IsLayerModified(const eC_UInt &uiLayerID) const
eC_UInt m_uiHeight
height of the surface
Definition: GfxEnv.h:603
eC_Bool IsLayerVisible(const eC_UInt &uiLayerID) const
virtual void SetWindowCaption(const eC_String &kCaption)
Definition: GfxEnv.h:203
virtual eC_UByte GetBPP() const
eC_UInt m_uiActiveLayerID
: unsigned int = Active Layer
Definition: GfxEnv.h:614
eC_Bool GetLayerBufferSize(const eC_UInt &uiLayerID, eC_UInt &uiWidth, eC_UInt &uiHeight, eC_UByte &ubBPP)
void SetGfxWrap(CGfxWrap *pkGfxWrap)
Definition: GfxEnv.h:520
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:175
The graphics wrapper base class.
Definition: GfxWrap.h:88
Definition: GUILayerConfig.h:37