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