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 SPDX-License-Identifier: BSD-2-Clause-Patent
7 @par Revision Reference:
8 This Protocol was introduced in UEFI Specification 2.1.
12 #ifndef __HII_IMAGE_H__
13 #define __HII_IMAGE_H__
15 #include <Protocol/GraphicsOutput.h>
17 #define EFI_HII_IMAGE_PROTOCOL_GUID \
18 { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
20 typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL
;
24 /// Flags in EFI_IMAGE_INPUT
26 #define EFI_IMAGE_TRANSPARENT 0x00000001
30 Definition of EFI_IMAGE_INPUT.
32 @param Flags Describe image characteristics. If
33 EFI_IMAGE_TRANSPARENT is set, then the image was
34 designed for transparent display.
36 @param Width Image width, in pixels.
38 @param Height Image height, in pixels.
40 @param Bitmap A pointer to the actual bitmap, organized left-to-right,
41 top-to-bottom. The size of the bitmap is
42 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
46 typedef struct _EFI_IMAGE_INPUT
{
50 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
56 This function adds the image Image to the group of images
57 owned by PackageList, and returns a new image identifier
60 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
62 @param PackageList Handle of the package list where this image will be added.
64 @param ImageId On return, contains the new image id, which is
65 unique within PackageList.
67 @param Image Points to the image.
69 @retval EFI_SUCCESS The new image was added
72 @retval EFI_OUT_OF_RESOURCES Could not add the image.
74 @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is
81 (EFIAPI
*EFI_HII_NEW_IMAGE
)(
82 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
83 IN EFI_HII_HANDLE PackageList
,
84 OUT EFI_IMAGE_ID
*ImageId
,
85 IN CONST EFI_IMAGE_INPUT
*Image
90 This function retrieves the image specified by ImageId which
91 is associated with the specified PackageList and copies it
92 into the buffer specified by Image. If the image specified by
93 ImageId is not present in the specified PackageList, then
94 EFI_NOT_FOUND is returned. If the buffer specified by
95 ImageSize is too small to hold the image, then
96 EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be
97 updated to the size of buffer actually required to hold the
100 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
102 @param PackageList The package list in the HII database to
103 search for the specified image.
105 @param ImageId The image's id, which is unique within
108 @param Image Points to the new image.
110 @retval EFI_SUCCESS The image was returned successfully.
112 @retval EFI_NOT_FOUND The image specified by ImageId is not
113 available. Or The specified PackageList is not in the database.
115 @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
116 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
123 (EFIAPI
*EFI_HII_GET_IMAGE
)(
124 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
125 IN EFI_HII_HANDLE PackageList
,
126 IN EFI_IMAGE_ID ImageId
,
127 OUT EFI_IMAGE_INPUT
*Image
132 This function updates the image specified by ImageId in the
133 specified PackageListHandle to the image specified by Image.
136 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
138 @param PackageList The package list containing the images.
140 @param ImageId The image id, which is unique within PackageList.
142 @param Image Points to the image.
144 @retval EFI_SUCCESS The image was successfully updated.
146 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
147 The specified PackageList is not in the database.
149 @retval EFI_INVALID_PARAMETER The Image or Language was NULL.
154 (EFIAPI
*EFI_HII_SET_IMAGE
)(
155 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
156 IN EFI_HII_HANDLE PackageList
,
157 IN EFI_IMAGE_ID ImageId
,
158 IN CONST EFI_IMAGE_INPUT
*Image
163 /// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
164 /// These flags are defined as EFI_HII_DRAW_FLAG_***
166 typedef UINT32 EFI_HII_DRAW_FLAGS
;
168 #define EFI_HII_DRAW_FLAG_CLIP 0x00000001
169 #define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
170 #define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
171 #define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
172 #define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
173 #define EFI_HII_DIRECT_TO_SCREEN 0x00000080
177 Definition of EFI_IMAGE_OUTPUT.
179 @param Width Width of the output image.
181 @param Height Height of the output image.
183 @param Bitmap Points to the output bitmap.
185 @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which
186 describes the screen on which to draw the
190 typedef struct _EFI_IMAGE_OUTPUT
{
194 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*Bitmap
;
195 EFI_GRAPHICS_OUTPUT_PROTOCOL
*Screen
;
202 This function renders an image to a bitmap or the screen using
203 the specified color and options. It draws the image on an
204 existing bitmap, allocates a new bitmap or uses the screen. The
205 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
206 all pixels drawn outside the bounding box specified by Width and
207 Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,
208 then all 'off' pixels in the images drawn will use the
209 pixel value from Blt. This flag cannot be used if Blt is NULL
210 upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image
211 will be written directly to the output device specified by
212 Screen. Otherwise the image will be rendered to the bitmap
216 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
218 @param Flags Describes how the image is to be drawn.
219 EFI_HII_DRAW_FLAGS is defined in Related
222 @param Image Points to the image to be displayed.
224 @param Blt If this points to a non-NULL on entry, this points
225 to the image, which is Width pixels wide and
226 Height pixels high. The image will be drawn onto
227 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
228 If this points to a NULL on entry, then a buffer
229 will be allocated to hold the generated image and
230 the pointer updated on exit. It is the caller's
231 responsibility to free this buffer.
233 @param BltX, BltY Specifies the offset from the left and top
234 edge of the image of the first pixel in
237 @retval EFI_SUCCESS The image was successfully updated.
239 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
240 buffer for RowInfoArray or Blt.
242 @retval EFI_INVALID_PARAMETER The Image or Blt or Height or
249 (EFIAPI
*EFI_HII_DRAW_IMAGE
)(
250 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
251 IN EFI_HII_DRAW_FLAGS Flags
,
252 IN CONST EFI_IMAGE_INPUT
*Image
,
253 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
260 This function renders an image as a bitmap or to the screen and
261 can clip the image. The bitmap is either supplied by the caller
262 or else is allocated by the function. The images can be drawn
263 transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,
264 then all pixels drawn outside the bounding box specified by
265 Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT
266 is set, then all "off" pixels in the character's glyph will
267 use the pixel value from Blt. This flag cannot be used if Blt
268 is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then
269 the image will be written directly to the output device
270 specified by Screen. Otherwise the image will be rendered to
271 the bitmap specified by Bitmap.
272 This function renders an image to a bitmap or the screen using
273 the specified color and options. It draws the image on an
274 existing bitmap, allocates a new bitmap or uses the screen. The
275 images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
276 all pixels drawn outside the bounding box specified by Width and
277 Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag
278 determines whether the image will be drawn transparent or
279 opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image
280 will be drawn so that all 'off' pixels in the image will
281 be drawn using the pixel value from Blt and all other pixels
282 will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then
283 the image's pixels will be copied directly to the
284 destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
285 will be drawn transparently or opaque, depending on the
286 image's transparency setting (see EFI_IMAGE_TRANSPARENT).
287 Images cannot be drawn transparently if Blt is NULL. If
288 EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written
289 directly to the output device specified by Screen. Otherwise the
290 image will be rendered to the bitmap specified by Bitmap.
292 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
294 @param Flags Describes how the image is to be drawn.
296 @param PackageList The package list in the HII database to
297 search for the specified image.
299 @param ImageId The image's id, which is unique within PackageList.
301 @param Blt If this points to a non-NULL on entry, this points
302 to the image, which is Width pixels wide and
303 Height pixels high. The image will be drawn onto
304 this image and EFI_HII_DRAW_FLAG_CLIP is implied.
305 If this points to a NULL on entry, then a buffer
306 will be allocated to hold the generated image and
307 the pointer updated on exit. It is the caller's
308 responsibility to free this buffer.
310 @param BltX, BltY Specifies the offset from the left and top
311 edge of the output image of the first
314 @retval EFI_SUCCESS The image was successfully updated.
316 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
317 buffer for RowInfoArray or Blt.
319 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
320 Or The specified PackageList is not in the database.
322 @retval EFI_INVALID_PARAMETER The Blt was NULL.
327 (EFIAPI
*EFI_HII_DRAW_IMAGE_ID
)(
328 IN CONST EFI_HII_IMAGE_PROTOCOL
*This
,
329 IN EFI_HII_DRAW_FLAGS Flags
,
330 IN EFI_HII_HANDLE PackageList
,
331 IN EFI_IMAGE_ID ImageId
,
332 IN OUT EFI_IMAGE_OUTPUT
**Blt
,
339 /// Services to access to images in the images database.
341 struct _EFI_HII_IMAGE_PROTOCOL
{
342 EFI_HII_NEW_IMAGE NewImage
;
343 EFI_HII_GET_IMAGE GetImage
;
344 EFI_HII_SET_IMAGE SetImage
;
345 EFI_HII_DRAW_IMAGE DrawImage
;
346 EFI_HII_DRAW_IMAGE_ID DrawImageId
;
349 extern EFI_GUID gEfiHiiImageProtocolGuid
;