]>
code.delx.au - refind/blob - libeg/libeg.h
3 * EFI graphics library header for users
5 * Copyright (c) 2006 Christoph Pfisterer
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
20 * * Neither the name of Christoph Pfisterer nor the names of the
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #ifndef __LIBEG_LIBEG_H__
38 #define __LIBEG_LIBEG_H__
40 #ifndef __MAKEWITH_GNUEFI
41 #include "../include/tiano_includes.h"
46 typedef enum ColorTypes
{
51 /* This should be compatible with EFI_UGA_PIXEL */
63 #define EG_EIPIXELMODE_GRAY (0)
64 #define EG_EIPIXELMODE_GRAY_ALPHA (1)
65 #define EG_EIPIXELMODE_COLOR (2)
66 #define EG_EIPIXELMODE_COLOR_ALPHA (3)
67 #define EG_EIPIXELMODE_ALPHA (4)
68 #define EG_MAX_EIPIXELMODE EG_EIPIXELMODE_ALPHA
70 #define EG_EICOMPMODE_NONE (0)
71 #define EG_EICOMPMODE_RLE (1)
72 #define EG_EICOMPMODE_EFICOMPRESS (2)
74 #define ICON_EXTENSIONS L"icns,png"
87 VOID
egInitScreen(VOID
);
88 BOOLEAN
egGetResFromMode(UINTN
*ModeWidth
, UINTN
*Height
);
89 VOID
egGetScreenSize(OUT UINTN
*ScreenWidth
, OUT UINTN
*ScreenHeight
);
90 CHAR16
* egScreenDescription(VOID
);
91 BOOLEAN
egHasGraphicsMode(VOID
);
92 BOOLEAN
egIsGraphicsModeEnabled(VOID
);
93 VOID
egSetGraphicsModeEnabled(IN BOOLEAN Enable
);
94 // NOTE: Even when egHasGraphicsMode() returns FALSE, you should
95 // call egSetGraphicsModeEnabled(FALSE) to ensure the system
96 // is running in text mode. egHasGraphicsMode() only determines
97 // if libeg can draw to the screen in graphics mode.
99 EG_IMAGE
* egCreateImage(IN UINTN Width
, IN UINTN Height
, IN BOOLEAN HasAlpha
);
100 EG_IMAGE
* egCreateFilledImage(IN UINTN Width
, IN UINTN Height
, IN BOOLEAN HasAlpha
, IN EG_PIXEL
*Color
);
101 EG_IMAGE
* egCopyImage(IN EG_IMAGE
*Image
);
102 EG_IMAGE
* egCropImage(IN EG_IMAGE
*Image
, IN UINTN StartX
, IN UINTN StartY
, IN UINTN Width
, IN UINTN Height
);
103 VOID
egFreeImage(IN EG_IMAGE
*Image
);
105 EG_IMAGE
* egLoadImage(IN EFI_FILE
* BaseDir
, IN CHAR16
*FileName
, IN BOOLEAN WantAlpha
);
106 EG_IMAGE
* egLoadIcon(IN EFI_FILE
* BaseDir
, IN CHAR16
*FileName
, IN UINTN IconSize
);
107 EG_IMAGE
* egLoadIconAnyType(IN EFI_FILE
*BaseDir
, IN CHAR16
*SubdirName
, IN CHAR16
*BaseName
, IN UINTN IconSize
);
108 EG_IMAGE
* egFindIcon(IN CHAR16
*BaseName
, IN UINTN IconSize
);
109 EG_IMAGE
* egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE
*EmbeddedImage
, IN BOOLEAN WantAlpha
);
111 EG_IMAGE
* egEnsureImageSize(IN EG_IMAGE
*Image
, IN UINTN Width
, IN UINTN Height
, IN EG_PIXEL
*Color
);
113 EFI_STATUS
egLoadFile(IN EFI_FILE
* BaseDir
, IN CHAR16
*FileName
,
114 OUT UINT8
**FileData
, OUT UINTN
*FileDataLength
);
115 EFI_STATUS
egFindESP(OUT EFI_FILE_HANDLE
*RootDir
);
116 EFI_STATUS
egSaveFile(IN EFI_FILE
* BaseDir OPTIONAL
, IN CHAR16
*FileName
,
117 IN UINT8
*FileData
, IN UINTN FileDataLength
);
119 VOID
egFillImage(IN OUT EG_IMAGE
*CompImage
, IN EG_PIXEL
*Color
);
120 VOID
egFillImageArea(IN OUT EG_IMAGE
*CompImage
,
121 IN UINTN AreaPosX
, IN UINTN AreaPosY
,
122 IN UINTN AreaWidth
, IN UINTN AreaHeight
,
124 VOID
egComposeImage(IN OUT EG_IMAGE
*CompImage
, IN EG_IMAGE
*TopImage
, IN UINTN PosX
, IN UINTN PosY
);
126 UINTN
egGetFontHeight(VOID
);
127 UINTN
egGetFontCellWidth(VOID
);
128 UINTN
egComputeTextWidth(IN CHAR16
*Text
);
129 VOID
egMeasureText(IN CHAR16
*Text
, OUT UINTN
*Width
, OUT UINTN
*Height
);
130 VOID
egRenderText(IN CHAR16
*Text
, IN OUT EG_IMAGE
*CompImage
, IN UINTN PosX
, IN UINTN PosY
, IN UINT8 BGBrightness
);
131 VOID
egLoadFont(IN CHAR16
*Filename
);
133 VOID
egClearScreen(IN EG_PIXEL
*Color
);
134 VOID
egDrawImage(IN EG_IMAGE
*Image
, IN UINTN ScreenPosX
, IN UINTN ScreenPosY
);
135 VOID
egDrawImageWithTransparency(EG_IMAGE
*Image
, EG_IMAGE
*BadgeImage
, UINTN XPos
, UINTN YPos
, UINTN Width
, UINTN Height
);
136 VOID
egDrawImageArea(IN EG_IMAGE
*Image
,
137 IN UINTN AreaPosX
, IN UINTN AreaPosY
,
138 IN UINTN AreaWidth
, IN UINTN AreaHeight
,
139 IN UINTN ScreenPosX
, IN UINTN ScreenPosY
);
140 VOID
egDisplayMessage(IN CHAR16
*Text
, EG_PIXEL
*BGColor
);
141 EG_IMAGE
* egCopyScreen(VOID
);
142 VOID
egScreenShot(VOID
);
143 BOOLEAN
egSetTextMode(UINT32 RequestedMode
);
145 EG_IMAGE
* egDecodePNG(IN UINT8
*FileData
, IN UINTN FileDataLength
, IN UINTN IconSize
, IN BOOLEAN WantAlpha
);
147 #endif /* __LIBEG_LIBEG_H__ */