Guiliani  Version 2.5 revision 7293 (documentation build 13)
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 SetCliprect(const CGUIRect &NewAbsClipRect);
115
119 virtual eImg_Bitmap* GetImage(const ImageResource_t &eID);
120
124 virtual eC_Bool ImageExists(const ImageResource_t eID) const;
125
129 void SetSubpixelEnabled(const eC_Bool bEnabled);
130
135 void SetBlitFlags(eC_Flag uiFlags);
136
141 eC_Flag GetBlitFlags() const;
142
147 virtual void SetOptimizedBlit(const eC_Bool& bOptimizedBlit);
148
153 virtual void SetFilteredBlit(const eC_Bool& bFilteredBlit);
154
155 virtual eC_Bool DrawToScreen();
156
157protected:
164 virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
165
170 virtual void LoadImgImpl(const eC_String &psPath, const ImageResource_t &eID);
171
179 virtual void LoadImgImpl(
180 void* pkMemory,
181 const eC_UInt& uiWidth,
182 const eC_UInt& uiHeight,
183 const eC_UInt& eImageType,
184 const ImageResource_t &eID);
185
189 virtual void UnloadImg(const ImageResource_t &eID);
190
191 virtual void BlitImgExtImpl(
192 const ImageResource_t &eID,
193 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY,
194 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
195 const eC_Value& vDestX, const eC_Value& vDestY,
196 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
197 const eC_UByte &ubAlpha = 255,
198 const eC_Value& vAngle = eC_FromFloat(0),
199 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
200
201 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY);
202
218 virtual void BlitMemoryImpl(
219 void* pkMemory,
220 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY, const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
221 const eC_Value& vAbsDestX, const eC_Value& vAbsDestY, const eC_Value& vDestWidth, const eC_Value& vDestHeight,
222 const eC_UByte &ubAlpha = 255,
223 const eC_Value& vAngle = eC_FromFloat(0),
224 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
225
226 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const;
227 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const;
228
233 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const;
234
238
241 virtual void InitMainLayer();
242
247
250 virtual ~CGfxWrapeGML(void);
251
252protected:
255 typedef struct
256 {
257 eC_UInt uiID;
259 eGML_Screen* pkScreen;
261
262 eGML* m_pkEGML;
263 eGML_Bitmap* m_pkRenderBitmap;
265
268
271
273 eC_TArray <eImg_Bitmap*> m_pImage;
274
276
277private:
278 class CModifyableBitmap : public eGML_Bitmap
279 {
280 public:
281 CModifyableBitmap(eC_UInt uiWidth, eC_UInt uiHeight, eC_UByte ubBitmapBufferType) :
282 eGML_Bitmap(uiWidth, uiHeight, ubBitmapBufferType)
283 {
284 }
285
286 ~CModifyableBitmap()
287 {
288 }
289
297 void SetNewBitmapData(eC_UInt eFormat, eC_UInt uiWidth, eC_UInt uiHeight, eC_UByte ubBitmapBufferType, void *pBitmapBuffer)
298 {
299 m_uiType = eFormat;
300 m_uiWidth = uiWidth;
301 m_uiHeight = uiHeight;
302 m_ubBBT = ubBitmapBufferType;
303 m_pkData = pBitmapBuffer;
304
305 // pitch depends on bitmap format
306 switch (eFormat)
307 {
308 case eGML::BM_ALPHA1:
309 m_uiPitch = (uiWidth + 7) & ~0x07;
310 break;
311 case eGML::BM_ALPHA8:
312 m_uiPitch = uiWidth;
313 break;
314 case eGML::BM_RGB565:
315 case eGML::BM_RGB555:
316 m_uiPitch = uiWidth * 2;
317 break;
318 case eGML::BM_RGB32:
319 case eGML::BM_ARGB32:
320 m_uiPitch = uiWidth * 4;
321 break;
322 default:
323 GUILOG(GUI_TRACE_ERROR, "Unknown bitmap format. Failed to determine pitch.\n");
324 break;
325 }
326 }
327
328 virtual void * Lock()
329 {
330 // Dummy implementation of pure-virtual function in base-class
331 return NULL;
332 }
333
334 virtual void Unlock(eC_UInt uiX1 = 0, eC_UInt uiY1 = 0, eC_UInt uiX2 = 0, eC_UInt uiY2 = 0)
335 {
336 // Dummy implementation of pure-virtual function in base-class
337 }
338
339 virtual void DrawLine(const eGML_Vector2 &kStart, const eGML_Vector2 &kEnd, eGML_Color kColor, eC_Flag ulFlags, eC_Value vStartWidth, eC_Value vEndWidth = 0)
340 {
341 // Dummy implementation of pure-virtual function in base-class
342 }
343
344 virtual void DrawPolygon(const eGML_Coord2D *pkVertices, eC_UInt uiCount, eGML_Color kColor, eC_Flag ulFlags)
345 {
346 // Dummy implementation of pure-virtual function in base-class
347 }
348
349 virtual void Clear(eGML_Color clColor)
350 {
351 // Dummy implementation of pure-virtual function in base-class
352 }
353
354 virtual void FillRect(eC_UInt uiWidth, eC_UInt uiHeight, eC_Int iX1, eC_Int iY1, eGML_Color clColor, eC_Flag ulFlags = 0)
355 {
356 // Dummy implementation of pure-virtual function in base-class
357 }
358 };
359
360private:
361 virtual CGUIBitmapPlane* CreateGfxDependentBitmap(
362 GUIBitmapPlaneID_t uiNewBitmapID,
363 const CGUIObject& rkParentObject,
364 const eC_Value& vWidth,
365 const eC_Value& vHeight);
366
367 eC_Bool Init(void);
368 eC_Bool DeInit(void);
369
370 eC_UInt GetBitmapFormat(const CGUICommonEnums::ImageType_t& ePixFormat) const;
371
372 void CreateScreen(
373 const eC_UInt& uiIndex, const eC_UInt& uiLayerID,
374 const eC_Enum& eBitmapFormat,
375 const eC_UInt& uiWidth, const eC_UInt& uiHeight,
376 const eC_UInt& ubBufferCount,
377 void** pkBuffers);
378
379 void MergeLayer(const eC_UInt& uiScreenIndex);
380
383 CGfxWrapeGML(const CGfxWrapeGML& kSource);
384
387 CGfxWrapeGML& operator=(const CGfxWrapeGML& kSource);
388
389private:
390 CModifyableBitmap* m_pkModifyableGlyphBitmap;
391};
392
393#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:79
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:84
RefreshCall_t
Definition: GfxWrap.h:109
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:264
virtual ~CGfxWrapeGML(void)
eC_Int m_iMainLayerIndex
index of the main-screen
Definition: GfxWrapeGML.h:267
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:275
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:266
eGML_Screen * GetScreen(void)
CGfxWrapeGML(CGfxEnv *pkGfxEnv)
eGML * m_pkEGML
eGML instance pointer
Definition: GfxWrapeGML.h:262
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:273
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:270
virtual eC_Value SetLineWidth(const eC_Value &vWidth)
virtual void BlitMemoryImpl(void *pkMemory, const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY, const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY, 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 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:263
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:256
eC_UInt uiID
id of screen
Definition: GfxWrapeGML.h:257
eC_UInt uiScreenCount
number of screens
Definition: GfxWrapeGML.h:258
eGML_Screen * pkScreen
pointer to screens
Definition: GfxWrapeGML.h:259