Guiliani  Version 2.5 revision 7293 (documentation build 13)
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
35#define GETGFX CGUIComponentManager::GetInstance().GetGfxWrap()
36#define GETFNT CGUIComponentManager::GetInstance().GetFntWrap()
37
58//#define GETGFX CGfxWrap::GetInstance()
59
60class CGUIBitmapPlane;
61class CGfxEnv;
62
63inline static eC_UInt UINT_FROM_RGB(const eC_UByte& R, const eC_UByte& G, const eC_UByte& B);
64inline static eC_UInt UINT_FROM_ARGB(const eC_UByte& A, const eC_UByte& R, const eC_UByte& G, const eC_UByte& B);
65inline static eC_UByte GET_A_VAL32(const eC_UInt& argb);
66inline static eC_UByte GET_R_VAL32(const eC_UInt& argb);
67inline static eC_UByte GET_G_VAL32(const eC_UInt& argb);
68inline static eC_UByte GET_B_VAL32(const eC_UInt& argb);
69
71
84{
85 friend class CGUIResourceManager;
87 friend class CGUIImageCacheImpl;
88 friend class CFntWrap;
89 friend class CGUI;
90 friend class CGUIComponentManager;
91
92public:
94 static void DeleteInstance();
95
96 // ---------------------------------------------------------------
97 // General functionality
98 // ---------------------------------------------------------------
99
109 {
115 };
116
127 inline void ForceRefresh() { m_bForceRefresh = true; }
128
134 virtual eC_UInt GetVirtualScreenWidth() = 0;
135
141 virtual eC_UInt GetVirtualScreenHeight() = 0;
142
147 virtual void SetScreenSize(
148 const eC_UInt &uiWidth,
149 const eC_UInt &uiHeight);
150
156 virtual eC_UInt GetPhysicalScreenWidth() = 0;
157
163 virtual eC_UInt GetPhysicalScreenHeight() = 0;
164
169 virtual eC_UInt GetScreenVerticalPPI() const { return (72); }
170
175 virtual eC_UInt GetScreenHorizontalPPI() const { return (72); }
176
180 CGUICommonEnums::ImageType_t GetScreenFormat() const { return m_eScreenFormat; }
181
185 void SetScreenFormat(const CGUICommonEnums::ImageType_t& uiScreenFormat) { m_eScreenFormat = uiScreenFormat; }
186
190 virtual void StoreWrapperState() {}
191
195 virtual void RestoreWrapperState() {}
196
197 // ---------------------------------------------------------------
198 // Drawing functions
199 // ---------------------------------------------------------------
200
204
211 const eC_UByte &ubRed,
212 const eC_UByte &ubGreen,
213 const eC_UByte &ubBlue,
214 const eC_UByte &ubAlpha = 255)
215 {
216 SetForegroundColorImpl(ubRed, ubGreen, ubBlue, ApplyGlobalAlpha(ubAlpha));
217 }
218
225 void SetForegroundColor(const eC_UInt &uiCol)
226 {
227 // 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)
229 GET_R_VAL32(uiCol),
230 GET_G_VAL32(uiCol),
231 GET_B_VAL32(uiCol),
232 ApplyGlobalAlpha(GET_A_VAL32(uiCol)));
233 }
234
242 void UpdateGlobalAlpha(const eC_UByte &ubAlpha)
243 {
244 m_ubAlpha = ApplyGlobalAlpha(ubAlpha);
245 m_vGlobalAlphaFactor = eC_Div(eC_FromInt(m_ubAlpha), eC_FromFloat(255.0f));
246 }
247
253 void SetGlobalAlpha(const eC_UByte &ubAlpha)
254 {
255 m_ubAlpha = ubAlpha;
256 m_vGlobalAlphaFactor = eC_Div(eC_FromInt(m_ubAlpha), eC_FromFloat(255.0f));
257 }
258
263 virtual eC_Value SetLineWidth(const eC_Value& vWidth);
264
268 inline eC_UInt GetForegroundColor() const { return m_uiColor; }
269
273 inline eC_UByte GetGlobalAlpha() const { return m_ubAlpha; }
274
280 inline eC_UByte ApplyGlobalAlpha(const eC_UByte ubAlpha) const { return static_cast<eC_UByte>(eC_ToInt(eC_Mul(eC_FromInt(ubAlpha), m_vGlobalAlphaFactor))); }
281
283
286
291 void Line(const CGUIRect& kAbsRect);
292
297 void Rect(const CGUIRect& kAbsRect);
298
303 void FilledRect(const CGUIRect& kAbsRect);
304
310 void Ellipse(const CGUIRect& kAbsRect, const eC_Bool &bFilled);
311
320 void Arc(
321 const CGUIRect& kAbsRect,
322 const eC_Value& vStartAngle,
323 const eC_Value& vEndAngle,
324 const eC_Value& vRotationAngle,
325 const eC_Bool &bFilled);
326
336 void Ring(
337 const CGUIRect& kAbsRect,
338 const eC_Value& vRingWidth,
339 const eC_Value& vStartAngle,
340 const eC_Value& vEndAngle,
341 const eC_Value& vRotationAngle,
342 const eC_Bool &bFilled);
343
349 void Text(
350 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
351 const eC_String * const lpString);
353
357 void SetGfxEnv(CGfxEnv* pkGfxEnv);
358
359 // ---------------------------------------------------------------
360 // Clipping and invalidated rectangles
361 // ---------------------------------------------------------------
362
366
370 virtual void RedrawGUI();
371
380 virtual void SetCliprect(const CGUIRect &NewAbsClipRect) = 0;
381
383 virtual void ResetCliprect();
384
388 virtual void GetCliprect(CGUIRect &AbsClipRect) const;
389
399 void InvalidateRect(const CGUIRect &kInvalidRect);
400
409 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
410 const eC_Value& vAbsX2, const eC_Value& vAbsY2)
411 {
412 InvalidateRect(CGUIRect(vAbsX1, vAbsY1, vAbsX2, vAbsY2));
413 }
414
418 inline const CGUIRect& GetInvalidatedRect() const
419 {
420 return m_kInvalidatedRect;
421 }
422
430 virtual void ClearInvalidRect() {}
432
436 // ---------------------------------------------------------------
437 // Image-access
438 // ---------------------------------------------------------------
447 const ImageResource_t &eID,
448 const eC_Value& vAbsDestX,
449 const eC_Value& vAbsDestY);
450
459 const CGUIImageData& kImageData,
460 const eC_Value& vAbsDestX,
461 const eC_Value& vAbsDestY)
462 {
463 BlitImgExtImpl(kImageData, vAbsDestX, vAbsDestY);
464 }
465
479 const ImageResource_t &eID,
480 const eC_Value& vAbsDestX,
481 const eC_Value& vAbsDestY,
482 const eC_Value& vWidth,
483 const eC_Value& vHeight,
484 const eC_Bool &bStretch = true,
485 const eC_UByte &ubAlpha = 255);
486
502 virtual void BlitImgNinePatch(
503 const ImageResource_t &eID,
504 const CGUIRect& kAbsRect,
505 const eC_UInt uiTopBorder,
506 const eC_UInt uiBottomBorder,
507 const eC_UInt uiLeftBorder,
508 const eC_UInt uiRightBorder,
509 const eC_UByte &ubAlpha = 255);
510
519 const ImageResource_t &eID,
520 const CGUIRect& kAbsRect,
521 const CGUINinePatch& kNinePatch,
522 const eC_UByte &ubAlpha = 255);
523
534 const ImageResource_t &eID,
535 const CGUIRect& kAbsRect,
536 const eC_Bool &bStretch = true,
537 const eC_UByte &ubAlpha = 255);
538
549 const ImageResource_t &eID,
550 const CGUIRect& kSrcAbsRect,
551 const CGUIRect& kDstAbsRect,
552 const eC_UByte &ubAlpha = 255);
553
578 const ImageResource_t &eID,
579 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY,
580 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
581 const eC_Value& vAbsDestX, const eC_Value& vAbsDestY,
582 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
583 const eC_UByte &ubAlpha = 255,
584 const eC_Value& vAngle = eC_FromFloat(0),
585 const eC_Value& vRotCenterX = eC_FromFloat(0.5),
586 const eC_Value& vRotCenterY = eC_FromFloat(0.5));
587
594 eC_UInt GetImgWidth(const ImageResource_t &eID) const;
595
602 eC_UInt GetImgHeight(const ImageResource_t &eID) const;
603
609 {
610 return CGUIRect(eC_FromInt(0), eC_FromInt(0), eC_FromInt(GetImgWidth(eID)), eC_FromInt(GetImgHeight(eID)));
611 }
612
614
618 // ---------------------------------------------------------------
619 // BitmapPlane-Access
620 // ---------------------------------------------------------------
621
628 virtual eC_Bool DrawToBitmap(GUIBitmapPlaneID_t uiBitmapID);
629
633 virtual eC_Bool DrawToScreen();
634
639 virtual eC_TArray<eC_UByte>* GetBitmapPlaneData(const GUIBitmapPlaneID_t& eBitmapPlaneID);
640
644 virtual void SetTargetLayer(const eC_UInt& uiLayerID) {}
645
650 virtual void SetRenderingOffset(const eC_Value& vOffsetX, const eC_Value& vOffsetY);
651
656 void GetRenderingOffset(eC_Value& vOffsetX, eC_Value& vOffsetY);
657
658#if USE_ZOOM
659 void SetZoom(const eC_Value& vZoomFactor, const CGUIRect& kZoomRect)
660 {
661 m_vZoomFactor = vZoomFactor;
662 m_kZoomArea = kZoomRect;
663 m_bZoomActive = true;
664 }
665
666 void GetZoom(eC_Value& vZoomFactor, CGUIRect& kZoomRect) const
667 {
668 vZoomFactor = m_vZoomFactor;
669 kZoomRect = m_kZoomArea;
670 }
671
672 void ResetZoom()
673 {
674 m_vZoomFactor = eC_FromInt(1);
675 m_bZoomActive = false;
676 }
677
678 eC_Bool IsZoomActive() const
679 {
680 return m_bZoomActive;
681 }
682#endif
683
691 virtual GUIBitmapPlaneID_t CreateBitmapPlane(
692 const CGUIObject& rkParentObject,
693 const eC_Value& vWidth,
694 const eC_Value& vHeight);
695
699 void DeleteBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID);
700
704 void DeleteBitmapPlanes(const CGUIObject* pkObject);
705
712 CGUIBitmapPlane& GetBitmapPlane(const GUIBitmapPlaneID_t uiBitmapID);
713
718 inline GUIBitmapPlaneID_t GetUsedBitmapPlaneID() const { return m_uiUsedRenderBitmapID; }
719
721
724 // ---------------------------------------------------------------
725 // Font-access
726 // ---------------------------------------------------------------
727
732 void SetFont(const FontResource_t &eID);
733
737 void SetFontSpacing(const eC_Float &fSpacing);
738
745 void RequiredSpace(const eC_String * const pkText, eC_Value& vWidth, eC_Value& vHeight);
746
755 const eC_String* const pkText,
756 eC_Value vWidthMax,
757 eC_UInt &uiNumChars,
758 const eC_Bool& bStartAtEnd = false);
759
764 eC_Int GetAscender() const;
765
770 eC_Int GetDescender() const;
771
776 eC_Int GetInternalLeading() const;
777
782 void GetGlyphMetrics(const eC_Char cChar, CFntWrap::GlyphMetrics_t& kMetrics);
783
790 eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment);
791
798 eC_Value GetTextYPosAdjustment(const CGUIText::VerAligned_t eVerAlignment);
799
807 eC_Bool SetNOFFonts(const eC_UInt uiNOFFonts);
808
814 eC_UInt GetNOFFonts();
815
824 const FontResource_t &eFontID,
825 const eC_Char* const pcPath,
826 const eC_UInt &uiFontSize,
827 const CFntWrap::GUIFont_t &eFontStyle);
828
833 void LoadFont(const FontResource_t &eFontID);
834
838 void UnloadFont(const FontResource_t &eFontID);
839
843 virtual eC_Bool SupportCompressedFonts() const { return false; }
844
851 virtual void LoadGlyphData(
852 CGUIImageData* pkImageData,
853 const eC_UInt& uiGlyphWidth,
854 const eC_UInt& uiGlyphHeight,
855 eC_UByte* pkGlyphBitmap);
856
860 virtual void UnloadGlyphData(CGUIImageData* pkImageData);
861
863
867 inline virtual eC_UInt GetNOFImages() { return m_uiNOFImages; }
868
874 virtual eC_Bool ImageExists(const ImageResource_t eID) const = 0;
875
883 inline static eC_UInt GetNextPowerOf2(const eC_Value& vValue)
884 {
885#if defined NON_POWER_OF_2_TEXTURES
886 return eC_ToInt(eC_Ceil(vValue));
887#else
888 eC_UInt uiPOW = eC_ToInt(vValue);
889 --uiPOW;
890 uiPOW |= uiPOW >> 16;
891 uiPOW |= uiPOW >> 8;
892 uiPOW |= uiPOW >> 4;
893 uiPOW |= uiPOW >> 2;
894 uiPOW |= uiPOW >> 1;
895 ++uiPOW;
896 return uiPOW;
897#endif
898 }
899
903 inline void SetDoubleBufferingEnforcesFlipping(const eC_Bool bDoubleBufferingEnforcesFlipping)
904 {
905 m_bDoubleBufferingEnforcesFlipping = bDoubleBufferingEnforcesFlipping;
906 }
907
912 {
914 }
915
916#if defined _DEBUG
920
921 inline void EnableDebugOutput()
922 {
923 m_bDebugOutput = true;
924 }
925
927 inline void DisableDebugOutput()
928 {
929 m_bDebugOutput = false;
930 }
932#endif
933
937 inline eC_String GetWrapperName() const
938 {
939 return m_kWrapperName;
940 }
941
945 virtual void SetOptimizedBlit(const eC_Bool& bOptimizedBlit)
946 {
947 m_bOptimizedBlit = bOptimizedBlit;
948 }
949
953 virtual void SetFilteredBlit(const eC_Bool& bFilteredBlit)
954 {
955 m_bFilteredBlit = bFilteredBlit;
956 }
957
961 virtual void SetWindowCaption(const eC_String& kText);
962
967 virtual eC_UByte* GetWorkingMemory(const eC_UInt& uiSize);
968
972 virtual void ReleaseWorkingMemory(eC_UByte* pkMemory);
973
976 virtual void SyncWorkingMemory();
977
980 virtual void ResetWorkingMemory();
981
982protected:
985
987 virtual ~CGfxWrap(void);
988
990 void DeInit();
991
993
1000 virtual void Line(
1001 const eC_Value& vAbsX1,
1002 const eC_Value& vAbsY1,
1003 const eC_Value& vAbsX2,
1004 const eC_Value& vAbsY2) = 0;
1005
1017 virtual void Rect(
1018 const eC_Value& vAbsX1, const eC_Value& vAbsY1,
1019 const eC_Value& vAbsX2, const eC_Value& vAbsY2) = 0;
1020
1032 virtual void FilledRect(
1033 const eC_Value& vAbsX1,
1034 const eC_Value& vAbsY1,
1035 const eC_Value& vAbsX2,
1036 const eC_Value& vAbsY2) = 0;
1037
1048 virtual void Ellipse(
1049 const eC_Value& vAbsX1,
1050 const eC_Value& vAbsY1,
1051 const eC_Value& vAbsX2,
1052 const eC_Value& vAbsY2,
1053 const eC_Bool &bFilled) = 0;
1054
1072 virtual void Arc(
1073 const eC_Value& vX1,
1074 const eC_Value& vY1,
1075 const eC_Value& vX2,
1076 const eC_Value& vY2,
1077 const eC_Value& vStartAngle,
1078 const eC_Value& vEndAngle,
1079 const eC_Value& vRotationAngle,
1080 const eC_Bool &bFilled) = 0;
1081
1100 virtual void Ring(
1101 const eC_Value& vX1,
1102 const eC_Value& vY1,
1103 const eC_Value& vX2,
1104 const eC_Value& vY2,
1105 const eC_Value& vRingWidth,
1106 const eC_Value& vStartAngle,
1107 const eC_Value& vEndAngle,
1108 const eC_Value& vRotationAngle,
1109 const eC_Bool & bFilled) = 0;
1110
1113
1119 virtual eC_Bool Refresh(const RefreshCall_t eRefreshCallType) = 0;
1120
1126 virtual void StartHandleDraw(const CGUIRect &crkClipRect);
1128
1131
1135 virtual void StartRedrawGUI() {}
1136
1138 virtual void EndRedrawGUI() {}
1139
1141 virtual void DestroyScreen() {}
1143
1146
1152 eC_Bool SetNOFImages(const eC_UInt uiNOFImages)
1153 {
1154 m_kGfxWrapSemaphore.Enter();
1155 eC_Bool bRet = SetNOFImagesImpl(uiNOFImages);
1156 m_kGfxWrapSemaphore.Leave();
1157 return bRet;
1158 }
1159
1167 virtual eC_Bool SetNOFImagesImpl(const eC_UInt uiNOFImages);
1168
1176 const eC_String& kPath,
1177 const ImageResource_t &eID);
1178
1189 void* pkMemory,
1190 const eC_UInt& uiWidth,
1191 const eC_UInt& uiHeight,
1192 const eC_UInt& eImageType,
1193 const ImageResource_t &eID);
1194
1200 virtual void LoadImgImpl(
1201 const eC_String& kPath,
1202 const ImageResource_t &eID) = 0;
1203
1212 virtual void LoadImgImpl(
1213 void* pkMemory,
1214 const eC_UInt& uiWidth,
1215 const eC_UInt& uiHeight,
1216 const eC_UInt& eImageType,
1217 const ImageResource_t &eID) = 0;
1218
1223 virtual void RefreshImage(const ImageResource_t& eID, void* pkMemory) {}
1224
1230 virtual void UnloadImg(const ImageResource_t &eID) {}
1231
1233
1236
1243 virtual eC_UInt GetImageSize(const ImageResource_t& eID) const = 0;
1244
1252 virtual eC_UInt GetImgWidthImpl(const ImageResource_t &eID) const = 0;
1253
1261 virtual eC_UInt GetImgHeightImpl(const ImageResource_t &eID) const = 0;
1262
1281 virtual void BlitImgExtImpl(
1282 const ImageResource_t &eID,
1283 const eC_UInt &uiAbsSrcX, const eC_UInt &uiAbsSrcY,
1284 const eC_UInt &uiSrcWidth, const eC_UInt &uiSrcHeight,
1285 const eC_Value& vAbsDestX, const eC_Value& vAbsDestY,
1286 const eC_Value& vDestWidth, const eC_Value& vDestHeight,
1287 const eC_UByte &ubAlpha = 255,
1288 const eC_Value& vAngle = eC_FromFloat(0),
1289 const eC_Value& vRotCenterX = eC_FromFloat(0.5), const eC_Value& vRotCenterY = eC_FromFloat(0.5)) = 0;
1290
1299 virtual void BlitImgExtImpl(const CGUIImageData& kImageData, const eC_Value& vAbsDestX, const eC_Value& vAbsDestY) = 0;
1301
1310 const eC_UByte &ubRed,
1311 const eC_UByte &ubGreen,
1312 const eC_UByte &ubBlue,
1313 const eC_UByte &ubAlpha = 255) = 0;
1314
1317
1324 void SetInvalidatedRect(const eC_Value& vAbsX1, const eC_Value& vAbsY1, const eC_Value& vAbsX2, const eC_Value& vAbsY2);
1325
1330 void SetInvalidatedRect(const CGUIRect &NewAbsRect)
1331 {
1332 SetInvalidatedRect(NewAbsRect.GetX1(), NewAbsRect.GetY1(), NewAbsRect.GetX2(), NewAbsRect.GetY2());
1333 }
1334
1338
1339 // ---------------------------------------------------------------
1340 // Bitmap-Access
1341 // ---------------------------------------------------------------
1343
1356 GUIBitmapPlaneID_t uiNewBitmapID,
1357 const CGUIObject& rkParentObject,
1358 const eC_Value& vWidth, const eC_Value& vHeight);
1359
1364
1368 virtual eC_Bool FinishDrawToBitmap();
1370
1371protected:
1374
1377
1380
1383
1388
1392
1396
1399
1402
1405
1407 eC_UInt m_uiColor;
1408
1410 eC_UByte m_ubAlpha;
1411
1421
1424
1429
1432
1435
1438
1440 static const eC_Value cvTwoPi;
1441
1442#ifdef USE_ZOOM
1443 eC_Bool m_bZoomActive;
1444 eC_Value m_vZoomFactor;
1445 CGUIRect m_kZoomArea;
1446#endif
1447
1448#ifdef _DEBUG
1449 //These two attributes are compared to asssure that the number redraws and refreshes are equal which is important on some wrappers.
1450 eC_UInt m_uiRedrawGUICounter;
1451 eC_UInt m_uiRefreshGUICounter;
1452#endif
1453
1454private:
1458 GUIBitmapPlaneID_t GetFreeBitmapID();
1459
1461 void ResetInvalidation();
1462
1467 CGfxWrap(const CGfxWrap& kSource);
1468
1474 CGfxWrap& operator=(const CGfxWrap& kSource);
1475
1476private:
1480 eC_Bool m_bForceRefresh;
1481
1483 CGUICommonEnums::ImageType_t m_eScreenFormat;
1484
1486 CGUIBitmapPlane* m_pkDummyBitmap;
1487
1489 CGUIObject* m_pkDummyGUIObject;
1490
1492 eC_TArray<CGUIBitmapPlane*> m_apBitmaps;
1493
1495 CGUIRect m_kRealInvalidatedRect;
1496 CGUIRect m_kRealClipRect;
1497
1499 GUIBitmapPlaneID_t m_uiUsedRenderBitmapID;
1500
1502 eC_Bool m_bCurrentlyRedrawing;
1503
1504#ifdef _DEBUG
1506 eC_Bool m_bDebugOutput;
1507#endif
1508
1510 static eC_Bool ms_bWatermark;
1511};
1512
1513// Return an unsigned int value from RGB (Red, Green, Blue) color value. R, G and B are expected to be bytes.
1514inline static eC_UInt UINT_FROM_RGB(const eC_UByte& R, const eC_UByte& G, const eC_UByte& B)
1515{
1516 return (static_cast<eC_UInt>(B)) | ((static_cast<eC_UInt>(G)) << 8) | ((static_cast<eC_UInt>(R)) << 16);
1517}
1518
1519// Return an unsigned int value from ARGB (Alpha, Red, Green, Blue) color value. A, R, G and B are expected to be bytes.
1520inline static eC_UInt UINT_FROM_ARGB(const eC_UByte& A, const eC_UByte& R, const eC_UByte& G, const eC_UByte& B)
1521{
1522 return (static_cast<eC_UInt>(B)) | ((static_cast<eC_UInt>(G)) << 8) | ((static_cast<eC_UInt>(R)) << 16) | ((static_cast<eC_UInt>(A)) << 24);
1523}
1524
1526inline static eC_UByte GET_A_VAL32(const eC_UInt& argb)
1527{
1528 return static_cast<eC_UByte>((argb >> 24) & 0xFF);
1529}
1531inline static eC_UByte GET_R_VAL32(const eC_UInt& argb)
1532{
1533 return static_cast<eC_UByte>((argb >> 16) & 0xFF);
1534}
1535
1537inline static eC_UByte GET_G_VAL32(const eC_UInt& argb)
1538{
1539 return static_cast<eC_UByte>((argb >> 8) & 0xFF);
1540}
1541
1543inline static eC_UByte GET_B_VAL32(const eC_UInt& argb)
1544{
1545 return static_cast<eC_UByte>(argb & 0xFF);
1546}
1547#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:47
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:79
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:84
void FilledRect(const CGUIRect &kAbsRect)
eC_UInt GetNOFFonts()
virtual eC_Bool SupportCompressedFonts() const
Definition: GfxWrap.h:843
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:1330
void SetGlobalAlpha(const eC_UByte &ubAlpha)
Definition: GfxWrap.h:253
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)
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:1434
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:169
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:1373
CGUIBitmapPlane & GetDummyBitmap()
virtual ~CGfxWrap(void)
Destructor.
virtual void StoreWrapperState()
Definition: GfxWrap.h:190
eC_Value GetTextXPosAdjustment(const CGUIText::HorAligned_t eHorAlignment)
CGUIRect GetImgOriginRect(const ImageResource_t &eID) const
Definition: GfxWrap.h:608
static eC_UInt GetNextPowerOf2(const eC_Value &vValue)
Definition: GfxWrap.h:883
eC_Bool m_bDoubleBufferingEnforcesFlipping
Definition: GfxWrap.h:1387
eC_Bool GetDoubleBufferingEnforcesFlipping()
Definition: GfxWrap.h:911
eC_Semaphore m_kGfxWrapSemaphore
Semaphore to lock access to methods used in a multi thread context.
Definition: GfxWrap.h:1423
void RequiredSpace(const eC_String *const pkText, eC_Value &vWidth, eC_Value &vHeight)
virtual void UnloadImg(const ImageResource_t &eID)
Definition: GfxWrap.h:1230
void SetFontSpacing(const eC_Float &fSpacing)
virtual void ClearInvalidRect()
Definition: GfxWrap.h:430
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:1135
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:1404
CGUICommonEnums::ImageType_t GetScreenFormat() const
Definition: GfxWrap.h:180
CGfxEnv * m_pkGfxEnv
pointer to the graphics-environment
Definition: GfxWrap.h:1401
eC_UInt m_uiScreenHeight
Screen height.
Definition: GfxWrap.h:1376
eC_TListDoubleLinked< CGUIRect > m_kLastFrameInvalidatedRectList
This is the list of regions which have been invalidated during the LAST frame.
Definition: GfxWrap.h:1382
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:127
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:1379
virtual void SyncWorkingMemory()
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:225
void SetForegroundColor(const eC_UByte &ubRed, const eC_UByte &ubGreen, const eC_UByte &ubBlue, const eC_UByte &ubAlpha=255)
Definition: GfxWrap.h:210
virtual void ResetWorkingMemory()
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:1395
eC_UInt GetImgWidth(const ImageResource_t &eID) const
void SetDoubleBufferingEnforcesFlipping(const eC_Bool bDoubleBufferingEnforcesFlipping)
Definition: GfxWrap.h:903
virtual eC_UInt GetImageSize(const ImageResource_t &eID) const =0
void SetScreenFormat(const CGUICommonEnums::ImageType_t &uiScreenFormat)
Definition: GfxWrap.h:185
static const eC_Value cvTwoPi
constant for 2 PI
Definition: GfxWrap.h:1440
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:273
eC_Bool m_bFilteredBlit
if filtered blit is active
Definition: GfxWrap.h:1437
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:268
friend class CGUIBackgroundImageLoaderThread
Definition: GfxWrap.h:86
eC_UByte ApplyGlobalAlpha(const eC_UByte ubAlpha) const
Definition: GfxWrap.h:280
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:1152
virtual void ReleaseWorkingMemory(eC_UByte *pkMemory)
virtual eC_UInt GetPhysicalScreenHeight()=0
void LoadFont(const FontResource_t &eFontID)
eC_Value m_vRenderingOffsetY
offset in y-direction
Definition: GfxWrap.h:1428
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:195
virtual eC_UByte * GetWorkingMemory(const eC_UInt &uiSize)
eC_Int GetInternalLeading() const
void SetFont(const FontResource_t &eID)
GUIBitmapPlaneID_t GetUsedBitmapPlaneID() const
Definition: GfxWrap.h:718
eC_Value m_vRenderingOffsetX
offset in x-direction
Definition: GfxWrap.h:1426
eC_Bool m_bInvalidationInLastFrame
Definition: GfxWrap.h:1420
void InvalidateRect(const CGUIRect &kInvalidRect)
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:418
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:1141
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:1138
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:1410
void UpdateGlobalAlpha(const eC_UByte &ubAlpha)
Definition: GfxWrap.h:242
void LoadImg(const eC_String &kPath, const ImageResource_t &eID)
eC_String m_kWrapperName
name of the wrapper
Definition: GfxWrap.h:1431
virtual eC_TArray< eC_UByte > * GetBitmapPlaneData(const GUIBitmapPlaneID_t &eBitmapPlaneID)
virtual eC_UInt GetNOFImages()
Definition: GfxWrap.h:867
eC_Int GetAscender() const
virtual eC_UInt GetScreenHorizontalPPI() const
Definition: GfxWrap.h:175
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:1391
eC_Value m_vLineWidth
Line width in pixels.
Definition: GfxWrap.h:1398
RefreshCall_t
Definition: GfxWrap.h:109
@ LAST_REFRESH_OF_FRAME
The last refresh call in this frame.
Definition: GfxWrap.h:113
@ INTERMEDIATE_REFRESH
Any Refresh between the first and the last call.
Definition: GfxWrap.h:112
@ FORCED_REFRESH
Refresh was forced. A refresh of this type is used in addition to one of the others,...
Definition: GfxWrap.h:114
@ SINGLE_REFRESH
Only one refresh in this frame. So it is the first and the last call.
Definition: GfxWrap.h:110
@ FIRST_REFRESH_OF_FRAME
The first refresh call in this frame.
Definition: GfxWrap.h:111
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:953
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:1414
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:644
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:945
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:458
CGfxWrap()
Constructor.
eC_UInt GetImgHeight(const ImageResource_t &eID) const
eC_UInt m_uiColor
Currently set foreground color.
Definition: GfxWrap.h:1407
void InvalidateRect(const eC_Value &vAbsX1, const eC_Value &vAbsY1, const eC_Value &vAbsX2, const eC_Value &vAbsY2)
Definition: GfxWrap.h:408
static void DeleteInstance()
Delete the graphics wrapper instance.
void ResetInvalidatedRect()
Resets the invalidated rectangle.
eC_String GetWrapperName() const
Definition: GfxWrap.h:937
virtual void RefreshImage(const ImageResource_t &eID, void *pkMemory)
Definition: GfxWrap.h:1223
Definition: FntWrap.h:60