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