]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/HiiImage.h
MdePkg: Apply uncrustify changes
[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/// Flags in EFI_IMAGE_INPUT\r
24///\r
25#define EFI_IMAGE_TRANSPARENT 0x00000001\r
26\r
27/**\r
28\r
29 Definition of EFI_IMAGE_INPUT.\r
30\r
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
35 @param Width Image width, in pixels.\r
36\r
37 @param Height Image height, in pixels.\r
38\r
39 @param Bitmap A pointer to the actual bitmap, organized left-to-right,\r
40 top-to-bottom. The size of the bitmap is\r
41 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).\r
42\r
43\r
44**/\r
45typedef struct _EFI_IMAGE_INPUT {\r
46 UINT32 Flags;\r
47 UINT16 Width;\r
48 UINT16 Height;\r
49 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r
50} EFI_IMAGE_INPUT;\r
51\r
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
58 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
59\r
60 @param PackageList Handle of the package list where this image will be added.\r
61\r
62 @param ImageId On return, contains the new image id, which is\r
63 unique within PackageList.\r
64\r
65 @param Image Points to the image.\r
66\r
67 @retval EFI_SUCCESS The new image was added\r
68 successfully\r
69\r
70 @retval EFI_OUT_OF_RESOURCES Could not add the image.\r
71\r
72 @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is\r
73 NULL.\r
74\r
75\r
76**/\r
77typedef\r
78EFI_STATUS\r
79(EFIAPI *EFI_HII_NEW_IMAGE)(\r
80 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
81 IN EFI_HII_HANDLE PackageList,\r
82 OUT EFI_IMAGE_ID *ImageId,\r
83 IN CONST EFI_IMAGE_INPUT *Image\r
84 );\r
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
98 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
99\r
100 @param PackageList The package list in the HII database to\r
101 search for the specified image.\r
102\r
103 @param ImageId The image's id, which is unique within\r
104 PackageList.\r
105\r
106 @param Image Points to the new image.\r
107\r
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
112\r
113 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r
114 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not\r
115 enough memory.\r
116\r
117\r
118**/\r
119typedef\r
120EFI_STATUS\r
121(EFIAPI *EFI_HII_GET_IMAGE)(\r
122 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
123 IN EFI_HII_HANDLE PackageList,\r
124 IN EFI_IMAGE_ID ImageId,\r
125 OUT EFI_IMAGE_INPUT *Image\r
126 );\r
127\r
128/**\r
129\r
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
134 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
135\r
136 @param PackageList The package list containing the images.\r
137\r
138 @param ImageId The image id, which is unique within PackageList.\r
139\r
140 @param Image Points to the image.\r
141\r
142 @retval EFI_SUCCESS The image was successfully updated.\r
143\r
144 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.\r
145 The specified PackageList is not in the database.\r
146\r
147 @retval EFI_INVALID_PARAMETER The Image or Language was NULL.\r
148\r
149**/\r
150typedef\r
151EFI_STATUS\r
152(EFIAPI *EFI_HII_SET_IMAGE)(\r
153 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
154 IN EFI_HII_HANDLE PackageList,\r
155 IN EFI_IMAGE_ID ImageId,\r
156 IN CONST EFI_IMAGE_INPUT *Image\r
157 );\r
158\r
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
163typedef UINT32 EFI_HII_DRAW_FLAGS;\r
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
168#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010\r
169#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020\r
170#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
171\r
172/**\r
173\r
174 Definition of EFI_IMAGE_OUTPUT.\r
175\r
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
187typedef struct _EFI_IMAGE_OUTPUT {\r
188 UINT16 Width;\r
189 UINT16 Height;\r
190 union {\r
191 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r
192 EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen;\r
193 } Image;\r
194} EFI_IMAGE_OUTPUT;\r
195\r
196/**\r
197\r
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
204 then all 'off' pixels in the images drawn will use the\r
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
212 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
213\r
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
217\r
218 @param Image Points to the image to be displayed.\r
219\r
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
228\r
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
232\r
233 @retval EFI_SUCCESS The image was successfully updated.\r
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
243typedef\r
244EFI_STATUS\r
245(EFIAPI *EFI_HII_DRAW_IMAGE)(\r
246 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
247 IN EFI_HII_DRAW_FLAGS Flags,\r
248 IN CONST EFI_IMAGE_INPUT *Image,\r
249 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
250 IN UINTN BltX,\r
251 IN UINTN BltY\r
252 );\r
253\r
254/**\r
255\r
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
276 will be drawn so that all 'off' pixels in the image will\r
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
279 the image's pixels will be copied directly to the\r
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
282 image's transparency setting (see EFI_IMAGE_TRANSPARENT).\r
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
288 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.\r
289\r
290 @param Flags Describes how the image is to be drawn.\r
291\r
292 @param PackageList The package list in the HII database to\r
293 search for the specified image.\r
294\r
295 @param ImageId The image's id, which is unique within PackageList.\r
296\r
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
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
310 @retval EFI_SUCCESS The image was successfully updated.\r
311\r
312 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r
313 buffer for RowInfoArray or Blt.\r
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
319\r
320**/\r
321typedef\r
322EFI_STATUS\r
323(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(\r
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
332\r
333///\r
334/// Services to access to images in the images database.\r
335///\r
336struct _EFI_HII_IMAGE_PROTOCOL {\r
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
342};\r
343\r
344extern EFI_GUID gEfiHiiImageProtocolGuid;\r
345\r
346#endif\r