Guiliani  Version 2.6 revision 7293 (documentation build 12)
GfxWrap.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 GFXWRAP__H_
11#define GFXWRAP__H_
12
13#include "GUIComponentManager.h"
14
15#include "GUIRect.h"
16#include "eC_Math.h"
17
18#include "GUIFontResource.h"
19#include "GUIImageResource.h"
20
21#include "GUIImageData.h"
22#include "GUICommonEnums.h"
23
24#include "GUIText.h"
25#include "GUITrace.h"
26#include "GUIImageCache.h"
27#include "GUIObject.h"
28#include "GUINinePatch.h"
29#include "GUIPerfMon.h"
30
31#include "GUILayerConfig.h"
32
33#include "FntWrap.h"
34#include "WorkingMemory.h"
35
36#define GETGFX CGUIComponentManager::GetInstance().GetGfxWrap()
37#define GETFNT CGUIComponentManager::GetInstance().GetFntWrap()
38
39#define GETMEMORY(type, count) (type*)GetWorkingMemory((count) * sizeof(type));
40#define RELEASEMEMORY() ReleaseWorkingMemory();
41
62//#define GETGFX CGfxWrap::GetInstance()
63
64class CGUIBitmapPlane;
65class CGfxEnv;
66
67inline static eC_UInt UINT_FROM_RGB(const eC_UByte& R, const eC_UByte& G, const eC_UByte& B);
68inline static eC_UInt UINT_FROM_ARGB(const eC_UByte& A, const eC_UByte& R, const eC_UByte& G, const eC_UByte& B);
69inline static eC_UByte GET_A_VAL32(const eC_UInt& argb);
70inline static eC_UByte GET_R_VAL32(const eC_UInt& argb);
71inline static eC_UByte GET_G_VAL32(const eC_UInt& argb);
72inline static eC_UByte GET_B_VAL32(const eC_UInt& argb);
73
75
88{
89 friend class CGUIResourceManager;
91 friend class CGUIImageCacheImpl;
92 friend class CFntWrap;
93 friend class CGUI;
94 friend class CGUIComponentManager;
95
96public:
98 static void DeleteInstance();
99
100 // ---------------------------------------------------------------
101 // General functionality
102 // ---------------------------------------------------------------
103
113 {
119 };
120
131 inline void ForceRefresh() { m_bForceRefresh = true; }
132
138 virtual eC_UInt GetVirtualScreenWidth() = 0;
139
145 virtual eC_UInt GetVirtualScreenHeight() = 0;
146
151 virtual void SetScreenSize(
152 const eC_UInt &uiWidth,
153 const eC_UInt &uiHeight);
154
160 virtual eC_UInt GetPhysicalScreenWidth() = 0;
161
167 virtual eC_UInt GetPhysicalScreenHeight() = 0;
168
173 virtual eC_UInt GetScreenVerticalPPI() const { return (72); }
174
179 virtual eC_UInt GetScreenHorizontalPPI() const { return (72); }
180
184 CGUICommonEnums::ImageType_t GetScreenFormat() const { return m_eScreenFormat; }
185
189 void SetScreenFormat(const CGUICommonEnums::ImageType_t& uiScreenFormat) { m_eScreenFormat = uiScreenFormat; }
190
194 virtual void StoreWrapperState() {}
195
199 virtual void RestoreWrapperState() {}
200
201 // ---------------------------------------------------------------
202 // Drawing functions
203 // ---------------------------------------------------------------
204
208
215 const eC_UByte &ubRed,
216 const eC_UByte &ubGreen,
217 const eC_UByte &ubBlue,
218 const eC_UByte &ubAlpha = 255)
219 {
220 SetForegroundColorImpl(ubRed, ubGreen, ubBlue, ApplyGlobalAlpha(ubAlpha));
221 }
222
229 void SetForegroundColor(const eC_UInt &uiCol)
230 {
231 // The value of alpha is multiplied by the scaling factor (in the event of widgets with text, the text's alpha has to be scaled)
233 GET_R_VAL32(uiCol),
234 GET_G_VAL32(uiCol),
235 GET_B_VAL32(uiCol),
236 ApplyGlobalAlpha(GET_A_VAL32(uiCol)));
237 }
238
246 void UpdateGlobalAlpha(const eC_UByte &ubAlpha)
247 {
248 m_ubAlpha = ApplyGlobalAlpha(ubAlpha);
249 m_vGlobalAlphaFactor = eC_Div(eC_FromInt(m_ubAlpha), eC_FromFloat(255.0f));
250 }
251
257 void SetGlobalAlpha(const eC_UByte &ubAlpha)
258 {
259 m_ubAlpha = ubAlpha;
260 m_vGlobalAlphaFactor = eC_Div(eC_FromInt(m_ubAlpha), eC_FromFloat(255.0f));
261 }
262
267 virtual eC_Value SetLineWidth(const eC_Value& vWidth);
268
272 inline eC_UInt GetForegroundColor() const { return m_uiColor; }
273
277 inline eC_UByte GetGlobalAlpha() const { return m_ubAlpha; }
278
284 inline eC_UByte ApplyGlobalAlpha(const eC_UByte ubAlpha) const { return static_cast<eC_UByte>(eC_ToInt(eC_Mul(eC_FromInt(ubAlpha), m_vGlobalAlphaFactor))); }
285
287
290
295 void Line(const CGUIRect& kAbsRect);
296
301 void Rect(const CGUIRect& kAbsRect);
302
307 void FilledRect(const CGUIRect& kAbsRect);
308
314 void Ellipse(const CGUIRect& kAbsRect, const eC_Bool &bFilled);
315
324 void Arc(
325 const CGUIRect& kAbsRect,
326 const eC_Value& vStartAngle,
327 const eC_Value& vEndAngle,
328 const eC_Value& vRotationAngle,
329 const eC_Bool &bFilled);
330
340 void Ring(
341 const CGUIRect& kAbsRect,
342 const eC_Value& vRingWidth,
343 const eC_Value& vStartAngle,
344 const eC_Value& vEndAngle,
345 const eC_Value& vRotationAngle,
346 const eC_Bool &bFilled);
347
354 CGUIPoint* pkPoints,
355 const eC_UInt& uiCount,
356 const eC_Bool& bFilled);
357
358#if 0
364 virtual void DrawPolygon(
365 CGUIPoint* pkPoints,
366 const eC_UInt& uiCount,
367 const eC_Bool& bClosed) = 0;
368
373 virtual void FillPolygon(
374 CGUIPoint* pkPoints,
375 const eC_UInt& uiCount) = 0;
376#endif
377
383 void Text(
384 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
385 const eC_String * const lpString);
387
391 void SetGfxEnv(CGfxEnv* pkGfxEnv);
392
393 // ---------------------------------------------------------------
394 // Clipping and invalidated rectangles
395 // ---------------------------------------------------------------
396
400
404 virtual void RedrawGUI();
405
414 virtual void SetCliprect(const CGUIRect &NewAbsClipRect) = 0;
415
417 virtual void ResetCliprect();
418
422 virtual void GetCliprect(CGUIRect &AbsClipRect) const;
423
433 void InvalidateRect(const CGUIRect &kInvalidRect);
434
443 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
444 const eC_Value& vAbsX2, const eC_Value& vAbsY2)
445 {
446 InvalidateRect(CGUIRect(vAbsX1, vAbsY1, vAbsX2, vAbsY2));
447 }
448
452 inline const CGUIRect& GetInvalidatedRect() const
453 {
454 return m_kInvalidatedRect;
455 }
456
464 virtual void ClearInvalidRect() {}
466
470 // ---------------------------------------------------------------
471 // Image-access
472 // ---------------------------------------------------------------
481 const ImageResource_t &eID,
482 const eC_Value& vAbsDestX,
483 const eC_Value& vAbsDestY);
484
493 const CGUIImageData& kImageData,
494 const eC_Value& vAbsDestX,
495 const eC_Value& vAbsDestY)
496 {
497 BlitImgExtImpl(kImageData, vAbsDestX, vAbsDestY);
498 }
499
513 const ImageResource_t &eID,
514 const eC_Value& vAbsDestX,
515 const eC_Value& vAbsDestY,
516 const eC_Value& vWidth,
517 const eC_Value& vHeight,
518 const eC_Bool &bStretch = true,
519 const eC_UByte &ubAlpha = 255);
520
536 virtual void BlitImgNinePatch(
537 const ImageResource_t &eID,
538 const CGUIRect& kAbsRect,
539 const eC_UInt uiTopBorder,
540 const eC_UInt uiBottomBorder,
541 const eC_UInt uiLeftBorder,
542 const eC_UInt uiRightBorder,
543 const eC_UByte &ubAlpha = 255);
544
553 const ImageResource_t &eID,
554 const CGUIRect& kAbsRect,
555 const CGUINinePatch& kNinePatch,
556 const eC_UByte &ubAlpha = 255);
557
568 const ImageResource_t &eID,
569 const CGUIRect& kAbsRect,
570 const eC_Bool &bStretch = true,
571 const eC_UByte &ubAlpha = 255);
572
583 const ImageResource_t &eID,
584 const CGUIRect& kSrcAbsRect,
585 const CGUIRect& kDstAbsRect,
586 const eC_UByte &ubAlpha = 255);
587
612 const ImageResource_t &eID,
613 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY,
614 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
615 const eC_Value& vAbsDestX, const eC_Value& vAbsDestY,
616 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
617 const eC_UByte &ubAlpha = 255,
618 const eC_Value& vAngle = eC_FromFloat(0),
619 const eC_Value& vRotCenterX = eC_FromFloat(0.5),
620 const eC_Value& vRotCenterY = eC_FromFloat(0.5));
621
628 eC_UInt GetImgWidth(const ImageResource_t &eID) const;
629
636 eC_UInt GetImgHeight(const ImageResource_t &eID) const;
637
643 {
644 return CGUIRect(eC_FromInt(0), eC_FromInt(0), eC_FromInt(GetImgWidth(eID)), eC_FromInt(GetImgHeight(eID)));
645 }
646
648
652 // ---------------------------------------------------------------
653 // BitmapPlane-Access
654 // ---------------------------------------------------------------
655
662 virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID);
663
667 virtual eC_Bool DrawToScreen();
668
673 virtual eC_TArray<eC_UByte>* GetBitmapPlaneData(const GUIBitmapPlaneID_t& eBitmapPlaneID);
674
678 virtual void SetTargetLayer(const eC_UInt& uiLayerID) {}
679
684 virtual void SetRenderingOffset(const eC_Value& vOffsetX, const eC_Value& vOffsetY);
685
690 void GetRenderingOffset(eC_Value& vOffsetX, eC_Value& vOffsetY);
691
699 virtual GUIBitmapPlaneID_t CreateBitmapPlane(
700 const CGUIObject& rkParentObject,
701 const eC_Value& vWidth,
702 const eC_Value& vHeight);
703
707 void DeleteBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID);
708
712 void DeleteBitmapPlanes(const CGUIObject* pkObject);
713
720 CGUIBitmapPlane& GetBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID);
721
726 inline GUIBitmapPlaneID_t GetUsedBitmapPlaneID() const { return m_uiUsedRenderBitmapID; }
727
729
732 // ---------------------------------------------------------------
733 // Font-access
734 // ---------------------------------------------------------------
735
740 void SetFont(const FontResource_t &eID);
741
745 void SetFontSpacing(const eC_Float &fSpacing);
746
753 void RequiredSpace(const eC_String * const pkText, eC_Value& vWidth, eC_Value& vHeight);
754
763 const eC_String* const pkText,
764 eC_Value vWidthMax,
765 eC_UInt &uiNumChars,
766 const eC_Bool& bStartAtEnd = false);
767
772 eC_Int GetAscender() const;
773
778 eC_Int GetDescender() const;
779
784 eC_Int GetInternalLeading() const;
785
790 void GetGlyphMetrics(const eC_Char cChar, CFntWrap::GlyphMetrics_t& kMetrics);
791
798 eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment);
799
806 eC_Value GetTextYPosAdjustment(const CGUIText::VerAligned_t eVerAlignment);
807
815 eC_Bool SetNOFFonts(const eC_UInt uiNOFFonts);
816
822 eC_UInt GetNOFFonts();
823
832 const FontResource_t &eFontID,
833 const eC_Char* const pcPath,
834 const eC_UInt &uiFontSize,
835 const CFntWrap::GUIFont_t &eFontStyle);
836
841 void LoadFont(const FontResource_t &eFontID);
842
846 void UnloadFont(const FontResource_t &eFontID);
847
851 virtual eC_Bool SupportCompressedFonts() const { return false; }
852
859 virtual void LoadGlyphData(
860 CGUIImageData* pkImageData,
861 const eC_UInt& uiGlyphWidth,
862 const eC_UInt& uiGlyphHeight,
863 eC_UByte* pkGlyphBitmap);
864
868 virtual void UnloadGlyphData(CGUIImageData* pkImageData);
869
871
875 inline virtual eC_UInt GetNOFImages() { return m_uiNOFImages; }
876
882 virtual eC_Bool ImageExists(const ImageResource_t eID) const = 0;
883
891 inline static eC_UInt GetNextPowerOf2(const eC_Value& vValue)
892 {
893#if defined NON_POWER_OF_2_TEXTURES
894 return eC_ToInt(eC_Ceil(vValue));
895#else
896 eC_UInt uiPOW = eC_ToInt(vValue);
897 --uiPOW;
898 uiPOW |= uiPOW >> 16;
899 uiPOW |= uiPOW >> 8;
900 uiPOW |= uiPOW >> 4;
901 uiPOW |= uiPOW >> 2;
902 uiPOW |= uiPOW >> 1;
903 ++uiPOW;
904 return uiPOW;
905#endif
906 }
907
911 inline void SetDoubleBufferingEnforcesFlipping(const eC_Bool bDoubleBufferingEnforcesFlipping)
912 {
913 m_bDoubleBufferingEnforcesFlipping = bDoubleBufferingEnforcesFlipping;
914 }
915
920 {
922 }
923
924#if defined _DEBUG
928
929 inline void EnableDebugOutput()
930 {
931 m_bDebugOutput = true;
932 }
933
935 inline void DisableDebugOutput()
936 {
937 m_bDebugOutput = false;
938 }
940#endif
941
945 inline eC_String GetWrapperName() const
946 {
947 return m_kWrapperName;
948 }
949
953 virtual void SetOptimizedBlit(const eC_Bool& bOptimizedBlit)
954 {
955 m_bOptimizedBlit = bOptimizedBlit;
956 }
957
961 eC_Bool GetOptimizedBlit() const
962 {
963 return m_bOptimizedBlit;
964 }
965
969 virtual void SetFilteredBlit(const eC_Bool& bFilteredBlit)
970 {
971 m_bFilteredBlit = bFilteredBlit;
972 }
973
977 eC_Bool GetFilteredBlit() const
978 {
979 return m_bFilteredBlit;
980 }
981
985 virtual void SetWindowCaption(const eC_String& kText);
986
987protected:
990
992 virtual ~CGfxWrap(void);
993
995 void DeInit();
996
998
1005 virtual void Line(
1006 const eC_Value& vAbsX1,
1007 const eC_Value& vAbsY1,
1008 const eC_Value& vAbsX2,
1009 const eC_Value& vAbsY2) = 0;
1010
1022 virtual void Rect(
1023 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
1024 const eC_Value& vAbsX2, const eC_Value& vAbsY2) = 0;
1025
1037 virtual void FilledRect(
1038 const eC_Value& vAbsX1,
1039 const eC_Value& vAbsY1,
1040 const eC_Value& vAbsX2,
1041 const eC_Value& vAbsY2) = 0;
1042
1053 virtual void Ellipse(
1054 const eC_Value& vAbsX1,
1055 const eC_Value& vAbsY1,
1056 const eC_Value& vAbsX2,
1057 const eC_Value& vAbsY2,
1058 const eC_Bool &bFilled) = 0;
1059
1077 virtual void Arc(
1078 const eC_Value& vX1,
1079 const eC_Value& vY1,
1080 const eC_Value& vX2,
1081 const eC_Value& vY2,
1082 const eC_Value& vStartAngle,
1083 const eC_Value& vEndAngle,
1084 const eC_Value& vRotationAngle,
1085 const eC_Bool &bFilled) = 0;
1086
1105 virtual void Ring(
1106 const eC_Value& vX1,
1107 const eC_Value& vY1,
1108 const eC_Value& vX2,
1109 const eC_Value& vY2,
1110 const eC_Value& vRingWidth,
1111 const eC_Value& vStartAngle,
1112 const eC_Value& vEndAngle,
1113 const eC_Value& vRotationAngle,
1114 const eC_Bool & bFilled) = 0;
1115
1121 virtual void Polygon(
1122 eC_Value* pvPoints,
1123 const eC_UInt& uiCount,
1124 const eC_Bool& bFilled) = 0;
1125
1128
1134 virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType) = 0;
1135
1141 virtual void StartHandleDraw(const CGUIRect &crkClipRect);
1143
1146
1150 virtual void StartRedrawGUI() {}
1151
1153 virtual void EndRedrawGUI() {}
1154
1156 virtual void DestroyScreen() {}
1158
1161
1167 eC_Bool SetNOFImages(const eC_UInt uiNOFImages)
1168 {
1169 m_kGfxWrapSemaphore.Enter();
1170 eC_Bool bRet = SetNOFImagesImpl(uiNOFImages);
1171 m_kGfxWrapSemaphore.Leave();
1172 return bRet;
1173 }
1174
1182 virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
1183
1191 const eC_String& kPath,
1192 const ImageResource_t &eID);
1193
1204 void* pkMemory,
1205 const eC_UInt& uiWidth,
1206 const eC_UInt& uiHeight,
1207 const eC_UInt& eImageType,
1208 const ImageResource_t &eID);
1209
1215 virtual void LoadImgImpl(
1216 const eC_String& kPath,
1217 const ImageResource_t &eID) = 0;
1218
1227 virtual void LoadImgImpl(
1228 void* pkMemory,
1229 const eC_UInt& uiWidth,
1230 const eC_UInt& uiHeight,
1231 const eC_UInt& eImageType,
1232 const ImageResource_t &eID) = 0;
1233
1238 virtual void RefreshImage(const ImageResource_t& eID, void* pkMemory) {}
1239
1245 virtual void UnloadImg(const ImageResource_t &eID) {}
1246
1248
1251
1258 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const = 0;
1259
1267 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const = 0;
1268
1276 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const = 0;
1277
1296 virtual void BlitImgExtImpl(
1297 const ImageResource_t &eID,
1298 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY,
1299 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
1300 const eC_Value& vAbsDestX, const eC_Value& vAbsDestY,
1301 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
1302 const eC_UByte &ubAlpha = 255,
1303 const eC_Value& vAngle = eC_FromFloat(0),
1304 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5)) = 0;
1305
1314 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY) = 0;
1316
1325 const eC_UByte &ubRed,
1326 const eC_UByte &ubGreen,
1327 const eC_UByte &ubBlue,
1328 const eC_UByte &ubAlpha = 255) = 0;
1329
1332
1339 void SetInvalidatedRect(const eC_Value& vAbsX1, const eC_Value& vAbsY1, const eC_Value& vAbsX2, const eC_Value& vAbsY2);
1340
1345 void SetInvalidatedRect(const CGUIRect &NewAbsRect)
1346 {
1347 SetInvalidatedRect(NewAbsRect.GetX1(), NewAbsRect.GetY1(), NewAbsRect.GetX2(), NewAbsRect.GetY2());
1348 }
1349
1353
1354 // ---------------------------------------------------------------
1355 // Bitmap-Access
1356 // ---------------------------------------------------------------
1358
1371 GUIBitmapPlaneID_t uiNewBitmapID,
1372 const CGUIObject& rkParentObject,
1373 const eC_Value& vWidth, const eC_Value& vHeight);
1374
1379
1383 virtual eC_Bool FinishDrawToBitmap();
1385
1390 void* GetWorkingMemory(const eC_UInt& uiSize);
1391
1395
1396protected:
1399
1402
1405
1408
1413
1417
1421
1424
1427
1430
1432 eC_UInt m_uiColor;
1433
1435 eC_UByte m_ubAlpha;
1436
1446
1449
1454
1457
1460
1463
1465 static const eC_Value cvTwoPi;
1466
1469
1470#ifdef _DEBUG
1471 //These two attributes are compared to asssure that the number redraws and refreshes are equal which is important on some wrappers.
1472 eC_UInt m_uiRedrawGUICounter;
1473 eC_UInt m_uiRefreshGUICounter;
1474#endif
1475
1476private:
1480 GUIBitmapPlaneID_t GetFreeBitmapID();
1481
1483 void ResetInvalidation();
1484
1489 CGfxWrap(const CGfxWrap& kSource);
1490
1496 CGfxWrap& operator=(const CGfxWrap& kSource);
1497
1498private:
1502 eC_Bool m_bForceRefresh;
1503
1505 CGUICommonEnums::ImageType_t m_eScreenFormat;
1506
1508 CGUIBitmapPlane* m_pkDummyBitmap;
1509
1511 CGUIObject* m_pkDummyGUIObject;
1512
1514 eC_TArray<CGUIBitmapPlane*> m_apBitmaps;
1515
1517 CGUIRect m_kRealInvalidatedRect;
1518 CGUIRect m_kRealClipRect;
1519
1521 GUIBitmapPlaneID_t m_uiUsedRenderBitmapID;
1522
1524 eC_Bool m_bCurrentlyRedrawing;
1525
1526#ifdef _DEBUG
1528 eC_Bool m_bDebugOutput;
1529#endif
1530
1532 static eC_Bool ms_bWatermark;
1533};
1534
1535// Return an unsigned int value from RGB (Red, Green, Blue) color value. R, G and B are expected to be bytes.
1536inline static eC_UInt UINT_FROM_RGB(const eC_UByte& R, const eC_UByte& G, const eC_UByte& B)
1537{
1538 return (static_cast<eC_UInt>(B)) | ((static_cast<eC_UInt>(G)) << 8) | ((static_cast<eC_UInt>(R)) << 16);
1539}
1540
1541// Return an unsigned int value from ARGB (Alpha, Red, Green, Blue) color value. A, R, G and B are expected to be bytes.
1542inline static eC_UInt UINT_FROM_ARGB(const eC_UByte& A, const eC_UByte& R, const eC_UByte& G, const eC_UByte& B)
1543{
1544 return (static_cast<eC_UInt>(B)) | ((static_cast<eC_UInt>(G)) << 8) | ((static_cast<eC_UInt>(R)) << 16) | ((static_cast<eC_UInt>(A)) << 24);
1545}
1546
1548inline static eC_UByte GET_A_VAL32(const eC_UInt& argb)
1549{
1550 return static_cast<eC_UByte>((argb >> 24) & 0xFF);
1551}
1553inline static eC_UByte GET_R_VAL32(const eC_UInt& argb)
1554{
1555 return static_cast<eC_UByte>((argb >> 16) & 0xFF);
1556}
1557
1559inline static eC_UByte GET_G_VAL32(const eC_UInt& argb)
1560{
1561 return static_cast<eC_UByte>((argb >> 8) & 0xFF);
1562}
1563
1565inline static eC_UByte GET_B_VAL32(const eC_UInt& argb)
1566{
1567 return static_cast<eC_UByte>(argb & 0xFF);
1568}
1569#endif
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
Helper Macros in Guiliani
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
The font wrapper base class.
Definition: FntWrap.h:36
GUIFont_t
Definition: FntWrap.h:44
The bitmap plane base class.
Definition: GUIBitmapPlane.h:152
ImageType_t
Definition: GUICommonEnums.h:80
central component-manager
Definition: GUIComponentManager.h:62
GUI base class for any Guiliani application.
Definition: GUI.h:39
Implementation of Cache for Guiliani image resources.
Definition: GUIImageCacheImpl.h:23
Contains information about an image loaded by CGUIImageLoader.
Definition: GUIImageData.h:29
Helper class to for storing Nine-Patch images.
Definition: GUINinePatch.h:41
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:81
CGUIPoint class to hold two values (x, y) like a vector.
Definition: GUIPoint.h:18
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
eC_Value GetY2() const
Definition: GUIRect.h:199
eC_Value GetX2() const
Definition: GUIRect.h:198
eC_Value GetX1() const
Definition: GUIRect.h:196
eC_Value GetY1() const
Definition: GUIRect.h:197
Manages resource ID mappings for fonts, images, sounds, etc.
Definition: GUIResourceManager.h:111
HorAligned_t
Possible horizontal alignments.
Definition: GUIText.h:124
VerAligned_t
Possible vertical alignments.
Definition: GUIText.h:116
Definition: GfxEnv.h:53
The graphics wrapper base class.
Definition: GfxWrap.h:88
void FilledRect(const CGUIRect &kAbsRect)
void ReleaseWorkingMemory()
eC_UInt GetNOFFonts()
virtual eC_Bool SupportCompressedFonts() const
Definition: GfxWrap.h:851
eC_Bool GetOptimizedBlit() const
Definition: GfxWrap.h:961
virtual eC_UInt GetVirtualScreenWidth()=0
void GetRenderingOffset(eC_Value &vOffsetX, eC_Value &vOffsetY)
virtual void LoadGlyphData(CGUIImageData *pkImageData, const eC_UInt &uiGlyphWidth, const eC_UInt &uiGlyphHeight, eC_UByte *pkGlyphBitmap)
CGUIBitmapPlane & GetBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID)
void FittingNumChars(const eC_String *const pkText, eC_Value vWidthMax, eC_UInt &uiNumChars, const eC_Bool &bStartAtEnd=false)
void Ellipse(const CGUIRect &kAbsRect, const eC_Bool &bFilled)
void SetInvalidatedRect(const CGUIRect &NewAbsRect)
Definition: GfxWrap.h:1345
void SetGlobalAlpha(const eC_UByte &ubAlpha)
Definition: GfxWrap.h:257
void UnloadFont(const FontResource_t &eFontID)
virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType)=0
virtual CGUIBitmapPlane * CreateGfxDependentBitmap(GUIBitmapPlaneID_t uiNewBitmapID, const CGUIObject &rkParentObject, const eC_Value &vWidth, const eC_Value &vHeight)
WorkingMemory * m_pkWorkingMemory
working memory
Definition: GfxWrap.h:1468
virtual void ResetCliprect()
Resets the clipping rectangle.
virtual eC_UInt GetVirtualScreenHeight()=0
virtual void StartHandleDraw(const CGUIRect &crkClipRect)
void ChangeFont(const FontResource_t &eFontID, const eC_Char *const pcPath, const eC_UInt &uiFontSize, const CFntWrap::GUIFont_t &eFontStyle)
void SetGfxEnv(CGfxEnv *pkGfxEnv)
eC_Bool m_bOptimizedBlit
if optimized blit is active
Definition: GfxWrap.h:1459
virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages)
void BlitImgExt(const ImageResource_t &eID, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_Bool &bStretch=true, const eC_UByte &ubAlpha=255)
virtual void RedrawGUI()
virtual eC_UInt GetScreenVerticalPPI() const
Definition: GfxWrap.h:173
virtual void BlitImgExtImpl(const ImageResource_t &eID, 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))=0
void BlitImgExt(const ImageResource_t &eID, const CGUIRect &kAbsRect, const eC_Bool &bStretch=true, const eC_UByte &ubAlpha=255)
void Ring(const CGUIRect &kAbsRect, const eC_Value &vRingWidth, const eC_Value &vStartAngle, const eC_Value &vEndAngle, const eC_Value &vRotationAngle, const eC_Bool &bFilled)
eC_UInt m_uiScreenWidth
Screen width.
Definition: GfxWrap.h:1398
CGUIBitmapPlane & GetDummyBitmap()
virtual ~CGfxWrap(void)
Destructor.
virtual void StoreWrapperState()
Definition: GfxWrap.h:194
eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment)
CGUIRect GetImgOriginRect(const ImageResource_t &eID) const
Definition: GfxWrap.h:642
static eC_UInt GetNextPowerOf2(const eC_Value &vValue)
Definition: GfxWrap.h:891
eC_Bool m_bDoubleBufferingEnforcesFlipping
Definition: GfxWrap.h:1412
eC_Bool GetDoubleBufferingEnforcesFlipping()
Definition: GfxWrap.h:919
eC_Semaphore m_kGfxWrapSemaphore
Semaphore to lock access to methods used in a multi thread context.
Definition: GfxWrap.h:1448
void RequiredSpace(const eC_String *const pkText, eC_Value &vWidth, eC_Value &vHeight)
virtual void UnloadImg(const ImageResource_t &eID)
Definition: GfxWrap.h:1245
void SetFontSpacing(const eC_Float &fSpacing)
virtual void ClearInvalidRect()
Definition: GfxWrap.h:464
virtual eC_Value SetLineWidth(const eC_Value &vWidth)
void Arc(const CGUIRect &kAbsRect, const eC_Value &vStartAngle, const eC_Value &vEndAngle, const eC_Value &vRotationAngle, const eC_Bool &bFilled)
virtual void StartRedrawGUI()
Definition: GfxWrap.h:1150
virtual void Ellipse(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2, const eC_Bool &bFilled)=0
virtual eC_UInt GetPhysicalScreenWidth()=0
void Rect(const CGUIRect &kAbsRect)
eC_UInt m_uiNOFImages
total number of image-objects
Definition: GfxWrap.h:1429
CGUICommonEnums::ImageType_t GetScreenFormat() const
Definition: GfxWrap.h:184
CGfxEnv * m_pkGfxEnv
pointer to the graphics-environment
Definition: GfxWrap.h:1426
eC_UInt m_uiScreenHeight
Screen height.
Definition: GfxWrap.h:1401
eC_TListDoubleLinked< CGUIRect > m_kLastFrameInvalidatedRectList
This is the list of regions which have been invalidated during the LAST frame.
Definition: GfxWrap.h:1407
virtual void LoadImgImpl(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t &eID)=0
void ForceRefresh()
Definition: GfxWrap.h:131
virtual GUIBitmapPlaneID_t CreateBitmapPlane(const CGUIObject &rkParentObject, const eC_Value &vWidth, const eC_Value &vHeight)
eC_TListDoubleLinked< CGUIRect > m_kInvalidatedRectList
This is the list of invalidated rectangular regions within the GUI.
Definition: GfxWrap.h:1404
void BlitImgExt(const ImageResource_t &eID, 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 SetScreenSize(const eC_UInt &uiWidth, const eC_UInt &uiHeight)
virtual eC_Bool FinishDrawToBitmap()
void SetForegroundColor(const eC_UInt &uiCol)
Definition: GfxWrap.h:229
void SetForegroundColor(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)
Definition: GfxWrap.h:214
virtual void LoadImgImpl(const eC_String &kPath, const ImageResource_t &eID)=0
void DeleteBitmapPlanes(const CGUIObject *pkObject)
virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const =0
eC_Bool SetNOFFonts(const eC_UInt uiNOFFonts)
CGUIRect m_kClippingRect
Definition: GfxWrap.h:1420
eC_UInt GetImgWidth(const ImageResource_t &eID) const
void SetDoubleBufferingEnforcesFlipping(const eC_Bool bDoubleBufferingEnforcesFlipping)
Definition: GfxWrap.h:911
virtual eC_UInt GetImageSize(const ImageResource_t &eID) const =0
void * GetWorkingMemory(const eC_UInt &uiSize)
void SetScreenFormat(const CGUICommonEnums::ImageType_t &uiScreenFormat)
Definition: GfxWrap.h:189
static const eC_Value cvTwoPi
constant for 2 PI
Definition: GfxWrap.h:1465
virtual void BlitImgNinePatch(const ImageResource_t &eID, const CGUIRect &kAbsRect, const eC_UInt uiTopBorder, const eC_UInt uiBottomBorder, const eC_UInt uiLeftBorder, const eC_UInt uiRightBorder, const eC_UByte &ubAlpha=255)
void BlitImgExt(const ImageResource_t &eID, const CGUIRect &kSrcAbsRect, const CGUIRect &kDstAbsRect, const eC_UByte &ubAlpha=255)
virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID)
eC_UByte GetGlobalAlpha() const
Definition: GfxWrap.h:277
eC_Bool m_bFilteredBlit
if filtered blit is active
Definition: GfxWrap.h:1462
virtual void Rect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)=0
virtual eC_Bool ImageExists(const ImageResource_t eID) const =0
virtual void UnloadGlyphData(CGUIImageData *pkImageData)
eC_UInt GetForegroundColor() const
Definition: GfxWrap.h:272
friend class CGUIBackgroundImageLoaderThread
Definition: GfxWrap.h:90
eC_UByte ApplyGlobalAlpha(const eC_UByte ubAlpha) const
Definition: GfxWrap.h:284
void Polygon(CGUIPoint *pkPoints, const eC_UInt &uiCount, const eC_Bool &bFilled)
void BlitImgNinePatch(const ImageResource_t &eID, const CGUIRect &kAbsRect, const CGUINinePatch &kNinePatch, const eC_UByte &ubAlpha=255)
void GetGlyphMetrics(const eC_Char cChar, CFntWrap::GlyphMetrics_t &kMetrics)
void DeleteBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID)
eC_Int GetDescender() const
eC_Bool SetNOFImages(const eC_UInt uiNOFImages)
Definition: GfxWrap.h:1167
virtual eC_UInt GetPhysicalScreenHeight()=0
void LoadFont(const FontResource_t &eFontID)
eC_Value m_vRenderingOffsetY
offset in y-direction
Definition: GfxWrap.h:1453
virtual void FilledRect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)=0
eC_Value GetTextYPosAdjustment(const CGUIText::VerAligned_t eVerAlignment)
virtual void RestoreWrapperState()
Definition: GfxWrap.h:199
eC_Int GetInternalLeading() const
void SetFont(const FontResource_t &eID)
GUIBitmapPlaneID_t GetUsedBitmapPlaneID() const
Definition: GfxWrap.h:726
eC_Value m_vRenderingOffsetX
offset in x-direction
Definition: GfxWrap.h:1451
eC_Bool m_bInvalidationInLastFrame
Definition: GfxWrap.h:1445
void InvalidateRect(const CGUIRect &kInvalidRect)
virtual void Polygon(eC_Value *pvPoints, const eC_UInt &uiCount, const eC_Bool &bFilled)=0
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)=0
void Line(const CGUIRect &kAbsRect)
const CGUIRect & GetInvalidatedRect() const
Definition: GfxWrap.h:452
virtual void BlitImgExtImpl(const CGUIImageData &kImageData, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY)=0
virtual void DestroyScreen()
Method to clean and release the screen which was created via the CreateScreen Method.
Definition: GfxWrap.h:1156
virtual void SetForegroundColorImpl(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)=0
virtual void EndRedrawGUI()
Callback which is called at the end of RedrawGUI() after all Invalidated areas were drawn and refresh...
Definition: GfxWrap.h:1153
virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const =0
void SetInvalidatedRect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
eC_UByte m_ubAlpha
Currently set global alpha value.
Definition: GfxWrap.h:1435
void UpdateGlobalAlpha(const eC_UByte &ubAlpha)
Definition: GfxWrap.h:246
void LoadImg(const eC_String &kPath, const ImageResource_t &eID)
eC_String m_kWrapperName
name of the wrapper
Definition: GfxWrap.h:1456
virtual eC_TArray< eC_UByte > * GetBitmapPlaneData(const GUIBitmapPlaneID_t &eBitmapPlaneID)
virtual eC_UInt GetNOFImages()
Definition: GfxWrap.h:875
eC_Int GetAscender() const
virtual eC_UInt GetScreenHorizontalPPI() const
Definition: GfxWrap.h:179
virtual void Line(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)=0
the following methods are protected to prevent calling them directly
CGUIRect m_kInvalidatedRect
Definition: GfxWrap.h:1416
eC_Value m_vLineWidth
Line width in pixels.
Definition: GfxWrap.h:1423
RefreshCall_t
Definition: GfxWrap.h:113
@ LAST_REFRESH_OF_FRAME
The last refresh call in this frame.
Definition: GfxWrap.h:117
@ INTERMEDIATE_REFRESH
Any Refresh between the first and the last call.
Definition: GfxWrap.h:116
@ FORCED_REFRESH
Refresh was forced. A refresh of this type is used in addition to one of the others,...
Definition: GfxWrap.h:118
@ SINGLE_REFRESH
Only one refresh in this frame. So it is the first and the last call.
Definition: GfxWrap.h:114
@ FIRST_REFRESH_OF_FRAME
The first refresh call in this frame.
Definition: GfxWrap.h:115
void Text(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_String *const lpString)
virtual eC_Bool DrawToScreen()
virtual void SetFilteredBlit(const eC_Bool &bFilteredBlit)
Definition: GfxWrap.h:969
void DeInit()
Deinitialization.
virtual void GetCliprect(CGUIRect &AbsClipRect) const
void BlitImg(const ImageResource_t &eID, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY)
eC_Value m_vGlobalAlphaFactor
Definition: GfxWrap.h:1439
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)=0
virtual void SetTargetLayer(const eC_UInt &uiLayerID)
Definition: GfxWrap.h:678
virtual void SetCliprect(const CGUIRect &NewAbsClipRect)=0
virtual void SetRenderingOffset(const eC_Value &vOffsetX, const eC_Value &vOffsetY)
virtual void SetOptimizedBlit(const eC_Bool &bOptimizedBlit)
Definition: GfxWrap.h:953
virtual void SetWindowCaption(const eC_String &kText)
void LoadImg(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t &eID)
void BlitImg(const CGUIImageData &kImageData, const eC_Value &vAbsDestX, const eC_Value &vAbsDestY)
Definition: GfxWrap.h:492
CGfxWrap()
Constructor.
eC_UInt GetImgHeight(const ImageResource_t &eID) const
eC_UInt m_uiColor
Currently set foreground color.
Definition: GfxWrap.h:1432
void InvalidateRect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
Definition: GfxWrap.h:442
static void DeleteInstance()
Delete the graphics wrapper instance.
eC_Bool GetFilteredBlit() const
Definition: GfxWrap.h:977
void ResetInvalidatedRect()
Resets the invalidated rectangle.
eC_String GetWrapperName() const
Definition: GfxWrap.h:945
virtual void RefreshImage(const ImageResource_t &eID, void *pkMemory)
Definition: GfxWrap.h:1238
Definition: WorkingMemory.h:23
Definition: FntWrap.h:60