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