Guiliani  Version 2.6 revision 7293 (documentation build 12)
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 "GUIImageData.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 Polygon(
105 eC_Value* pvPoints,
106 const eC_UInt& uiCount,
107 const eC_Bool& bFilled);
108
109 virtual void SetCliprect(const CGUIRect &NewClipRect);
110
111 virtual void BlitImgExtImpl(
112 const ImageResource_t &eID,
113 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY, const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
114 const eC_Value& vDestX, const eC_Value& vDestY, const eC_Value& vDestWidth, const eC_Value& vDestHeight,
115 const eC_UByte &ubAlpha = 255,
116 const eC_Value& vAngle = eC_FromFloat(0),
117 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
118
135 const CGUIImageData& kImageData,
136 const eC_UInt &uiSrcX, const eC_UInt &uiSrcY,
137 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
138 const eC_Value& vDestX, const eC_Value& vDestY,
139 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
140 const eC_UByte &ubAlpha = 255,
141 const eC_Value& vAngle = eC_FromFloat(0),
142 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5));
143
144 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY);
145
146 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const;
147 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const;
148 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const {return 0;}
149
150 virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID);
151 virtual eC_Bool DrawToScreen();
152
153 virtual void SetTargetLayer(const eC_UInt& uiLayerID);
154
155 virtual eC_UInt GetVirtualScreenWidth();
156 virtual eC_UInt GetVirtualScreenHeight();
157
158 virtual eC_UInt GetPhysicalScreenWidth();
159 virtual eC_UInt GetPhysicalScreenHeight();
160
161 virtual eC_Bool SupportCompressedFonts() const { return true; }
162
163 virtual void LoadGlyphData(
164 CGUIImageData* pkImageData,
165 const eC_UInt& uiGlyphWidth,
166 const eC_UInt& uiGlyphHeight,
167 eC_UByte* pkGlyphBitmap);
168
169 virtual void UnloadGlyphData(CGUIImageData* pkImageData);
170
174 dhd_handle_t GetDaveDevice();
175
180 static dhd_enum_t GetPixelFormat(const CGUICommonEnums::ImageType_t& ePixFormat);
181
186 static dhd_enum_t GetTexelFormat(const CGUICommonEnums::ImageType_t& ePixFormat);
187
188protected:
192
193 virtual void LoadImgImpl(const eC_String& kPath, const ImageResource_t &eID);
194 virtual void LoadImgImpl(
195 void* pkMemory,
196 const eC_UInt& uiWidth,
197 const eC_UInt& uiHeight,
198 const eC_UInt& eImageType,
199 const ImageResource_t &eID);
200
206 virtual eC_Bool LoadImgRAW(eC_File* pkImageFile, CGUIImageData& kImageData);
207
213 virtual eC_Bool LoadImgRLE(eC_File* pkImageFile, CGUIImageData& kImageData);
214
220 virtual eC_Bool LoadImgDecoder(const eC_String& kPath, const eC_UInt& uiImageIndex);
221
222 virtual void RefreshImage(const ImageResource_t& eImageID, void* pkMemory);
223
224 virtual void UnloadImg(const ImageResource_t &eID);
225
226 virtual eC_Bool ImageExists(const ImageResource_t eID) const;
227
229 GUIBitmapPlaneID_t uiNewBitmapID,
230 const CGUIObject& rkParentObject,
231 const eC_Value& vWidth,
232 const eC_Value& vHeight);
233
237 eC_Bool Init(void);
238
242 eC_Bool DeInit(void);
243
248 eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
249
253 CGfxWrapDAVEHD(CGfxEnv* pkGfxEnv = NULL);
254
256 virtual ~CGfxWrapDAVEHD(void);
257
258 virtual void StartRedrawGUI();
259
260protected:
262 typedef struct
263 {
264 eC_UInt uiID;
267
268private:
271 void UseColorBlit();
272
280 void SetupQuad(
281 eC_Value vXPos, eC_Value vYPos,
282 eC_Value vDestWidth, eC_Value vDestHeight,
283 dhd_prim_data_t* pout);
284
296 dhd_bool_t SetupLine(
297 dhd_int32_t x1, dhd_int32_t y1,
298 dhd_int32_t x2, dhd_int32_t y2,
299 dhd_uint32_t width, dhd_float32_t blur,
300 dhd_prim_data_t* pout, dhd_edge_data_t* eout);
301
313 dhd_bool_t SetupTriangle(
314 dhd_fx28_4_t x1, dhd_fx28_4_t y1,
315 dhd_fx28_4_t x2, dhd_fx28_4_t y2,
316 dhd_fx28_4_t x3, dhd_fx28_4_t y3,
317 dhd_prim_data_t* pout, dhd_edge_data_t* eout);
318
319 void SetupBlitUV(
320 dhd_uv_data_t *uv_out,
321 dhd_uint32_t tw, dhd_uint32_t th,
322 dhd_int32_t srcx, dhd_int32_t srcy,
323 dhd_int32_t srcw, dhd_int32_t srch,
324 dhd_int32_t dstx, dhd_int32_t dsty,
325 dhd_uint32_t dstw, dhd_uint32_t dsth);
326
327 void SetupRotBlitUV(
328 eC_Value centerx, eC_Value centery,
329 eC_UInt srcw, eC_UInt srch,
330 eC_Value dstx, eC_Value dsty,
331 eC_Value dstw, eC_Value dsth,
332 eC_Value vAngle,
333 dhd_prim_data_t* pout,
334 dhd_uv_data_t* uvout);
335
336 void SetupBlitUVRotated(
337 dhd_int32_t centerx, dhd_int32_t centery,
338 dhd_int32_t width, dhd_int32_t height,
339 dhd_float32_t vAngle,
340 dhd_prim_data_t* pout,
341 dhd_uv_data_t* uvout);
342
343 void PolyLine(eC_Value* pvPoints, const eC_UInt& uiPointCount);
344
345private:
347 ScreenConfig_t* m_pkScreens;
348
350 eC_UInt m_uiNumberOfScreens;
351
353 dhd_enum_t m_eScreenFormat;
354
356 dhd_device_t m_kDeviceContext;
357
359 dhd_handle_t m_pkHandle;
360
362 dhd_buffer_t m_pkFramebuffer[2];
363
365 eC_TArray<CGUIImageData*> m_pkImages;
366
367#ifdef DAVEHD_USE_SOFTDAVE
369 sd_handle_t m_pkSDHandle;
370#endif
371};
372#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
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
D/AVE implementation of the graphics wrapper.
Definition: GfxWrapDaveHD.h:57
virtual eC_Bool LoadImgRLE(eC_File *pkImageFile, CGUIImageData &kImageData)
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:161
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_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 void Polygon(eC_Value *pvPoints, const eC_UInt &uiCount, const eC_Bool &bFilled)
virtual eC_UInt GetImageSize(const ImageResource_t &eID) const
Definition: GfxWrapDaveHD.h:148
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_Bool LoadImgRAW(eC_File *pkImageFile, CGUIImageData &kImageData)
virtual eC_UInt GetPhysicalScreenHeight()
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:88
RefreshCall_t
Definition: GfxWrap.h:113
config for screen
Definition: GfxWrapDaveHD.h:263
eC_UInt uiID
id of screen
Definition: GfxWrapDaveHD.h:264
CDAVEHDScreen * pkScreen
pointer to screens
Definition: GfxWrapDaveHD.h:265