]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/HiiImage.h
UEFI HII: Merge UEFI HII support changes from branch.
[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
4 Copyright (c) 2006 - 2007, Intel Corporation\r
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
51 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Bitmap[1];\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
112 @param ImageSize On entry, points to the size of the buffer\r
113 pointed to by Image, in bytes. On return,\r
114 points to the length of the image, in bytes.\r
115 \r
116 \r
117 @retval EFI_SUCCESS The image was returned successfully.\r
118 \r
119 @retval EFI_NOT_FOUND The image specified by ImageId is not\r
120 available.\r
121 \r
122 @retval EFI_BUFFER_TOO_SMALL The buffer specified by\r
123 ImageLength is too small to hold\r
124 the image.\r
125 \r
126 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r
127\r
128\r
129**/\r
130typedef\r
131EFI_STATUS\r
132(EFIAPI *EFI_HII_GET_IMAGE) (\r
133 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
7d582d6b 134 IN EFI_HII_HANDLE PackageList,\r
135 IN EFI_IMAGE_ID ImageId,\r
d1f95000 136 OUT EFI_IMAGE_INPUT *Image,\r
137 OUT UINTN *ImageSize\r
138);\r
139\r
140/**\r
141 \r
142 This function updates the image specified by ImageId in the\r
143 specified PackageListHandle to the image specified by Image.\r
144\r
145\r
146 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL\r
147 instance.\r
148\r
149 @param PackageList The package list containing the images.\r
150\r
151 @param ImageId The image id, which is unique within\r
152 PackageList.\r
153\r
154 @param Image Points to the image.\r
155\r
156 @retval EFI_SUCCESS The image was successfully updated.\r
157 \r
158 @retval EFI_NOT_FOUND The image specified by ImageId is not\r
159 in the database.\r
160 \r
161 @retval EFI_INVALID_PARAMETER The Image or Language was\r
162 NULL.\r
163\r
164**/\r
165typedef\r
166EFI_STATUS\r
167(EFIAPI *EFI_HII_SET_IMAGE) (\r
168 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
7d582d6b 169 IN EFI_HII_HANDLE PackageList,\r
170 IN EFI_IMAGE_ID ImageId,\r
171 IN CONST EFI_IMAGE_INPUT *Image\r
d1f95000 172);\r
173\r
174\r
175//\r
176// EFI_HII_DRAW_FLAGS\r
177// \r
178typedef UINT32 EFI_HII_DRAW_FLAGS;\r
179\r
180#define EFI_HII_DRAW_FLAG_CLIP 0x00000001\r
181#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030\r
182#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000\r
183#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000001\r
184#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000002\r
185#define EFI_HII_DIRECT_TO_SCREEN 0x00000080\r
186\r
187\r
188/**\r
189 \r
190 Definition of EFI_IMAGE_OUTPUT.\r
191 \r
192 @param Width Width of the output image.\r
193\r
194 @param Height Height of the output image.\r
195\r
196 @param Bitmap Points to the output bitmap.\r
197\r
198 @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which\r
199 describes the screen on which to draw the\r
200 specified image.\r
201\r
202**/\r
203typedef struct _EFI_IMAGE_OUTPUT {\r
204 UINT16 Width;\r
205 UINT16 Height;\r
206 union {\r
207 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r
208 EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen;\r
209 } Image;\r
210} EFI_IMAGE_OUTPUT;\r
211\r
212\r
213/**\r
214 \r
215 This function renders an image to a bitmap or the screen using\r
216 the specified color and options. It draws the image on an\r
217 existing bitmap, allocates a new bitmap or uses the screen. The\r
218 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r
219 all pixels drawn outside the bounding box specified by Width and\r
220 Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,\r
221 then all ????off???? pixels in the images drawn will use the\r
222 pixel value from Blt. This flag cannot be used if Blt is NULL\r
223 upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image\r
224 will be written directly to the output device specified by\r
225 Screen. Otherwise the image will be rendered to the bitmap\r
226 specified by Bitmap.\r
227\r
228\r
229 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL\r
230 instance.\r
231 \r
232 @param Flags Describes how the image is to be drawn.\r
233 EFI_HII_DRAW_FLAGS is defined in Related\r
234 Definitions, below.\r
235 \r
236 @param Image Points to the image to be displayed. \r
237 \r
238 @param Blt If this points to a non-NULL on entry, this points\r
239 to the image, which is Width pixels wide and\r
240 Height pixels high. The image will be drawn onto\r
241 this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r
242 If this points to a NULL on entry, then a buffer\r
243 will be allocated to hold the generated image and\r
244 the pointer updated on exit. It is the caller????s\r
245 responsibility to free this buffer.\r
246\r
247 @param BltX, BltY Specifies the offset from the left and top\r
248 edge of the image of the first pixel in\r
249 the image.\r
250\r
251 @retval EFI_SUCCESS The image was successfully updated.\r
252\r
253 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r
254 buffer for RowInfoArray or Blt.\r
255\r
256 @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r
257 Width was NULL.\r
258\r
259\r
260**/\r
261typedef\r
262EFI_STATUS\r
263(EFIAPI *EFI_HII_DRAW_IMAGE) (\r
264 IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
7d582d6b 265 IN EFI_HII_DRAW_FLAGS Flags,\r
266 IN CONST EFI_IMAGE_INPUT *Image,\r
d1f95000 267 IN OUT EFI_IMAGE_OUTPUT **Blt,\r
7d582d6b 268 IN UINTN BltX,\r
269 IN UINTN BltY\r
d1f95000 270);\r
271\r
272/**\r
273 \r
274 This function renders an image as a bitmap or to the screen and\r
275 can clip the image. The bitmap is either supplied by the caller\r
276 or else is allocated by the function. The images can be drawn\r
277 transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,\r
278 then all pixels drawn outside the bounding box specified by\r
279 Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT\r
280 is set, then all "off" pixels in the character's glyph will\r
281 use the pixel value from Blt. This flag cannot be used if Blt\r
282 is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then\r
283 the image will be written directly to the output device\r
284 specified by Screen. Otherwise the image will be rendered to\r
285 the bitmap specified by Bitmap.\r
286 This function renders an image to a bitmap or the screen using\r
287 the specified color and options. It draws the image on an\r
288 existing bitmap, allocates a new bitmap or uses the screen. The\r
289 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r
290 all pixels drawn outside the bounding box specified by Width and\r
291 Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag\r
292 determines whether the image will be drawn transparent or\r
293 opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image\r
294 will be drawn so that all ????off???? pixels in the image will\r
295 be drawn using the pixel value from Blt and all other pixels\r
296 will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then\r
297 the image????s pixels will be copied directly to the\r
298 destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image\r
299 will be drawn transparently or opaque, depending on the\r
300 image????s transparency setting (see EFI_IMAGE_TRANSPARENT).\r
301 Images cannot be drawn transparently if Blt is NULL. If\r
302 EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written\r
303 directly to the output device specified by Screen. Otherwise the\r
304 image will be rendered to the bitmap specified by Bitmap.\r
305\r
306 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL\r
307 instance.\r
308\r
309 @param Flags Describes how the image is to be drawn.\r
310\r
311 @param PackageList The package list in the HII database to\r
312 search for the specified image.\r
313\r
314 @param ImageId The image's id, which is unique within\r
315 PackageList.\r
316\r
317 @param Blt If this points to a non-NULL on entry, this points\r
318 to the image, which is Width pixels wide and\r
319 Height pixels high. The image will be drawn onto\r
320 this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r
321 If this points to a NULL on entry, then a buffer\r
322 will be allocated to hold the generated image and\r
323 the pointer updated on exit. It is the caller's\r
324 responsibility to free this buffer.\r
325\r
326 @param BltX, BltY Specifies the offset from the left and top\r
327 edge of the output image of the first\r
328 pixel in the image.\r
329\r
330 @retval EFI_SUCCESS The image was successfully updated.\r
331 \r
332 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output\r
333 buffer for RowInfoArray or Blt.\r
334 \r
335 @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r
336 Width was NULL.\r
337\r
338**/\r
339typedef\r
340EFI_STATUS\r
341(EFIAPI *EFI_HII_DRAW_IMAGE_ID) (\r
342IN CONST EFI_HII_IMAGE_PROTOCOL *This,\r
7d582d6b 343IN EFI_HII_DRAW_FLAGS Flags,\r
344IN EFI_HII_HANDLE PackageList,\r
345IN EFI_IMAGE_ID ImageId,\r
d1f95000 346IN OUT EFI_IMAGE_OUTPUT **Blt,\r
7d582d6b 347IN UINTN BltX,\r
348IN UINTN BltY\r
d1f95000 349);\r
350\r
351\r
352/**\r
353 \r
354 services to access to images in the images database.\r
355\r
356 @param NewImage Add a new image.\r
357\r
358 @param GetImage Retrieve an image and related font\r
359 information.\r
360\r
361 @param SetImage Change an image. EFI_INVALID_LANGUAGE The\r
362 language specified by FirstLanguage is not\r
363 present in the specified package list.\r
364 EFI_INVALID_PARAMETER FirstLanguage is NULL\r
365 or SecondLanguage is NULL.\r
366\r
367**/\r
368struct _EFI_HII_IMAGE_PROTOCOL {\r
369 EFI_HII_NEW_IMAGE NewImage;\r
370 EFI_HII_GET_IMAGE GetImage;\r
371 EFI_HII_SET_IMAGE SetImage;\r
372 EFI_HII_DRAW_IMAGE DrawImage;\r
373 EFI_HII_DRAW_IMAGE_ID DrawImageId;\r
374};\r
375\r
376extern EFI_GUID gEfiHiiImageProtocolGuid;\r
377\r
378#endif\r
379\r
7d582d6b 380\r