Guiliani  Version 2.5 revision 7293 (documentation build 13)
GfxWrapVG.h
1#ifndef GFXWRAPVG_H
2#define GFXWRAPVG_H
3
4#include "openvg.h"
5#include "vgu.h"//utility-lib
6
7#include <EGL/egl.h>
8#include <vector>
9#include "SVGShape.h"
10
11#include "GfxWrap.h"
12#include "GUIImageData.h"
13#include "GUIImageLoader.h"
14
20#ifdef GUILIANI_EGL13_COMPATIBILITY_WORKAROUND
21#undef EGL_DEFAULT_DISPLAY
22#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
23typedef EGLNativeWindowType NativeWindowType;
24typedef EGLNativeDisplayType NativeDisplayType;
25#endif
30{
31public:
39 inline void SetImgHandle(const VGImage uiImgHandle) {m_uiImageHandle = uiImgHandle;}
43 inline VGImage GetImgHandle() const {return m_uiImageHandle;}
44
46 std::vector<VGPath> m_auiSvgPathHandles;
47 std::vector<VGPaint> m_auiSvgFillPaintHandles;
48 std::vector<VGPaint> m_auiSvgStrokePaintHandles;
49
50private:
54 CGUIImageDataVG(const CGUIImageDataVG& kSource);
55
59 CGUIImageData& operator=(const CGUIImageDataVG& kSource);
60
61 VGImage m_uiImageHandle;
62};
63
67class CGfxWrapVG : public CGfxWrap
68{
69 public:
70
77 static eC_Bool CreateInstance(const NativeWindowType& hWindowType = 0,
78 const NativeDisplayType& hDisplayType = EGL_DEFAULT_DISPLAY);
79
84 virtual void CreateScreen(const eC_UInt &uiWidth, const eC_UInt &uiHeight);
85
87 virtual void CreateScreen();
88
89 virtual void SetCliprect(const CGUIRect& rkNewClipRect);
90
91protected:
92 CGfxWrapVG();
97 CGfxWrapVG(const NativeWindowType& hWindowType,
98 const NativeDisplayType& hDisplayType);
99
101 virtual ~CGfxWrapVG();
102
103 virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType);
104
105 virtual eC_UInt GetVirtualScreenWidth();
106 virtual eC_UInt GetVirtualScreenHeight();
107
108 virtual eC_UInt GetPhysicalScreenWidth() {return m_uiScreenWidth;}
109 virtual eC_UInt GetPhysicalScreenHeight() {return m_uiScreenHeight;}
110
111 virtual void Line(
112 const eC_Value &vAbsX1, const eC_Value &vAbsY1,
113 const eC_Value &vAbsX2, const eC_Value &vAbsY2);
114
115 virtual void Rect(
116 const eC_Value &vAbsX1, const eC_Value &vAbsY1,
117 const eC_Value &vAbsX2, const eC_Value &vAbsY2);
118
119 virtual void FilledRect(
120 const eC_Value &vAbsX1, const eC_Value &vAbsY1,
121 const eC_Value &vAbsX2, const eC_Value &vAbsY2);
122
123 virtual void Ellipse(
124 const eC_Value &vAbsX1, const eC_Value &vAbsY1,
125 const eC_Value &vAbsX2, const eC_Value &vAbsY2,
126 const eC_Bool &bFilled);
127
128 virtual void Arc(
129 const eC_Value &vX1, const eC_Value &vY1,
130 const eC_Value &vX2, const eC_Value &vY2,
131 const eC_Value& vStartAngle, const eC_Value& vEndAngle,
132 const eC_Value& vRotationAngle,
133 const eC_Bool &bFilled);
134
135 virtual void Ring(
136 const eC_Value& vX1,
137 const eC_Value& vY1,
138 const eC_Value& vX2,
139 const eC_Value& vY2,
140 const eC_Value& vRingWidth,
141 const eC_Value& vStartAngle,
142 const eC_Value& vEndAngle,
143 const eC_Value& vRotationAngle,
144 const eC_Bool & bFilled);
145
146 virtual eC_Value SetLineWidth(const eC_Value& vWidth);
147
148 virtual eC_Bool ImageExists(ImageResource_t eID) const;
149 virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
150 virtual void LoadImgImpl(const eC_String& kPath, const ImageResource_t& eImageID);
151
159 virtual void LoadImgImpl(
160 void* pkMemory,
161 const eC_UInt& uiWidth,
162 const eC_UInt& uiHeight,
163 const CGUICommonEnums::ImageType_t& eImageType,
164 const ImageResource_t &eID);
165
166 virtual void UnloadImg(const ImageResource_t &eImageID);
167 virtual eC_UInt GetImageSize(const ImageResource_t& eImageID) const;
168 virtual eC_UInt GetImgWidthImpl(const ImageResource_t& eImageID) const;
169 virtual eC_UInt GetImgHeightImpl(const ImageResource_t& eImageID) const;
170
171 virtual void BlitImgExtImpl(const ImageResource_t&,
172 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY,
173 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
174 const eC_Value &vAbsDestX, const eC_Value &vAbsDestY,
175 const eC_Value &vDestWidth, const eC_Value &vDestHeight,
176 const eC_UByte &ubAlpha = 255,
177 const eC_Value &vAngle = eC_FromFloat(0),
178 const eC_Value &vRotCenterX = eC_FromFloat(0.5), const eC_Value &vRotCenterY = eC_FromFloat(0.5));
179
181 const eC_UByte &ubRed,
182 const eC_UByte &ubGreen,
183 const eC_UByte &ubBlue,
184 const eC_UByte &ubAlpha = 255);
185
190 eC_Bool CheckVGError(const eC_String &kCallingMethod);
191
196 eC_Bool CheckEGLError(const eC_String &kCallingMethod);
197
201 void CreateSVGImage(const eC_UInt& uiCurImage);
202
206 void CreateBitmapImage(const eC_UInt& uiCurImage);
207
211 void RenderSVG(const eC_UInt& uiCurImage);
212
217 void GetPathFromShape(const CSVGShape& kShape, VGPath& uiPathHandle);
218
224 void GetPaintFromShape(CSVGShape& kShape, VGPaint& uiPaintHandle, eC_Bool bIsStroke);
225
231 void ConstructGradient(CGradient& kGradient, VGPaint& uiPaintHandle);
232
240 virtual eC_Bool Init(void);
241
246 virtual eC_Bool DeInit(void);
247
249 NativeDisplayType m_hDisplayType;
250
252 NativeWindowType m_hWindowType;
253
255 EGLDisplay m_display;
256 EGLSurface m_windowSurface;
257
258 EGLConfig m_screenConfig;
259 EGLContext m_screenContext;
260
264
265 eC_TArray<CGUIImageDataVG*> m_pkImages;
266
267private:
268 eC_Value m_vRed;
269 eC_Value m_vGreen;
270 eC_Value m_vBlue;
271 eC_Value m_vAlpha;
272
273 VGPaint m_strokePaint;
274 VGPaint m_fillPaint;
275
276 VGPath m_uiPrimStrokeHandle;
277 VGPath m_uiPrimFillHandle;
278};
279
280#endif // GFXWRAPVG_H
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
ImageType_t
Definition: GUICommonEnums.h:80
Contains information about an image loaded by CGUIImageLoader.
Definition: GUIImageData.h:29
Definition: GfxWrapVG.h:30
std::vector< VGPaint > m_auiSvgFillPaintHandles
handles for filling paint-operations
Definition: GfxWrapVG.h:47
void SetImgHandle(const VGImage uiImgHandle)
Definition: GfxWrapVG.h:39
VGImage GetImgHandle() const
Definition: GfxWrapVG.h:43
std::vector< VGPaint > m_auiSvgStrokePaintHandles
handles for stroking paint-operations
Definition: GfxWrapVG.h:48
std::vector< VGPath > m_auiSvgPathHandles
VGHandles for drawing SVG-images.
Definition: GfxWrapVG.h:46
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
The graphics wrapper base class.
Definition: GfxWrap.h:84
eC_UInt m_uiScreenWidth
Screen width.
Definition: GfxWrap.h:1373
eC_UInt m_uiScreenHeight
Screen height.
Definition: GfxWrap.h:1376
RefreshCall_t
Definition: GfxWrap.h:109
Definition: GfxWrapVG.h:68
virtual eC_UInt GetPhysicalScreenHeight()
Definition: GfxWrapVG.h:109
EGLDisplay m_display
EGL-Window-handling-magic.
Definition: GfxWrapVG.h:255
CGfxWrapVG(const NativeWindowType &hWindowType, const NativeDisplayType &hDisplayType)
NativeWindowType m_hWindowType
the window handle
Definition: GfxWrapVG.h:252
void GetPaintFromShape(CSVGShape &kShape, VGPaint &uiPaintHandle, eC_Bool bIsStroke)
virtual void Line(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
the following methods are protected to prevent calling them directly
virtual void FilledRect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
virtual void LoadImgImpl(const eC_String &kPath, const ImageResource_t &eImageID)
virtual void BlitImgExtImpl(const ImageResource_t &, 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))
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 GetVirtualScreenHeight()
virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType)
virtual void UnloadImg(const ImageResource_t &eImageID)
virtual void CreateScreen(const eC_UInt &uiWidth, const eC_UInt &uiHeight)
virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eImageID) const
virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eImageID) const
virtual eC_Bool DeInit(void)
NativeDisplayType m_hDisplayType
the display handle
Definition: GfxWrapVG.h:249
void CreateBitmapImage(const eC_UInt &uiCurImage)
void GetPathFromShape(const CSVGShape &kShape, VGPath &uiPathHandle)
EGLConfig m_screenConfig
config for buffer
Definition: GfxWrapVG.h:258
EGLConfig m_offScreenConfig
for double-buffering
Definition: GfxWrapVG.h:262
virtual ~CGfxWrapVG()
EGLContext m_offScreenContext
context of offscreen-buffer
Definition: GfxWrapVG.h:263
void CreateSVGImage(const eC_UInt &uiCurImage)
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)
EGLSurface m_windowSurface
window-surface for EGL
Definition: GfxWrapVG.h:256
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 CGUICommonEnums::ImageType_t &eImageType, const ImageResource_t &eID)
virtual eC_UInt GetPhysicalScreenWidth()
Definition: GfxWrapVG.h:108
void RenderSVG(const eC_UInt &uiCurImage)
virtual void SetForegroundColorImpl(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)
virtual eC_Bool ImageExists(ImageResource_t eID) const
void ConstructGradient(CGradient &kGradient, VGPaint &uiPaintHandle)
virtual void SetCliprect(const CGUIRect &rkNewClipRect)
virtual eC_Value SetLineWidth(const eC_Value &vWidth)
virtual void Rect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
virtual eC_Bool Init(void)
static eC_Bool CreateInstance(const NativeWindowType &hWindowType=0, const NativeDisplayType &hDisplayType=EGL_DEFAULT_DISPLAY)
eC_Bool CheckVGError(const eC_String &kCallingMethod)
eC_TArray< CGUIImageDataVG * > m_pkImages
array of VGImages or SVGImages
Definition: GfxWrapVG.h:265
virtual eC_UInt GetVirtualScreenWidth()
virtual void CreateScreen()
Helper used to create the screen itself.
eC_Bool CheckEGLError(const eC_String &kCallingMethod)
virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages)
virtual eC_UInt GetImageSize(const ImageResource_t &eImageID) const
EGLContext m_screenContext
context for buffer
Definition: GfxWrapVG.h:259
Definition: SVGShape.h:62