2 The file provides services to access to images in the images database.
4 Copyright (c) 2006 - 2018, 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.
13 @par Revision Reference:
14 This Protocol was introduced in UEFI Specification 2.1.
18 #ifndef __HII_IMAGE_H__
19 #define __HII_IMAGE_H__
21 #include <Protocol/GraphicsOutput.h>
23 #define EFI_HII_IMAGE_PROTOCOL_GUID \
24 { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
26 typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL
;
30 /// Flags in EFI_IMAGE_INPUT
32 #define EFI_IMAGE_TRANSPARENT 0x00000001
36 Definition of EFI_IMAGE_INPUT.
38 @param Flags Describe image characteristics. If
39 EFI_IMAGE_TRANSPARENT is set, then the image was
40 designed for transparent display.
42 @param Width Image width, in pixels.
44 @param Height Image height, in pixels.
46 @param Bitmap A pointer to the actual bitmap, organized left-to-right,
47 top-to-bottom. The size of the bitmap is
48 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
52 typedef struct _EFI_IMAGE_INPUT
{
56 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
62 This function adds the image Image to the group of images
63 owned by PackageList, and returns a new image identifier
66 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
68 @param PackageList Handle of the package list where this image will be added.
70 @param ImageId On return, contains the new image id, which is
71 unique within PackageList.
73 @param Image Points to the image.
75 @retval EFI_SUCCESS The new image was added
78 @retval EFI_OUT_OF_RESOURCES Could not add the image.
80 @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is
87 (EFIAPI
*EFI_HII_NEW_IMAGE
)(
88 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
89 IN EFI_HII_HANDLE PackageList
,
90 OUT EFI_IMAGE_ID
*ImageId
,
91 IN CONST EFI_IMAGE_INPUT
*Image
96 This function retrieves the image specified by ImageId which
97 is associated with the specified PackageList and copies it
98 into the buffer specified by Image. If the image specified by
99 ImageId is not present in the specified PackageList, then
100 EFI_NOT_FOUND is returned. If the buffer specified by
101 ImageSize is too small to hold the image, then
102 EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be
103 updated to the size of buffer actually required to hold the
106 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
108 @param PackageList The package list in the HII database to
109 search for the specified image.
111 @param ImageId The image's id, which is unique within
114 @param Image Points to the new image.
116 @retval EFI_SUCCESS The image was returned successfully.
118 @retval EFI_NOT_FOUND The image specified by ImageId is not
119 available. Or The specified PackageList is not in the database.
121 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
122 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
129 (EFIAPI
*EFI_HII_GET_IMAGE
)(
130 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
131 IN EFI_HII_HANDLE PackageList
,
132 IN EFI_IMAGE_ID ImageId
,
133 OUT EFI_IMAGE_INPUT
*Image
138 This function updates the image specified by ImageId in the
139 specified PackageListHandle to the image specified by Image.
142 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
144 @param PackageList The package list containing the images.
146 @param ImageId The image id, which is unique within PackageList.
148 @param Image Points to the image.
150 @retval EFI_SUCCESS The image was successfully updated.
152 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
153 The specified PackageList is not in the database.
155 @retval EFI_INVALID_PARAMETER The Image or Language was NULL.
160 (EFIAPI
*EFI_HII_SET_IMAGE
)(
161 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
162 IN EFI_HII_HANDLE PackageList
,
163 IN EFI_IMAGE_ID ImageId
,
164 IN CONST EFI_IMAGE_INPUT
*Image
169 /// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
170 /// These flags are defined as EFI_HII_DRAW_FLAG_***
172 typedef UINT32 EFI_HII_DRAW_FLAGS
;
174 #define EFI_HII_DRAW_FLAG_CLIP 0x00000001
175 #define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
176 #define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
177 #define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
178 #define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
179 #define EFI_HII_DIRECT_TO_SCREEN 0x00000080
183 Definition of EFI_IMAGE_OUTPUT.
185 @param Width Width of the output image.
187 @param Height Height of the output image.
189 @param Bitmap Points to the output bitmap.
191 @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which
192 describes the screen on which to draw the
196 typedef struct _EFI_IMAGE_OUTPUT
{
200 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
201 EFI_GRAPHICS_OUTPUT_PROTOCOL
*Screen
;
208 This function renders an image to a bitmap or the screen using
209 the specified color and options. It draws the image on an
210 existing bitmap, allocates a new bitmap or uses the screen. The
211 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
212 all pixels drawn outside the bounding box specified by Width and
213 Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,
214 then all 'off' pixels in the images drawn will use the
215 pixel value from Blt. This flag cannot be used if Blt is NULL
216 upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image
217 will be written directly to the output device specified by
218 Screen. Otherwise the image will be rendered to the bitmap
222 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
224 @param Flags Describes how the image is to be drawn.
225 EFI_HII_DRAW_FLAGS is defined in Related
228 @param Image Points to the image to be displayed.
230 @param Blt If this points to a non-NULL on entry, this points
231 to the image, which is Width pixels wide and
232 Height pixels high. The image will be drawn onto
233 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
234 If this points to a NULL on entry, then a buffer
235 will be allocated to hold the generated image and
236 the pointer updated on exit. It is the caller's
237 responsibility to free this buffer.
239 @param BltX, BltY Specifies the offset from the left and top
240 edge of the image of the first pixel in
243 @retval EFI_SUCCESS The image was successfully updated.
245 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
246 buffer for RowInfoArray or Blt.
248 @retval EFI_INVALID_PARAMETER The Image or Blt or Height or
255 (EFIAPI
*EFI_HII_DRAW_IMAGE
)(
256 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
257 IN EFI_HII_DRAW_FLAGS Flags
,
258 IN CONST EFI_IMAGE_INPUT
*Image
,
259 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
266 This function renders an image as a bitmap or to the screen and
267 can clip the image. The bitmap is either supplied by the caller
268 or else is allocated by the function. The images can be drawn
269 transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,
270 then all pixels drawn outside the bounding box specified by
271 Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT
272 is set, then all "off" pixels in the character's glyph will
273 use the pixel value from Blt. This flag cannot be used if Blt
274 is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then
275 the image will be written directly to the output device
276 specified by Screen. Otherwise the image will be rendered to
277 the bitmap specified by Bitmap.
278 This function renders an image to a bitmap or the screen using
279 the specified color and options. It draws the image on an
280 existing bitmap, allocates a new bitmap or uses the screen. The
281 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
282 all pixels drawn outside the bounding box specified by Width and
283 Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag
284 determines whether the image will be drawn transparent or
285 opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image
286 will be drawn so that all 'off' pixels in the image will
287 be drawn using the pixel value from Blt and all other pixels
288 will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then
289 the image's pixels will be copied directly to the
290 destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
291 will be drawn transparently or opaque, depending on the
292 image's transparency setting (see EFI_IMAGE_TRANSPARENT).
293 Images cannot be drawn transparently if Blt is NULL. If
294 EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written
295 directly to the output device specified by Screen. Otherwise the
296 image will be rendered to the bitmap specified by Bitmap.
298 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
300 @param Flags Describes how the image is to be drawn.
302 @param PackageList The package list in the HII database to
303 search for the specified image.
305 @param ImageId The image's id, which is unique within PackageList.
307 @param Blt If this points to a non-NULL on entry, this points
308 to the image, which is Width pixels wide and
309 Height pixels high. The image will be drawn onto
310 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
311 If this points to a NULL on entry, then a buffer
312 will be allocated to hold the generated image and
313 the pointer updated on exit. It is the caller's
314 responsibility to free this buffer.
316 @param BltX, BltY Specifies the offset from the left and top
317 edge of the output image of the first
320 @retval EFI_SUCCESS The image was successfully updated.
322 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
323 buffer for RowInfoArray or Blt.
325 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
326 Or The specified PackageList is not in the database.
328 @retval EFI_INVALID_PARAMETER The Blt was NULL.
333 (EFIAPI
*EFI_HII_DRAW_IMAGE_ID
)(
334 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
335 IN EFI_HII_DRAW_FLAGS Flags
,
336 IN EFI_HII_HANDLE PackageList
,
337 IN EFI_IMAGE_ID ImageId
,
338 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
345 /// Services to access to images in the images database.
347 struct _EFI_HII_IMAGE_PROTOCOL
{
348 EFI_HII_NEW_IMAGE NewImage
;
349 EFI_HII_GET_IMAGE GetImage
;
350 EFI_HII_SET_IMAGE SetImage
;
351 EFI_HII_DRAW_IMAGE DrawImage
;
352 EFI_HII_DRAW_IMAGE_ID DrawImageId
;
355 extern EFI_GUID gEfiHiiImageProtocolGuid
;