Path: blob/main/sys/contrib/edk2/Include/Protocol/HiiImage.h
96339 views
/** @file1The file provides services to access to images in the images database.23Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>4SPDX-License-Identifier: BSD-2-Clause-Patent56@par Revision Reference:7This Protocol was introduced in UEFI Specification 2.1.89**/1011#ifndef __HII_IMAGE_H__12#define __HII_IMAGE_H__1314#include <Protocol/GraphicsOutput.h>1516#define EFI_HII_IMAGE_PROTOCOL_GUID \17{ 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }1819typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;2021///22/// Flags in EFI_IMAGE_INPUT23///24#define EFI_IMAGE_TRANSPARENT 0x000000012526/**2728Definition of EFI_IMAGE_INPUT.2930@param Flags Describe image characteristics. If31EFI_IMAGE_TRANSPARENT is set, then the image was32designed for transparent display.3334@param Width Image width, in pixels.3536@param Height Image height, in pixels.3738@param Bitmap A pointer to the actual bitmap, organized left-to-right,39top-to-bottom. The size of the bitmap is40Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).414243**/44typedef struct _EFI_IMAGE_INPUT {45UINT32 Flags;46UINT16 Width;47UINT16 Height;48EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;49} EFI_IMAGE_INPUT;5051/**5253This function adds the image Image to the group of images54owned by PackageList, and returns a new image identifier55(ImageId).5657@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.5859@param PackageList Handle of the package list where this image will be added.6061@param ImageId On return, contains the new image id, which is62unique within PackageList.6364@param Image Points to the image.6566@retval EFI_SUCCESS The new image was added67successfully6869@retval EFI_OUT_OF_RESOURCES Could not add the image.7071@retval EFI_INVALID_PARAMETER Image is NULL or ImageId is72NULL.737475**/76typedef77EFI_STATUS78(EFIAPI *EFI_HII_NEW_IMAGE)(79IN CONST EFI_HII_IMAGE_PROTOCOL *This,80IN EFI_HII_HANDLE PackageList,81OUT EFI_IMAGE_ID *ImageId,82IN CONST EFI_IMAGE_INPUT *Image83);8485/**8687This function retrieves the image specified by ImageId which88is associated with the specified PackageList and copies it89into the buffer specified by Image. If the image specified by90ImageId is not present in the specified PackageList, then91EFI_NOT_FOUND is returned. If the buffer specified by92ImageSize is too small to hold the image, then93EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be94updated to the size of buffer actually required to hold the95image.9697@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.9899@param PackageList The package list in the HII database to100search for the specified image.101102@param ImageId The image's id, which is unique within103PackageList.104105@param Image Points to the new image.106107@retval EFI_SUCCESS The image was returned successfully.108109@retval EFI_NOT_FOUND The image specified by ImageId is not110available. Or The specified PackageList is not in the database.111112@retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.113@retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not114enough memory.115116117**/118typedef119EFI_STATUS120(EFIAPI *EFI_HII_GET_IMAGE)(121IN CONST EFI_HII_IMAGE_PROTOCOL *This,122IN EFI_HII_HANDLE PackageList,123IN EFI_IMAGE_ID ImageId,124OUT EFI_IMAGE_INPUT *Image125);126127/**128129This function updates the image specified by ImageId in the130specified PackageListHandle to the image specified by Image.131132133@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.134135@param PackageList The package list containing the images.136137@param ImageId The image id, which is unique within PackageList.138139@param Image Points to the image.140141@retval EFI_SUCCESS The image was successfully updated.142143@retval EFI_NOT_FOUND The image specified by ImageId is not in the database.144The specified PackageList is not in the database.145146@retval EFI_INVALID_PARAMETER The Image or Language was NULL.147148**/149typedef150EFI_STATUS151(EFIAPI *EFI_HII_SET_IMAGE)(152IN CONST EFI_HII_IMAGE_PROTOCOL *This,153IN EFI_HII_HANDLE PackageList,154IN EFI_IMAGE_ID ImageId,155IN CONST EFI_IMAGE_INPUT *Image156);157158///159/// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.160/// These flags are defined as EFI_HII_DRAW_FLAG_***161///162typedef UINT32 EFI_HII_DRAW_FLAGS;163164#define EFI_HII_DRAW_FLAG_CLIP 0x00000001165#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030166#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000167#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010168#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020169#define EFI_HII_DIRECT_TO_SCREEN 0x00000080170171/**172173Definition of EFI_IMAGE_OUTPUT.174175@param Width Width of the output image.176177@param Height Height of the output image.178179@param Bitmap Points to the output bitmap.180181@param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which182describes the screen on which to draw the183specified image.184185**/186typedef struct _EFI_IMAGE_OUTPUT {187UINT16 Width;188UINT16 Height;189union {190EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;191EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen;192} Image;193} EFI_IMAGE_OUTPUT;194195/**196197This function renders an image to a bitmap or the screen using198the specified color and options. It draws the image on an199existing bitmap, allocates a new bitmap or uses the screen. The200images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then201all pixels drawn outside the bounding box specified by Width and202Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,203then all 'off' pixels in the images drawn will use the204pixel value from Blt. This flag cannot be used if Blt is NULL205upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image206will be written directly to the output device specified by207Screen. Otherwise the image will be rendered to the bitmap208specified by Bitmap.209210211@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.212213@param Flags Describes how the image is to be drawn.214EFI_HII_DRAW_FLAGS is defined in Related215Definitions, below.216217@param Image Points to the image to be displayed.218219@param Blt If this points to a non-NULL on entry, this points220to the image, which is Width pixels wide and221Height pixels high. The image will be drawn onto222this image and EFI_HII_DRAW_FLAG_CLIP is implied.223If this points to a NULL on entry, then a buffer224will be allocated to hold the generated image and225the pointer updated on exit. It is the caller's226responsibility to free this buffer.227228@param BltX, BltY Specifies the offset from the left and top229edge of the image of the first pixel in230the image.231232@retval EFI_SUCCESS The image was successfully updated.233234@retval EFI_OUT_OF_RESOURCES Unable to allocate an output235buffer for RowInfoArray or Blt.236237@retval EFI_INVALID_PARAMETER The Image or Blt or Height or238Width was NULL.239240241**/242typedef243EFI_STATUS244(EFIAPI *EFI_HII_DRAW_IMAGE)(245IN CONST EFI_HII_IMAGE_PROTOCOL *This,246IN EFI_HII_DRAW_FLAGS Flags,247IN CONST EFI_IMAGE_INPUT *Image,248IN OUT EFI_IMAGE_OUTPUT **Blt,249IN UINTN BltX,250IN UINTN BltY251);252253/**254255This function renders an image as a bitmap or to the screen and256can clip the image. The bitmap is either supplied by the caller257or else is allocated by the function. The images can be drawn258transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,259then all pixels drawn outside the bounding box specified by260Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT261is set, then all "off" pixels in the character's glyph will262use the pixel value from Blt. This flag cannot be used if Blt263is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then264the image will be written directly to the output device265specified by Screen. Otherwise the image will be rendered to266the bitmap specified by Bitmap.267This function renders an image to a bitmap or the screen using268the specified color and options. It draws the image on an269existing bitmap, allocates a new bitmap or uses the screen. The270images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then271all pixels drawn outside the bounding box specified by Width and272Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag273determines whether the image will be drawn transparent or274opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image275will be drawn so that all 'off' pixels in the image will276be drawn using the pixel value from Blt and all other pixels277will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then278the image's pixels will be copied directly to the279destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image280will be drawn transparently or opaque, depending on the281image's transparency setting (see EFI_IMAGE_TRANSPARENT).282Images cannot be drawn transparently if Blt is NULL. If283EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written284directly to the output device specified by Screen. Otherwise the285image will be rendered to the bitmap specified by Bitmap.286287@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.288289@param Flags Describes how the image is to be drawn.290291@param PackageList The package list in the HII database to292search for the specified image.293294@param ImageId The image's id, which is unique within PackageList.295296@param Blt If this points to a non-NULL on entry, this points297to the image, which is Width pixels wide and298Height pixels high. The image will be drawn onto299this image and EFI_HII_DRAW_FLAG_CLIP is implied.300If this points to a NULL on entry, then a buffer301will be allocated to hold the generated image and302the pointer updated on exit. It is the caller's303responsibility to free this buffer.304305@param BltX, BltY Specifies the offset from the left and top306edge of the output image of the first307pixel in the image.308309@retval EFI_SUCCESS The image was successfully updated.310311@retval EFI_OUT_OF_RESOURCES Unable to allocate an output312buffer for RowInfoArray or Blt.313314@retval EFI_NOT_FOUND The image specified by ImageId is not in the database.315Or The specified PackageList is not in the database.316317@retval EFI_INVALID_PARAMETER The Blt was NULL.318319**/320typedef321EFI_STATUS322(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(323IN CONST EFI_HII_IMAGE_PROTOCOL *This,324IN EFI_HII_DRAW_FLAGS Flags,325IN EFI_HII_HANDLE PackageList,326IN EFI_IMAGE_ID ImageId,327IN OUT EFI_IMAGE_OUTPUT **Blt,328IN UINTN BltX,329IN UINTN BltY330);331332///333/// Services to access to images in the images database.334///335struct _EFI_HII_IMAGE_PROTOCOL {336EFI_HII_NEW_IMAGE NewImage;337EFI_HII_GET_IMAGE GetImage;338EFI_HII_SET_IMAGE SetImage;339EFI_HII_DRAW_IMAGE DrawImage;340EFI_HII_DRAW_IMAGE_ID DrawImageId;341};342343extern EFI_GUID gEfiHiiImageProtocolGuid;344345#endif346347348