]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/HiiImage.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / HiiImage.h
... / ...
CommitLineData
1/** @file\r
2 The file provides services to access to images in the images database.\r
3\r
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7 @par Revision Reference:\r
8 This Protocol was introduced in UEFI Specification 2.1.\r
9\r
10**/\r
11\r
12#ifndef __HII_IMAGE_H__\r
13#define __HII_IMAGE_H__\r
14\r
15#include <Protocol/GraphicsOutput.h>\r
16\r
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
23///\r
24/// Flags in EFI_IMAGE_INPUT\r
25///\r
26#define EFI_IMAGE_TRANSPARENT 0x00000001\r
27\r
28/**\r
29\r
30 Definition of EFI_IMAGE_INPUT.\r
31\r
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
36 @param Width Image width, in pixels.\r
37\r
38 @param Height Image height, in pixels.\r
39\r
40 @param Bitmap A pointer to the actual bitmap, organized left-to-right,\r
41 top-to-bottom. The size of the bitmap is\r
42 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).\r
43\r
44\r
45**/\r
46typedef struct _EFI_IMAGE_INPUT {\r
47 UINT32 Flags;\r
48 UINT16 Width;\r
49 UINT16 Height;\r
50 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r
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
60 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
61\r
62 @param PackageList Handle of the package list where this image will be added.\r
63\r
64 @param ImageId On return, contains the new image id, which is\r
65 unique within PackageList.\r
66\r
67 @param Image Points to the image.\r
68\r
69 @retval EFI_SUCCESS The new image was added\r
70 successfully\r
71\r
72 @retval EFI_OUT_OF_RESOURCES Could not add the image.\r
73\r
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
81(EFIAPI *EFI_HII_NEW_IMAGE)(\r
82 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
83 IN EFI_HII_HANDLE PackageList,\r
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
100 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
101\r
102 @param PackageList The package list in the HII database to\r
103 search for the specified image.\r
104\r
105 @param ImageId The image's id, which is unique within\r
106 PackageList.\r
107\r
108 @param Image Points to the new image.\r
109\r
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
114\r
115 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r
116 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not\r
117 enough memory.\r
118\r
119\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_HII_GET_IMAGE)(\r
124 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
125 IN EFI_HII_HANDLE PackageList,\r
126 IN EFI_IMAGE_ID ImageId,\r
127 OUT EFI_IMAGE_INPUT *Image\r
128);\r
129\r
130/**\r
131\r
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
136 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
137\r
138 @param PackageList The package list containing the images.\r
139\r
140 @param ImageId The image id, which is unique within PackageList.\r
141\r
142 @param Image Points to the image.\r
143\r
144 @retval EFI_SUCCESS The image was successfully updated.\r
145\r
146 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.\r
147 The specified PackageList is not in the database.\r
148\r
149 @retval EFI_INVALID_PARAMETER The Image or Language was NULL.\r
150\r
151**/\r
152typedef\r
153EFI_STATUS\r
154(EFIAPI *EFI_HII_SET_IMAGE)(\r
155 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
156 IN EFI_HII_HANDLE PackageList,\r
157 IN EFI_IMAGE_ID ImageId,\r
158 IN CONST EFI_IMAGE_INPUT *Image\r
159);\r
160\r
161\r
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
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
171#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010\r
172#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020\r
173#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
174\r
175/**\r
176\r
177 Definition of EFI_IMAGE_OUTPUT.\r
178\r
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
201\r
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
208 then all 'off' pixels in the images drawn will use the\r
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
216 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
217\r
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
221\r
222 @param Image Points to the image to be displayed.\r
223\r
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
232\r
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
236\r
237 @retval EFI_SUCCESS The image was successfully updated.\r
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
249(EFIAPI *EFI_HII_DRAW_IMAGE)(\r
250 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
251 IN EFI_HII_DRAW_FLAGS Flags,\r
252 IN CONST EFI_IMAGE_INPUT *Image,\r
253 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
254 IN UINTN BltX,\r
255 IN UINTN BltY\r
256);\r
257\r
258/**\r
259\r
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
280 will be drawn so that all 'off' pixels in the image will\r
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
283 the image's pixels will be copied directly to the\r
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
286 image's transparency setting (see EFI_IMAGE_TRANSPARENT).\r
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
292 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
293\r
294 @param Flags Describes how the image is to be drawn.\r
295\r
296 @param PackageList The package list in the HII database to\r
297 search for the specified image.\r
298\r
299 @param ImageId The image's id, which is unique within PackageList.\r
300\r
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
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
314 @retval EFI_SUCCESS The image was successfully updated.\r
315\r
316 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r
317 buffer for RowInfoArray or Blt.\r
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
323\r
324**/\r
325typedef\r
326EFI_STATUS\r
327(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(\r
328IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
329IN EFI_HII_DRAW_FLAGS Flags,\r
330IN EFI_HII_HANDLE PackageList,\r
331IN EFI_IMAGE_ID ImageId,\r
332IN OUT EFI_IMAGE_OUTPUT **Blt,\r
333IN UINTN BltX,\r
334IN UINTN BltY\r
335);\r
336\r
337\r
338///\r
339/// Services to access to images in the images database.\r
340///\r
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
353\r