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