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