Guiliani  Version 2.5 revision 7293 (documentation build 13)
GfxWrapDaveHD.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 GfxWrapDAVEHD__H_
11#define GfxWrapDAVEHD__H_
12
13#include "GfxWrap.h"
14
15#include "GUIImageLoader.h"
16#include "GUIImageDataDAVE.h"
17
18#include "DAVEHDScreen.h"
19
20#include "GUILayerConfig.h"
21
22extern "C"
23{
24// Dave HD driver
25#include "davehd_kernel_driver.h"
26#include "davehd_kernel_bridge.h"
27#include "davehd_driver.h"
28#ifdef DAVEHD_USE_SOFTDAVE
29#include "davehd_sd.h"
30#endif
31#include "davehd_util.h"
32}
33
34// If BSP supports TES own Device driver, then use it
35
36#define DAVEHD_FIX_FROM_EC(x) (dhd_fx28_4_t)(eC_ToInt(eC_Mul(x, eC_FromInt(16))))
37
39
47// @guiliani_doxygen limitations GfxWrapDAVEHD
51// @endguiliani_doxygen
57{
58public:
63 static eC_Bool CreateInstance(CGfxEnv* pkGfxEnv);
64
67 virtual void CreateScreen();
68
69 virtual void DestroyScreen();
70
71 virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType);
72
73 virtual void SetForegroundColorImpl(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha = 255);
74 virtual void Line(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
75 virtual void Rect(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
76 virtual void FilledRect(const eC_Value& vX1, const eC_Value& vY1, const eC_Value& vX2, const eC_Value& vY2);
77
78 virtual void Ellipse(
79 const eC_Value& vX1, const eC_Value& vY1,
80 const eC_Value& vX2, const eC_Value& vY2,
81 const eC_Bool &bFilled = true);
82
83 virtual void Arc(
84 const eC_Value& vX1,
85 const eC_Value& vY1,
86 const eC_Value& vX2,
87 const eC_Value& vY2,
88 const eC_Value& vStartAngle,
89 const eC_Value& vEndAngle,
90 const eC_Value& vRotationAngle,
91 const eC_Bool &bFilled);
92
93 virtual void Ring(
94 const eC_Value& vX1,
95 const eC_Value& vY1,
96 const eC_Value& vX2,
97 const eC_Value& vY2,
98 const eC_Value& vRingWidth,
99 const eC_Value& vStartAngle,
100 const eC_Value& vEndAngle,
101 const eC_Value& vRotationAngle,
102 const eC_Bool & bFilled);
103
104 virtual void SetCliprect(const CGUIRect &NewClipRect);
105
106 virtual void BlitImgExtImpl(
107 const ImageResource_t &eID,
108 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY, const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
109 const eC_Value& vDestX, const eC_Value& vDestY, const eC_Value& vDestWidth, const eC_Value& vDestHeight,
110 const eC_UByte &ubAlpha = 255,
111 const eC_Value& vAngle = eC_FromFloat(0),
112 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
113
130 const CGUIImageData& kImageData,
131 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY,
132 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
133 const eC_Value& vDestX, const eC_Value& vDestY,
134 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
135 const eC_UByte &ubAlpha = 255,
136 const eC_Value& vAngle = eC_FromFloat(0),
137 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
138
139 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY);
140
141 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const;
142 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const;
143 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const {return 0;}
144
145 virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID);
146 virtual eC_Bool DrawToScreen();
147
148 virtual void SetTargetLayer(const eC_UInt& uiLayerID);
149
150 virtual eC_UInt GetVirtualScreenWidth();
151 virtual eC_UInt GetVirtualScreenHeight();
152
153 virtual eC_UInt GetPhysicalScreenWidth();
154 virtual eC_UInt GetPhysicalScreenHeight();
155
156 virtual eC_Bool SupportCompressedFonts() const { return true; }
157
158 virtual void LoadGlyphData(
159 CGUIImageData* pkImageData,
160 const eC_UInt& uiGlyphWidth,
161 const eC_UInt& uiGlyphHeight,
162 eC_UByte* pkGlyphBitmap);
163
164 virtual void UnloadGlyphData(CGUIImageData* pkImageData);
165
169 dhd_handle_t GetDaveDevice();
170
175 static dhd_enum_t GetPixelFormat(const CGUICommonEnums::ImageType_t& ePixFormat);
176
181 static dhd_enum_t GetTexelFormat(const CGUICommonEnums::ImageType_t& ePixFormat);
182
183protected:
187
188 virtual void LoadImgImpl(const eC_String& kPath, const ImageResource_t &eID);
189 virtual void LoadImgImpl(
190 void* pkMemory,
191 const eC_UInt& uiWidth,
192 const eC_UInt& uiHeight,
193 const eC_UInt& eImageType,
194 const ImageResource_t &eID);
195
201 virtual eC_Bool LoadImgRAW(eC_File* pkImageFile, CGUIImageDataDAVE& kImageData);
202
208 virtual eC_Bool LoadImgRLE(eC_File* pkImageFile, CGUIImageDataDAVE& kImageData);
209
215 virtual eC_Bool LoadImgDecoder(const eC_String& kPath, const eC_UInt& uiImageIndex);
216
217 virtual void RefreshImage(const ImageResource_t& eImageID, void* pkMemory);
218
219 virtual void UnloadImg(const ImageResource_t &eID);
220
221 virtual eC_Bool ImageExists(const ImageResource_t eID) const;
222
224 GUIBitmapPlaneID_t uiNewBitmapID,
225 const CGUIObject& rkParentObject,
226 const eC_Value& vWidth,
227 const eC_Value& vHeight);
228
232 eC_Bool Init(void);
233
237 eC_Bool DeInit(void);
238
243 eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
244
248 CGfxWrapDAVEHD(CGfxEnv* pkGfxEnv = NULL);
249
251 virtual ~CGfxWrapDAVEHD(void);
252
253 virtual void StartRedrawGUI();
254
255protected:
257 typedef struct
258 {
259 eC_UInt uiID;
262
263private:
266 void UseColorBlit();
267
275 void SetupQuad(
276 eC_Value vXPos, eC_Value vYPos,
277 eC_Value vDestWidth, eC_Value vDestHeight,
278 dhd_prim_data_t* pout);
279
291 dhd_bool_t SetupLine(
292 dhd_int32_t x1, dhd_int32_t y1,
293 dhd_int32_t x2, dhd_int32_t y2,
294 dhd_uint32_t width, dhd_float32_t blur,
295 dhd_prim_data_t* pout, dhd_edge_data_t* eout);
296
308 dhd_bool_t SetupTriangle(
309 dhd_fx28_4_t x1, dhd_fx28_4_t y1,
310 dhd_fx28_4_t x2, dhd_fx28_4_t y2,
311 dhd_fx28_4_t x3, dhd_fx28_4_t y3,
312 dhd_prim_data_t* pout, dhd_edge_data_t* eout);
313
314 void SetupBlitUV(
315 dhd_uv_data_t *uv_out,
316 dhd_uint32_t tw, dhd_uint32_t th,
317 dhd_int32_t srcx, dhd_int32_t srcy,
318 dhd_int32_t srcw, dhd_int32_t srch,
319 dhd_int32_t dstx, dhd_int32_t dsty,
320 dhd_uint32_t dstw, dhd_uint32_t dsth);
321
322 void SetupRotBlitUV(
323 eC_Value centerx, eC_Value centery,
324 eC_UInt srcw, eC_UInt srch,
325 eC_Value dstx, eC_Value dsty,
326 eC_Value dstw, eC_Value dsth,
327 eC_Value vAngle,
328 dhd_prim_data_t* pout,
329 dhd_uv_data_t* uvout);
330
331 void SetupBlitUVRotated(
332 dhd_int32_t centerx, dhd_int32_t centery,
333 dhd_int32_t width, dhd_int32_t height,
334 dhd_float32_t vAngle,
335 dhd_prim_data_t* pout,
336 dhd_uv_data_t* uvout);
337
338 void PolyLine(eC_Value* pvPoints, const eC_UInt& uiPointCount);
339
340private:
342 ScreenConfig_t* m_pkScreens;
343
345 eC_UInt m_uiNumberOfScreens;
346
348 dhd_enum_t m_eScreenFormat;
349
351 dhd_device_t m_kDeviceContext;
352
354 dhd_handle_t m_pkHandle;
355
357 dhd_buffer_t m_pkFramebuffer[2];
358
360 eC_TArray<CGUIImageDataDAVE*> m_pkImages;
361
362#ifdef DAVEHD_USE_SOFTDAVE
364 sd_handle_t m_pkSDHandle;
365#endif
366};
367#endif
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
Definition: DAVEHDScreen.h:28
The bitmap plane base class.
Definition: GUIBitmapPlane.h:152
ImageType_t
Definition: GUICommonEnums.h:80
Definition: GUIImageDataDAVE.h:21
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
D/AVE implementation of the graphics wrapper.
Definition: GfxWrapDaveHD.h:57
virtual void FilledRect(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2)
virtual eC_Bool SupportCompressedFonts() const
Definition: GfxWrapDaveHD.h:156
virtual void CreateScreen()
virtual void LoadImgImpl(const eC_String &kPath, const ImageResource_t &eID)
eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages)
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))
virtual void SetCliprect(const CGUIRect &NewClipRect)
static eC_Bool CreateInstance(CGfxEnv *pkGfxEnv)
virtual eC_UInt GetVirtualScreenHeight()
virtual void StartRedrawGUI()
virtual void DestroyScreen()
Method to clean and release the screen which was created via the CreateScreen Method.
virtual void RefreshImage(const ImageResource_t &eImageID, void *pkMemory)
dhd_handle_t GetDaveDevice()
virtual void Ellipse(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2, const eC_Bool &bFilled=true)
virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const
static dhd_enum_t GetTexelFormat(const CGUICommonEnums::ImageType_t &ePixFormat)
virtual eC_UInt GetPhysicalScreenWidth()
virtual ~CGfxWrapDAVEHD(void)
Destructor.
eC_Bool DeInit(void)
virtual CGUIBitmapPlane * CreateGfxDependentBitmap(GUIBitmapPlaneID_t uiNewBitmapID, const CGUIObject &rkParentObject, const eC_Value &vWidth, const eC_Value &vHeight)
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 eC_Bool LoadImgRAW(eC_File *pkImageFile, CGUIImageDataDAVE &kImageData)
virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const
eC_Bool Init(void)
virtual eC_Bool LoadImgDecoder(const eC_String &kPath, const eC_UInt &uiImageIndex)
virtual void LoadImgImpl(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t &eID)
virtual eC_UInt GetImageSize(const ImageResource_t &eID) const
Definition: GfxWrapDaveHD.h:143
virtual void SetTargetLayer(const eC_UInt &uiLayerID)
virtual void LoadGlyphData(CGUIImageData *pkImageData, const eC_UInt &uiGlyphWidth, const eC_UInt &uiGlyphHeight, eC_UByte *pkGlyphBitmap)
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 GetVirtualScreenWidth()
void BlitImgExtImpl(const CGUIImageData &kImageData, 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))
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
virtual eC_Bool ImageExists(const ImageResource_t eID) const
static dhd_enum_t GetPixelFormat(const CGUICommonEnums::ImageType_t &ePixFormat)
virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID)
virtual eC_Bool DrawToScreen()
virtual eC_UInt GetPhysicalScreenHeight()
virtual eC_Bool LoadImgRLE(eC_File *pkImageFile, CGUIImageDataDAVE &kImageData)
virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType)
CGfxWrapDAVEHD(CGfxEnv *pkGfxEnv=NULL)
virtual void UnloadImg(const ImageResource_t &eID)
void InitScreens()
virtual void Rect(const eC_Value &vX1, const eC_Value &vY1, const eC_Value &vX2, const eC_Value &vY2)
virtual void UnloadGlyphData(CGUIImageData *pkImageData)
virtual void BlitImgExtImpl(const CGUIImageData &kImageData, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY)
virtual void SetForegroundColorImpl(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)
The graphics wrapper base class.
Definition: GfxWrap.h:84
RefreshCall_t
Definition: GfxWrap.h:109
config for screen
Definition: GfxWrapDaveHD.h:258
eC_UInt uiID
id of screen
Definition: GfxWrapDaveHD.h:259
CDAVEHDScreen * pkScreen
pointer to screens
Definition: GfxWrapDaveHD.h:260