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