2 The file provides services to access to images in the images database.
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __HII_IMAGE_H__
16 #define __HII_IMAGE_H__
18 #include <Protocol/GraphicsOutput.h>
20 #define EFI_HII_IMAGE_PROTOCOL_GUID \
21 { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
23 typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL
;
27 /// Flags in EFI_IMAGE_INPUT
29 #define EFI_IMAGE_TRANSPARENT 0x00000001
33 Definition of EFI_IMAGE_INPUT.
35 @param Flags Describe image characteristics. If
36 EFI_IMAGE_TRANSPARENT is set, then the image was
37 designed for transparent display.
39 @param Width Image width, in pixels.
41 @param Height Image height, in pixels.
43 @param Bitmap A pointer to the actual bitmap, organized left-to-right,
44 top-to-bottom. The size of the bitmap is
45 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
49 typedef struct _EFI_IMAGE_INPUT
{
53 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
59 This function adds the image Image to the group of images
60 owned by PackageList, and returns a new image identifier
63 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
65 @param PackageList Handle of the package list where this image will be added.
67 @param ImageId On return, contains the new image id, which is
68 unique within PackageList.
70 @param Image Points to the image.
72 @retval EFI_SUCCESS The new image was added
75 @retval EFI_OUT_OF_RESOURCES Could not add the image.
77 @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is
84 (EFIAPI
*EFI_HII_NEW_IMAGE
)(
85 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
86 IN EFI_HII_HANDLE PackageList
,
87 OUT EFI_IMAGE_ID
*ImageId
,
88 IN CONST EFI_IMAGE_INPUT
*Image
93 This function retrieves the image specified by ImageId which
94 is associated with the specified PackageList and copies it
95 into the buffer specified by Image. If the image specified by
96 ImageId is not present in the specified PackageList, then
97 EFI_NOT_FOUND is returned. If the buffer specified by
98 ImageSize is too small to hold the image, then
99 EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be
100 updated to the size of buffer actually required to hold the
103 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
105 @param PackageList The package list in the HII database to
106 search for the specified image.
108 @param ImageId The image's id, which is unique within
111 @param Image Points to the new image.
113 @retval EFI_SUCCESS The image was returned successfully.
115 @retval EFI_NOT_FOUND The image specified by ImageId is not
116 available. Or The specified PackageList is not in the database.
118 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
119 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
126 (EFIAPI
*EFI_HII_GET_IMAGE
)(
127 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
128 IN EFI_HII_HANDLE PackageList
,
129 IN EFI_IMAGE_ID ImageId
,
130 OUT EFI_IMAGE_INPUT
*Image
135 This function updates the image specified by ImageId in the
136 specified PackageListHandle to the image specified by Image.
139 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
141 @param PackageList The package list containing the images.
143 @param ImageId The image id, which is unique within PackageList.
145 @param Image Points to the image.
147 @retval EFI_SUCCESS The image was successfully updated.
149 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
150 The specified PackageList is not in the database.
152 @retval EFI_INVALID_PARAMETER The Image or Language was NULL.
157 (EFIAPI
*EFI_HII_SET_IMAGE
)(
158 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
159 IN EFI_HII_HANDLE PackageList
,
160 IN EFI_IMAGE_ID ImageId
,
161 IN CONST EFI_IMAGE_INPUT
*Image
166 /// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
167 /// These flags are defined as EFI_HII_DRAW_FLAG_***
169 typedef UINT32 EFI_HII_DRAW_FLAGS
;
171 #define EFI_HII_DRAW_FLAG_CLIP 0x00000001
172 #define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
173 #define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
174 #define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
175 #define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
176 #define EFI_HII_DIRECT_TO_SCREEN 0x00000080
180 Definition of EFI_IMAGE_OUTPUT.
182 @param Width Width of the output image.
184 @param Height Height of the output image.
186 @param Bitmap Points to the output bitmap.
188 @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which
189 describes the screen on which to draw the
193 typedef struct _EFI_IMAGE_OUTPUT
{
197 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
198 EFI_GRAPHICS_OUTPUT_PROTOCOL
*Screen
;
205 This function renders an image to a bitmap or the screen using
206 the specified color and options. It draws the image on an
207 existing bitmap, allocates a new bitmap or uses the screen. The
208 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
209 all pixels drawn outside the bounding box specified by Width and
210 Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,
211 then all 'off' pixels in the images drawn will use the
212 pixel value from Blt. This flag cannot be used if Blt is NULL
213 upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image
214 will be written directly to the output device specified by
215 Screen. Otherwise the image will be rendered to the bitmap
219 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
221 @param Flags Describes how the image is to be drawn.
222 EFI_HII_DRAW_FLAGS is defined in Related
225 @param Image Points to the image to be displayed.
227 @param Blt If this points to a non-NULL on entry, this points
228 to the image, which is Width pixels wide and
229 Height pixels high. The image will be drawn onto
230 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
231 If this points to a NULL on entry, then a buffer
232 will be allocated to hold the generated image and
233 the pointer updated on exit. It is the caller's
234 responsibility to free this buffer.
236 @param BltX, BltY Specifies the offset from the left and top
237 edge of the image of the first pixel in
240 @retval EFI_SUCCESS The image was successfully updated.
242 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
243 buffer for RowInfoArray or Blt.
245 @retval EFI_INVALID_PARAMETER The Image or Blt or Height or
252 (EFIAPI
*EFI_HII_DRAW_IMAGE
)(
253 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
254 IN EFI_HII_DRAW_FLAGS Flags
,
255 IN CONST EFI_IMAGE_INPUT
*Image
,
256 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
263 This function renders an image as a bitmap or to the screen and
264 can clip the image. The bitmap is either supplied by the caller
265 or else is allocated by the function. The images can be drawn
266 transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,
267 then all pixels drawn outside the bounding box specified by
268 Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT
269 is set, then all "off" pixels in the character's glyph will
270 use the pixel value from Blt. This flag cannot be used if Blt
271 is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then
272 the image will be written directly to the output device
273 specified by Screen. Otherwise the image will be rendered to
274 the bitmap specified by Bitmap.
275 This function renders an image to a bitmap or the screen using
276 the specified color and options. It draws the image on an
277 existing bitmap, allocates a new bitmap or uses the screen. The
278 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
279 all pixels drawn outside the bounding box specified by Width and
280 Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag
281 determines whether the image will be drawn transparent or
282 opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image
283 will be drawn so that all 'off' pixels in the image will
284 be drawn using the pixel value from Blt and all other pixels
285 will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then
286 the image's pixels will be copied directly to the
287 destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
288 will be drawn transparently or opaque, depending on the
289 image's transparency setting (see EFI_IMAGE_TRANSPARENT).
290 Images cannot be drawn transparently if Blt is NULL. If
291 EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written
292 directly to the output device specified by Screen. Otherwise the
293 image will be rendered to the bitmap specified by Bitmap.
295 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
297 @param Flags Describes how the image is to be drawn.
299 @param PackageList The package list in the HII database to
300 search for the specified image.
302 @param ImageId The image's id, which is unique within PackageList.
304 @param Blt If this points to a non-NULL on entry, this points
305 to the image, which is Width pixels wide and
306 Height pixels high. The image will be drawn onto
307 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
308 If this points to a NULL on entry, then a buffer
309 will be allocated to hold the generated image and
310 the pointer updated on exit. It is the caller's
311 responsibility to free this buffer.
313 @param BltX, BltY Specifies the offset from the left and top
314 edge of the output image of the first
317 @retval EFI_SUCCESS The image was successfully updated.
319 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
320 buffer for RowInfoArray or Blt.
322 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
323 Or The specified PackageList is not in the database.
325 @retval EFI_INVALID_PARAMETER The Blt was NULL.
330 (EFIAPI
*EFI_HII_DRAW_IMAGE_ID
)(
331 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
332 IN EFI_HII_DRAW_FLAGS Flags
,
333 IN EFI_HII_HANDLE PackageList
,
334 IN EFI_IMAGE_ID ImageId
,
335 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
342 /// Services to access to images in the images database.
344 struct _EFI_HII_IMAGE_PROTOCOL
{
345 EFI_HII_NEW_IMAGE NewImage
;
346 EFI_HII_GET_IMAGE GetImage
;
347 EFI_HII_SET_IMAGE SetImage
;
348 EFI_HII_DRAW_IMAGE DrawImage
;
349 EFI_HII_DRAW_IMAGE_ID DrawImageId
;
352 extern EFI_GUID gEfiHiiImageProtocolGuid
;