Guiliani  Version 2.6 revision 7293 (documentation build 12)
GfxWrapeGML.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 GFXWRAPEGML__H_
11#define GFXWRAPEGML__H_
12
13#include "GfxWrap.h"
14#include "eGML_Config.h"
15#include "eGML_Platform.h"
16#include "eGML_Bitmap.h"
17
18class eGML;
19class eImg_Bitmap;
20class eGML_Screen;
21class eGML_Bitmap;
22class CDCWrap;
23
25
32class CGfxWrapeGML : public CGfxWrap
33{
34public:
41 static eC_Bool CreateInstance(CGfxEnv* pkGfxEnv);
42
43 virtual eC_Value SetLineWidth(const eC_Value& vWidth);
44
45 virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType);
46
49 virtual void CreateScreen();
50
51 virtual void DestroyScreen();
52
54 eGML_Screen* GetScreen(void);
55
57 eGML_Bitmap* GetRenderBitmap();
58
60 void SetRenderBitmap(eGML_Bitmap* pRenderBitmap);
61
63 void SetTargetLayer(const eC_UInt& uiLayerID);
64
65 virtual eC_UInt GetVirtualScreenWidth();
66 virtual eC_UInt GetVirtualScreenHeight();
67 virtual eC_UInt GetPhysicalScreenWidth();
68 virtual eC_UInt GetPhysicalScreenHeight();
69
71 const eC_UByte &ubRed,
72 const eC_UByte &ubGreen,
73 const eC_UByte &ubBlue,
74 const eC_UByte &ubAlpha = 255);
75
76 virtual void Line(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
77
78 virtual void Rect(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
79
80 virtual void FilledRect(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
81
91 virtual void Ellipse(const eC_Value& vAbsX1, const eC_Value& vAbsY1, const eC_Value& vAbsX2, const eC_Value& vAbsY2, const eC_Bool &bFilled);
92
93 virtual void Arc(
94 const eC_Value& vX1,
95 const eC_Value& vY1,
96 const eC_Value& vX2,
97 const eC_Value& vY2,
98 const eC_Value& vStartAngle,
99 const eC_Value& vEndAngle,
100 const eC_Value& vRotationAngle,
101 const eC_Bool &bFilled);
102
103 virtual void Ring(
104 const eC_Value& vX1,
105 const eC_Value& vY1,
106 const eC_Value& vX2,
107 const eC_Value& vY2,
108 const eC_Value& vRingWidth,
109 const eC_Value& vStartAngle,
110 const eC_Value& vEndAngle,
111 const eC_Value& vRotationAngle,
112 const eC_Bool & bFilled);
113
114 virtual void Polygon(
115 eC_Value* pvPoints,
116 const eC_UInt& uiCount,
117 const eC_Bool& bFilled);
118
119 virtual void SetCliprect(const CGUIRect &NewAbsClipRect);
120
124 virtual eImg_Bitmap* GetImage(const ImageResource_t &eID);
125
129 virtual eC_Bool ImageExists(const ImageResource_t eID) const;
130
134 void SetSubpixelEnabled(const eC_Bool bEnabled);
135
140 void SetBlitFlags(eC_Flag uiFlags);
141
146 eC_Flag GetBlitFlags() const;
147
152 virtual void SetOptimizedBlit(const eC_Bool& bOptimizedBlit);
153
158 virtual void SetFilteredBlit(const eC_Bool& bFilteredBlit);
159
160 virtual eC_Bool DrawToScreen();
161
162protected:
169 virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
170
175 virtual void LoadImgImpl(const eC_String &psPath, const ImageResource_t &eID);
176
184 virtual void LoadImgImpl(
185 void* pkMemory,
186 const eC_UInt& uiWidth,
187 const eC_UInt& uiHeight,
188 const eC_UInt& eImageType,
189 const ImageResource_t &eID);
190
194 virtual void UnloadImg(const ImageResource_t &eID);
195
196 virtual void BlitImgExtImpl(
197 const ImageResource_t &eID,
198 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY,
199 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
200 const eC_Value& vDestX, const eC_Value& vDestY,
201 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
202 const eC_UByte &ubAlpha = 255,
203 const eC_Value& vAngle = eC_FromFloat(0),
204 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
205
206 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY);
207
208 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const;
209 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const;
210
215 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const;
216
220
223 virtual void InitMainLayer();
224
229
232 virtual ~CGfxWrapeGML(void);
233
234protected:
237 typedef struct
238 {
239 eC_UInt uiID;
241 eGML_Screen* pkScreen;
243
244 eGML* m_pkEGML;
245 eGML_Bitmap* m_pkRenderBitmap;
247
250
253
255 eC_TArray <eImg_Bitmap*> m_pImage;
256
258
259private:
260 class CModifyableBitmap : public eGML_Bitmap
261 {
262 public:
263 CModifyableBitmap(eC_UInt uiWidth, eC_UInt uiHeight, eC_UByte ubBitmapBufferType) :
264 eGML_Bitmap(uiWidth, uiHeight, ubBitmapBufferType)
265 {
266 }
267
268 ~CModifyableBitmap()
269 {
270 }
271
279 void SetNewBitmapData(eC_UInt eFormat, eC_UInt uiWidth, eC_UInt uiHeight, eC_UByte ubBitmapBufferType, void *pBitmapBuffer)
280 {
281 m_uiType = eFormat;
282 m_uiWidth = uiWidth;
283 m_uiHeight = uiHeight;
284 m_ubBBT = ubBitmapBufferType;
285 m_pkData = pBitmapBuffer;
286
287 // pitch depends on bitmap format
288 switch (eFormat)
289 {
290 case eGML::BM_ALPHA1:
291 m_uiPitch = (uiWidth + 7) & ~0x07;
292 break;
293 case eGML::BM_ALPHA8:
294 m_uiPitch = uiWidth;
295 break;
296 case eGML::BM_RGB565:
297 case eGML::BM_RGB555:
298 m_uiPitch = uiWidth * 2;
299 break;
300 case eGML::BM_RGB32:
301 case eGML::BM_ARGB32:
302 m_uiPitch = uiWidth * 4;
303 break;
304 default:
305 GUILOG(GUI_TRACE_ERROR, "Unknown bitmap format. Failed to determine pitch.\n");
306 break;
307 }
308 }
309
310 virtual void * Lock()
311 {
312 // Dummy implementation of pure-virtual function in base-class
313 return NULL;
314 }
315
316 virtual void Unlock(eC_UInt uiX1 = 0, eC_UInt uiY1 = 0, eC_UInt uiX2 = 0, eC_UInt uiY2 = 0)
317 {
318 // Dummy implementation of pure-virtual function in base-class
319 }
320
321 virtual void DrawLine(const eGML_Vector2 &kStart, const eGML_Vector2 &kEnd, eGML_Color kColor, eC_Flag ulFlags, eC_Value vStartWidth, eC_Value vEndWidth = 0)
322 {
323 // Dummy implementation of pure-virtual function in base-class
324 }
325
326 virtual void DrawPolygon(const eGML_Coord2D *pkVertices, eC_UInt uiCount, eGML_Color kColor, eC_Flag ulFlags)
327 {
328 // Dummy implementation of pure-virtual function in base-class
329 }
330
331 virtual void Clear(eGML_Color clColor)
332 {
333 // Dummy implementation of pure-virtual function in base-class
334 }
335
336 virtual void FillRect(eC_UInt uiWidth, eC_UInt uiHeight, eC_Int iX1, eC_Int iY1, eGML_Color clColor, eC_Flag ulFlags = 0)
337 {
338 // Dummy implementation of pure-virtual function in base-class
339 }
340 };
341
342private:
343 virtual CGUIBitmapPlane* CreateGfxDependentBitmap(
344 GUIBitmapPlaneID_t uiNewBitmapID,
345 const CGUIObject& rkParentObject,
346 const eC_Value& vWidth,
347 const eC_Value& vHeight);
348
349 eC_Bool Init(void);
350 eC_Bool DeInit(void);
351
352 eC_UInt GetBitmapFormat(const CGUICommonEnums::ImageType_t& ePixFormat) const;
353
354 void CreateScreen(
355 const eC_UInt& uiIndex, const eC_UInt& uiLayerID,
356 const eC_Enum& eBitmapFormat,
357 const eC_UInt& uiWidth, const eC_UInt& uiHeight,
358 const eC_UInt& ubBufferCount,
359 void** pkBuffers);
360
361 void MergeLayer(const eC_UInt& uiScreenIndex);
362
365 CGfxWrapeGML(const CGfxWrapeGML& kSource);
366
369 CGfxWrapeGML& operator=(const CGfxWrapeGML& kSource);
370
371private:
372 CModifyableBitmap* m_pkModifyableGlyphBitmap;
373};
374
375#endif
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
The bitmap plane base class.
Definition: GUIBitmapPlane.h:152
ImageType_t
Definition: GUICommonEnums.h:80
Contains information about an image loaded by CGUIImageLoader.
Definition: GUIImageData.h:29
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
The graphics wrapper base class.
Definition: GfxWrap.h:88
RefreshCall_t
Definition: GfxWrap.h:113
This is the eGML implementation of the graphics wrapper.
Definition: GfxWrapeGML.h:33
virtual void DestroyScreen()
Method to clean and release the screen which was created via the CreateScreen Method.
virtual void SetForegroundColorImpl(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)
virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType)
virtual void UnloadImg(const ImageResource_t &eID)
virtual eC_Bool DrawToScreen()
eGML_Bitmap * GetRenderBitmap()
virtual void Rect(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2)
virtual void BlitImgExtImpl(const CGUIImageData &kImageData, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY)
eC_Flag GetBlitFlags() const
ScreenConfig_t * m_pkScreens
Screens for eGML.
Definition: GfxWrapeGML.h:246
virtual ~CGfxWrapeGML(void)
eC_Int m_iMainLayerIndex
index of the main-screen
Definition: GfxWrapeGML.h:249
virtual void Polygon(eC_Value *pvPoints, const eC_UInt &uiCount, const eC_Bool &bFilled)
virtual eC_Bool ImageExists(const ImageResource_t eID) const
virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const
virtual eC_UInt GetPhysicalScreenHeight()
eC_Flag m_uiBlitFlags
Flags for blit operation.
Definition: GfxWrapeGML.h:257
virtual void SetOptimizedBlit(const eC_Bool &bOptimizedBlit)
virtual void SetCliprect(const CGUIRect &NewAbsClipRect)
virtual void Line(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2)
the following methods are protected to prevent calling them directly
static eC_Bool CreateInstance(CGfxEnv *pkGfxEnv)
virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const
virtual eImg_Bitmap * GetImage(const ImageResource_t &eID)
eC_UInt m_uiNumberOfScreens
number of configured screens
Definition: GfxWrapeGML.h:248
eGML_Screen * GetScreen(void)
CGfxWrapeGML(CGfxEnv *pkGfxEnv)
eGML * m_pkEGML
eGML instance pointer
Definition: GfxWrapeGML.h:244
virtual void SetFilteredBlit(const eC_Bool &bFilteredBlit)
virtual eC_UInt GetVirtualScreenWidth()
virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages)
void SetRenderBitmap(eGML_Bitmap *pRenderBitmap)
virtual void Arc(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2, const eC_Value &vStartAngle, const eC_Value &vEndAngle, const eC_Value &vRotationAngle, const eC_Bool &bFilled)
virtual eC_UInt GetPhysicalScreenWidth()
void SetSubpixelEnabled(const eC_Bool bEnabled)
eC_TArray< eImg_Bitmap * > m_pImage
Array of pointers to eImg bitmaps (includes alpha layer)
Definition: GfxWrapeGML.h:255
virtual eC_UInt GetImageSize(const ImageResource_t &eID) const
eC_Bool m_bSubpixelEnabled
while subpixel rendering is enabled, blitting will be done with subpixel-accuracy (Resulting in a tim...
Definition: GfxWrapeGML.h:252
virtual eC_Value SetLineWidth(const eC_Value &vWidth)
void SetDefault2DView()
virtual void CreateScreen()
virtual void FilledRect(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2)
virtual void InitMainLayer()
virtual void Ring(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2, const eC_Value &vRingWidth, const eC_Value &vStartAngle, const eC_Value &vEndAngle, const eC_Value &vRotationAngle, const eC_Bool &bFilled)
virtual void LoadImgImpl(const eC_String &psPath, const ImageResource_t &eID)
eGML_Bitmap * m_pkRenderBitmap
Target bitmap for render operations in eGML.
Definition: GfxWrapeGML.h:245
void SetBlitFlags(eC_Flag uiFlags)
virtual void Ellipse(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2, const eC_Bool &bFilled)
virtual void LoadImgImpl(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t &eID)
virtual void BlitImgExtImpl(const ImageResource_t &eID, const eC_UInt &uiSrcX, const eC_UInt &uiSrcY, const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight, const eC_Value &vDestX, const eC_Value &vDestY, const eC_Value &vDestWidth, const eC_Value &vDestHeight, const eC_UByte &ubAlpha=255, const eC_Value &vAngle=eC_FromFloat(0), const eC_Value &vRotCenterX=eC_FromFloat(0.5), const eC_Value &vRotCenterY=eC_FromFloat(0.5))
void SetTargetLayer(const eC_UInt &uiLayerID)
virtual eC_UInt GetVirtualScreenHeight()
Definition: GfxWrapeGML.h:238
eC_UInt uiID
id of screen
Definition: GfxWrapeGML.h:239
eC_UInt uiScreenCount
number of screens
Definition: GfxWrapeGML.h:240
eGML_Screen * pkScreen
pointer to screens
Definition: GfxWrapeGML.h:241