]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
2 | The file provides services to access to images in the images database.\r | |
d1f95000 | 3 | \r |
9095d37b | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d1f95000 | 6 | \r |
497a5fb1 SZ |
7 | @par Revision Reference:\r |
8 | This Protocol was introduced in UEFI Specification 2.1.\r | |
9 | \r | |
d1f95000 | 10 | **/\r |
11 | \r | |
12 | #ifndef __HII_IMAGE_H__\r | |
13 | #define __HII_IMAGE_H__\r | |
14 | \r | |
8ba83963 RN |
15 | #include <Protocol/GraphicsOutput.h>\r |
16 | \r | |
d1f95000 | 17 | #define EFI_HII_IMAGE_PROTOCOL_GUID \\r |
18 | { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }\r | |
19 | \r | |
20 | typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;\r | |
21 | \r | |
99e8ed21 | 22 | ///\r |
23 | /// Flags in EFI_IMAGE_INPUT\r | |
9095d37b | 24 | ///\r |
2f88bd3a | 25 | #define EFI_IMAGE_TRANSPARENT 0x00000001\r |
d1f95000 | 26 | \r |
27 | /**\r | |
9095d37b | 28 | \r |
d1f95000 | 29 | Definition of EFI_IMAGE_INPUT.\r |
9095d37b | 30 | \r |
d1f95000 | 31 | @param Flags Describe image characteristics. If\r |
32 | EFI_IMAGE_TRANSPARENT is set, then the image was\r | |
33 | designed for transparent display.\r | |
34 | \r | |
9095d37b | 35 | @param Width Image width, in pixels.\r |
d1f95000 | 36 | \r |
37 | @param Height Image height, in pixels.\r | |
38 | \r | |
11ca63ec | 39 | @param Bitmap A pointer to the actual bitmap, organized left-to-right,\r |
d1f95000 | 40 | top-to-bottom. The size of the bitmap is\r |
41 | Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).\r | |
42 | \r | |
9095d37b | 43 | \r |
d1f95000 | 44 | **/\r |
45 | typedef struct _EFI_IMAGE_INPUT {\r | |
2f88bd3a MK |
46 | UINT32 Flags;\r |
47 | UINT16 Width;\r | |
48 | UINT16 Height;\r | |
49 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r | |
d1f95000 | 50 | } EFI_IMAGE_INPUT;\r |
51 | \r | |
d1f95000 | 52 | /**\r |
53 | \r | |
54 | This function adds the image Image to the group of images\r | |
55 | owned by PackageList, and returns a new image identifier\r | |
56 | (ImageId).\r | |
57 | \r | |
9095d37b LG |
58 | @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r |
59 | \r | |
4ca9b6c4 | 60 | @param PackageList Handle of the package list where this image will be added.\r |
d1f95000 | 61 | \r |
4ca9b6c4 LG |
62 | @param ImageId On return, contains the new image id, which is\r |
63 | unique within PackageList.\r | |
d1f95000 | 64 | \r |
4ca9b6c4 | 65 | @param Image Points to the image.\r |
d1f95000 | 66 | \r |
67 | @retval EFI_SUCCESS The new image was added\r | |
68 | successfully\r | |
9095d37b | 69 | \r |
d1f95000 | 70 | @retval EFI_OUT_OF_RESOURCES Could not add the image.\r |
9095d37b | 71 | \r |
d1f95000 | 72 | @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is\r |
73 | NULL.\r | |
74 | \r | |
75 | \r | |
76 | **/\r | |
77 | typedef\r | |
78 | EFI_STATUS\r | |
8b13229b | 79 | (EFIAPI *EFI_HII_NEW_IMAGE)(\r |
d1f95000 | 80 | IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r |
7d582d6b | 81 | IN EFI_HII_HANDLE PackageList,\r |
d1f95000 | 82 | OUT EFI_IMAGE_ID *ImageId,\r |
83 | IN CONST EFI_IMAGE_INPUT *Image\r | |
2f88bd3a | 84 | );\r |
d1f95000 | 85 | \r |
86 | /**\r | |
87 | \r | |
88 | This function retrieves the image specified by ImageId which\r | |
89 | is associated with the specified PackageList and copies it\r | |
90 | into the buffer specified by Image. If the image specified by\r | |
91 | ImageId is not present in the specified PackageList, then\r | |
92 | EFI_NOT_FOUND is returned. If the buffer specified by\r | |
93 | ImageSize is too small to hold the image, then\r | |
94 | EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be\r | |
95 | updated to the size of buffer actually required to hold the\r | |
96 | image.\r | |
97 | \r | |
9095d37b LG |
98 | @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r |
99 | \r | |
d1f95000 | 100 | @param PackageList The package list in the HII database to\r |
101 | search for the specified image.\r | |
9095d37b | 102 | \r |
4ca9b6c4 LG |
103 | @param ImageId The image's id, which is unique within\r |
104 | PackageList.\r | |
9095d37b | 105 | \r |
4ca9b6c4 | 106 | @param Image Points to the new image.\r |
9095d37b | 107 | \r |
4ca9b6c4 LG |
108 | @retval EFI_SUCCESS The image was returned successfully.\r |
109 | \r | |
110 | @retval EFI_NOT_FOUND The image specified by ImageId is not\r | |
111 | available. Or The specified PackageList is not in the database.\r | |
9095d37b | 112 | \r |
4ca9b6c4 | 113 | @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r |
54cf8780 | 114 | @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not\r |
4ca9b6c4 | 115 | enough memory.\r |
d1f95000 | 116 | \r |
117 | \r | |
118 | **/\r | |
119 | typedef\r | |
120 | EFI_STATUS\r | |
8b13229b | 121 | (EFIAPI *EFI_HII_GET_IMAGE)(\r |
d1f95000 | 122 | IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r |
7d582d6b | 123 | IN EFI_HII_HANDLE PackageList,\r |
124 | IN EFI_IMAGE_ID ImageId,\r | |
54cf8780 | 125 | OUT EFI_IMAGE_INPUT *Image\r |
2f88bd3a | 126 | );\r |
d1f95000 | 127 | \r |
128 | /**\r | |
9095d37b | 129 | \r |
d1f95000 | 130 | This function updates the image specified by ImageId in the\r |
131 | specified PackageListHandle to the image specified by Image.\r | |
132 | \r | |
133 | \r | |
9095d37b | 134 | @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r |
d1f95000 | 135 | \r |
136 | @param PackageList The package list containing the images.\r | |
137 | \r | |
4ca9b6c4 | 138 | @param ImageId The image id, which is unique within PackageList.\r |
d1f95000 | 139 | \r |
4ca9b6c4 | 140 | @param Image Points to the image.\r |
d1f95000 | 141 | \r |
4ca9b6c4 | 142 | @retval EFI_SUCCESS The image was successfully updated.\r |
9095d37b | 143 | \r |
4ca9b6c4 | 144 | @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.\r |
9095d37b LG |
145 | The specified PackageList is not in the database.\r |
146 | \r | |
4ca9b6c4 | 147 | @retval EFI_INVALID_PARAMETER The Image or Language was NULL.\r |
d1f95000 | 148 | \r |
149 | **/\r | |
150 | typedef\r | |
151 | EFI_STATUS\r | |
8b13229b | 152 | (EFIAPI *EFI_HII_SET_IMAGE)(\r |
d1f95000 | 153 | IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r |
7d582d6b | 154 | IN EFI_HII_HANDLE PackageList,\r |
155 | IN EFI_IMAGE_ID ImageId,\r | |
156 | IN CONST EFI_IMAGE_INPUT *Image\r | |
2f88bd3a | 157 | );\r |
d1f95000 | 158 | \r |
992f22b9 LG |
159 | ///\r |
160 | /// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.\r | |
161 | /// These flags are defined as EFI_HII_DRAW_FLAG_***\r | |
162 | ///\r | |
2f88bd3a | 163 | typedef UINT32 EFI_HII_DRAW_FLAGS;\r |
d1f95000 | 164 | \r |
165 | #define EFI_HII_DRAW_FLAG_CLIP 0x00000001\r | |
166 | #define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030\r | |
167 | #define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000\r | |
54cf8780 | 168 | #define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010\r |
169 | #define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020\r | |
d1f95000 | 170 | #define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r |
171 | \r | |
d1f95000 | 172 | /**\r |
9095d37b | 173 | \r |
d1f95000 | 174 | Definition of EFI_IMAGE_OUTPUT.\r |
9095d37b | 175 | \r |
d1f95000 | 176 | @param Width Width of the output image.\r |
177 | \r | |
178 | @param Height Height of the output image.\r | |
179 | \r | |
180 | @param Bitmap Points to the output bitmap.\r | |
181 | \r | |
182 | @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which\r | |
183 | describes the screen on which to draw the\r | |
184 | specified image.\r | |
185 | \r | |
186 | **/\r | |
187 | typedef struct _EFI_IMAGE_OUTPUT {\r | |
2f88bd3a MK |
188 | UINT16 Width;\r |
189 | UINT16 Height;\r | |
d1f95000 | 190 | union {\r |
2f88bd3a MK |
191 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r |
192 | EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen;\r | |
d1f95000 | 193 | } Image;\r |
194 | } EFI_IMAGE_OUTPUT;\r | |
195 | \r | |
d1f95000 | 196 | /**\r |
9095d37b | 197 | \r |
d1f95000 | 198 | This function renders an image to a bitmap or the screen using\r |
199 | the specified color and options. It draws the image on an\r | |
200 | existing bitmap, allocates a new bitmap or uses the screen. The\r | |
201 | images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r | |
202 | all pixels drawn outside the bounding box specified by Width and\r | |
203 | Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,\r | |
4ca9b6c4 | 204 | then all 'off' pixels in the images drawn will use the\r |
d1f95000 | 205 | pixel value from Blt. This flag cannot be used if Blt is NULL\r |
206 | upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image\r | |
207 | will be written directly to the output device specified by\r | |
208 | Screen. Otherwise the image will be rendered to the bitmap\r | |
209 | specified by Bitmap.\r | |
210 | \r | |
211 | \r | |
9095d37b LG |
212 | @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r |
213 | \r | |
4ca9b6c4 LG |
214 | @param Flags Describes how the image is to be drawn.\r |
215 | EFI_HII_DRAW_FLAGS is defined in Related\r | |
216 | Definitions, below.\r | |
9095d37b LG |
217 | \r |
218 | @param Image Points to the image to be displayed.\r | |
219 | \r | |
4ca9b6c4 LG |
220 | @param Blt If this points to a non-NULL on entry, this points\r |
221 | to the image, which is Width pixels wide and\r | |
222 | Height pixels high. The image will be drawn onto\r | |
223 | this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r | |
224 | If this points to a NULL on entry, then a buffer\r | |
225 | will be allocated to hold the generated image and\r | |
226 | the pointer updated on exit. It is the caller's\r | |
227 | responsibility to free this buffer.\r | |
d1f95000 | 228 | \r |
4ca9b6c4 LG |
229 | @param BltX, BltY Specifies the offset from the left and top\r |
230 | edge of the image of the first pixel in\r | |
231 | the image.\r | |
d1f95000 | 232 | \r |
4ca9b6c4 | 233 | @retval EFI_SUCCESS The image was successfully updated.\r |
d1f95000 | 234 | \r |
235 | @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r | |
236 | buffer for RowInfoArray or Blt.\r | |
237 | \r | |
238 | @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r | |
239 | Width was NULL.\r | |
240 | \r | |
241 | \r | |
242 | **/\r | |
243 | typedef\r | |
244 | EFI_STATUS\r | |
8b13229b | 245 | (EFIAPI *EFI_HII_DRAW_IMAGE)(\r |
d1f95000 | 246 | IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r |
7d582d6b | 247 | IN EFI_HII_DRAW_FLAGS Flags,\r |
248 | IN CONST EFI_IMAGE_INPUT *Image,\r | |
d1f95000 | 249 | IN OUT EFI_IMAGE_OUTPUT **Blt,\r |
7d582d6b | 250 | IN UINTN BltX,\r |
251 | IN UINTN BltY\r | |
2f88bd3a | 252 | );\r |
d1f95000 | 253 | \r |
254 | /**\r | |
9095d37b | 255 | \r |
d1f95000 | 256 | This function renders an image as a bitmap or to the screen and\r |
257 | can clip the image. The bitmap is either supplied by the caller\r | |
258 | or else is allocated by the function. The images can be drawn\r | |
259 | transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,\r | |
260 | then all pixels drawn outside the bounding box specified by\r | |
261 | Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT\r | |
262 | is set, then all "off" pixels in the character's glyph will\r | |
263 | use the pixel value from Blt. This flag cannot be used if Blt\r | |
264 | is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then\r | |
265 | the image will be written directly to the output device\r | |
266 | specified by Screen. Otherwise the image will be rendered to\r | |
267 | the bitmap specified by Bitmap.\r | |
268 | This function renders an image to a bitmap or the screen using\r | |
269 | the specified color and options. It draws the image on an\r | |
270 | existing bitmap, allocates a new bitmap or uses the screen. The\r | |
271 | images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r | |
272 | all pixels drawn outside the bounding box specified by Width and\r | |
273 | Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag\r | |
274 | determines whether the image will be drawn transparent or\r | |
275 | opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image\r | |
4ca9b6c4 | 276 | will be drawn so that all 'off' pixels in the image will\r |
d1f95000 | 277 | be drawn using the pixel value from Blt and all other pixels\r |
278 | will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then\r | |
4ca9b6c4 | 279 | the image's pixels will be copied directly to the\r |
d1f95000 | 280 | destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image\r |
281 | will be drawn transparently or opaque, depending on the\r | |
4ca9b6c4 | 282 | image's transparency setting (see EFI_IMAGE_TRANSPARENT).\r |
d1f95000 | 283 | Images cannot be drawn transparently if Blt is NULL. If\r |
284 | EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written\r | |
285 | directly to the output device specified by Screen. Otherwise the\r | |
286 | image will be rendered to the bitmap specified by Bitmap.\r | |
287 | \r | |
9095d37b | 288 | @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r |
d1f95000 | 289 | \r |
4ca9b6c4 | 290 | @param Flags Describes how the image is to be drawn.\r |
d1f95000 | 291 | \r |
292 | @param PackageList The package list in the HII database to\r | |
293 | search for the specified image.\r | |
294 | \r | |
4ca9b6c4 | 295 | @param ImageId The image's id, which is unique within PackageList.\r |
d1f95000 | 296 | \r |
4ca9b6c4 LG |
297 | @param Blt If this points to a non-NULL on entry, this points\r |
298 | to the image, which is Width pixels wide and\r | |
299 | Height pixels high. The image will be drawn onto\r | |
300 | this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r | |
301 | If this points to a NULL on entry, then a buffer\r | |
302 | will be allocated to hold the generated image and\r | |
303 | the pointer updated on exit. It is the caller's\r | |
304 | responsibility to free this buffer.\r | |
d1f95000 | 305 | \r |
306 | @param BltX, BltY Specifies the offset from the left and top\r | |
307 | edge of the output image of the first\r | |
308 | pixel in the image.\r | |
309 | \r | |
4ca9b6c4 | 310 | @retval EFI_SUCCESS The image was successfully updated.\r |
9095d37b | 311 | \r |
d1f95000 | 312 | @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r |
313 | buffer for RowInfoArray or Blt.\r | |
9095d37b LG |
314 | \r |
315 | @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.\r | |
316 | Or The specified PackageList is not in the database.\r | |
317 | \r | |
318 | @retval EFI_INVALID_PARAMETER The Blt was NULL.\r | |
d1f95000 | 319 | \r |
320 | **/\r | |
321 | typedef\r | |
322 | EFI_STATUS\r | |
8b13229b | 323 | (EFIAPI *EFI_HII_DRAW_IMAGE_ID)(\r |
2f88bd3a MK |
324 | IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r |
325 | IN EFI_HII_DRAW_FLAGS Flags,\r | |
326 | IN EFI_HII_HANDLE PackageList,\r | |
327 | IN EFI_IMAGE_ID ImageId,\r | |
328 | IN OUT EFI_IMAGE_OUTPUT **Blt,\r | |
329 | IN UINTN BltX,\r | |
330 | IN UINTN BltY\r | |
331 | );\r | |
d1f95000 | 332 | \r |
44717a39 | 333 | ///\r |
334 | /// Services to access to images in the images database.\r | |
335 | ///\r | |
d1f95000 | 336 | struct _EFI_HII_IMAGE_PROTOCOL {\r |
2f88bd3a MK |
337 | EFI_HII_NEW_IMAGE NewImage;\r |
338 | EFI_HII_GET_IMAGE GetImage;\r | |
339 | EFI_HII_SET_IMAGE SetImage;\r | |
340 | EFI_HII_DRAW_IMAGE DrawImage;\r | |
341 | EFI_HII_DRAW_IMAGE_ID DrawImageId;\r | |
d1f95000 | 342 | };\r |
343 | \r | |
2f88bd3a | 344 | extern EFI_GUID gEfiHiiImageProtocolGuid;\r |
d1f95000 | 345 | \r |
346 | #endif\r |