MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / XImage

Class XImage

rEFIt_UEFI/libeg/XImage.h:42–112  ·  view source on GitHub ↗

typedef struct { UINTN Xpos; UINTN Ypos; UINTN Width; UINTN Height; } EgRect; */

Source from the content-addressed store, hash-verified

40} EgRect;
41*/
42class XImage
43{
44protected:
45 size_t Width; //may be better to use INTN - signed integer as it always compared with expressions
46 size_t Height;
47 XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL> PixelData;
48
49public:
50 XImage() : Width(0), Height(0), PixelData() {};
51 XImage(UINTN W, UINTN H);
52 XImage(const XImage& Image, float scale = 0.f); //the constructor can accept 0 scale as 1.f
53 virtual ~XImage();
54
55 XImage& operator= (const XImage& other);
56
57protected:
58 UINTN GetSizeInBytes() const; //in bytes
59
60public:
61
62 void setSizeInPixels(UINTN W, UINTN H);
63
64 const XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL>& GetData() const;
65
66 const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& GetPixel(INTN x, INTN y) const;
67 const EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetPixelPtr(INTN x, INTN y) const ;
68 EFI_GRAPHICS_OUTPUT_BLT_PIXEL* GetPixelPtr(INTN x, INTN y);
69 INTN GetWidth() const { return (INTN)Width; }
70 INTN GetHeight() const { return (INTN)Height; }
71
72 void setZero() { SetMem( (void*)GetPixelPtr(0, 0), GetSizeInBytes(), 0); }
73
74 void setEmpty() { Width=0; Height=0; PixelData.setEmpty(); }
75 bool isEmpty() const { return PixelData.size() == 0; }
76
77
78 void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 });
79 void Fill(const EG_PIXEL* Color);
80 void FillArea(const EG_PIXEL* Color, EG_RECT& Rect);
81 void FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, EG_RECT& Rect);
82 void Copy(XImage* Image);
83 void CopyScaled(const XImage& Image, float scale = 0.f);
84 void CopyRect(const XImage& Image, INTN X, INTN Y);
85 void CopyRect(const XImage& Image, const EG_RECT& OwnPlace, const EG_RECT& InputRect);
86 void Compose(const EG_RECT& OwnPlace, const EG_RECT& InputRect, const XImage& TopImage, bool Lowest, float TopScale = 0.f);
87 void Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest, float topScale = 0); //instead of compose we often can Back.Draw(...) + Top.Draw(...)
88 void FlipRB();
89 EFI_STATUS FromPNG(const UINT8 * Data, UINTN Lenght);
90 EFI_STATUS ToPNG(UINT8** Data, UINTN& OutSize);
91 EFI_STATUS FromSVG(const CHAR8 *SVGData, float scale);
92 EFI_STATUS FromICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize);
93
94 void GetArea(const EG_RECT& Rect);
95 void GetArea(INTN x, INTN y, UINTN W, UINTN H);
96 void Draw(INTN x, INTN y, float scale, bool Opaque);
97 void Draw(INTN x, INTN y, float scale); //can accept 0 scale as 1.f
98 void Draw(INTN x, INTN y);
99 void DrawWithoutCompose(INTN x, INTN y, UINTN width = 0, UINTN height = 0);

Callers 6

FillByEmbeddedMethod · 0.70
ClearScreenMethod · 0.70
ParseSVGXThemeMethod · 0.70
DrawMainMenuEntryMethod · 0.50
loader.cppFile · 0.50
AddLegacyEntryFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected