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