TianoCore EDK2 master
Loading...
Searching...
No Matches
Image.c File Reference
#include "HiiDatabase.h"

Go to the source code of this file.

Macros

#define MAX_UINT24   0xFFFFFF
 

Functions

EFI_HII_IMAGE_BLOCKGetImageIdOrAddress (IN EFI_HII_IMAGE_BLOCK *ImageBlocks, IN OUT EFI_IMAGE_ID *ImageId)
 
VOID CopyGopToRgbPixel (OUT EFI_HII_RGB_PIXEL *BitMapOut, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapIn, IN UINTN PixelNum)
 
VOID CopyRgbToGopPixel (OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BitMapOut, IN EFI_HII_RGB_PIXEL *BitMapIn, IN UINTN PixelNum)
 
VOID Output1bitPixel (IN OUT EFI_IMAGE_INPUT *Image, IN UINT8 *Data, IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo)
 
VOID Output4bitPixel (IN OUT EFI_IMAGE_INPUT *Image, IN UINT8 *Data, IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo)
 
VOID Output8bitPixel (IN OUT EFI_IMAGE_INPUT *Image, IN UINT8 *Data, IN EFI_HII_IMAGE_PALETTE_INFO *PaletteInfo)
 
VOID Output24bitPixel (IN OUT EFI_IMAGE_INPUT *Image, IN EFI_HII_RGB_PIXEL *Data)
 
EFI_STATUS ImageToBlt (IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, IN UINTN BltX, IN UINTN BltY, IN UINTN Width, IN UINTN Height, IN BOOLEAN Transparent, IN OUT EFI_IMAGE_OUTPUT **Blt)
 
HII_DATABASE_PACKAGE_LIST_INSTANCELocatePackageList (IN LIST_ENTRY *Database, IN EFI_HII_HANDLE PackageList)
 
EFI_STATUS EFIAPI HiiNewImage (IN CONST EFI_HII_IMAGE_PROTOCOL *This, IN EFI_HII_HANDLE PackageList, OUT EFI_IMAGE_ID *ImageId, IN CONST EFI_IMAGE_INPUT *Image)
 
EFI_STATUS IGetImage (IN LIST_ENTRY *Database, IN EFI_HII_HANDLE PackageList, IN EFI_IMAGE_ID ImageId, OUT EFI_IMAGE_INPUT *Image, IN BOOLEAN BitmapOnly)
 
EFI_STATUS EFIAPI HiiGetImage (IN CONST EFI_HII_IMAGE_PROTOCOL *This, IN EFI_HII_HANDLE PackageList, IN EFI_IMAGE_ID ImageId, OUT EFI_IMAGE_INPUT *Image)
 
EFI_STATUS EFIAPI HiiSetImage (IN CONST EFI_HII_IMAGE_PROTOCOL *This, IN EFI_HII_HANDLE PackageList, IN EFI_IMAGE_ID ImageId, IN CONST EFI_IMAGE_INPUT *Image)
 
EFI_STATUS EFIAPI HiiDrawImage (IN CONST EFI_HII_IMAGE_PROTOCOL *This, IN EFI_HII_DRAW_FLAGS Flags, IN CONST EFI_IMAGE_INPUT *Image, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY)
 
EFI_STATUS EFIAPI HiiDrawImageId (IN CONST EFI_HII_IMAGE_PROTOCOL *This, IN EFI_HII_DRAW_FLAGS Flags, IN EFI_HII_HANDLE PackageList, IN EFI_IMAGE_ID ImageId, IN OUT EFI_IMAGE_OUTPUT **Blt, IN UINTN BltX, IN UINTN BltY)
 

Detailed Description

Implementation for EFI_HII_IMAGE_PROTOCOL.

Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Image.c.

Macro Definition Documentation

◆ MAX_UINT24

#define MAX_UINT24   0xFFFFFF

Definition at line 12 of file Image.c.

Function Documentation

◆ CopyGopToRgbPixel()

VOID CopyGopToRgbPixel ( OUT EFI_HII_RGB_PIXEL BitMapOut,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL BitMapIn,
IN UINTN  PixelNum 
)

Convert pixels from EFI_GRAPHICS_OUTPUT_BLT_PIXEL to EFI_HII_RGB_PIXEL style.

This is a internal function.

Parameters
BitMapOutPixels in EFI_HII_RGB_PIXEL format.
BitMapInPixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.
PixelNumThe number of pixels to be converted.

Definition at line 181 of file Image.c.

◆ CopyRgbToGopPixel()

VOID CopyRgbToGopPixel ( OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL BitMapOut,
IN EFI_HII_RGB_PIXEL BitMapIn,
IN UINTN  PixelNum 
)

Convert pixels from EFI_HII_RGB_PIXEL to EFI_GRAPHICS_OUTPUT_BLT_PIXEL style.

This is a internal function.

Parameters
BitMapOutPixels in EFI_GRAPHICS_OUTPUT_BLT_PIXEL format.
BitMapInPixels in EFI_HII_RGB_PIXEL format.
PixelNumThe number of pixels to be converted.

Definition at line 209 of file Image.c.

◆ GetImageIdOrAddress()

EFI_HII_IMAGE_BLOCK * GetImageIdOrAddress ( IN EFI_HII_IMAGE_BLOCK ImageBlocks,
IN OUT EFI_IMAGE_ID *  ImageId 
)

Get the imageid of last image block: EFI_HII_IIBT_END_BLOCK when input ImageId is zero, otherwise return the address of the corresponding image block with identifier specified by ImageId.

This is a internal function.

Parameters
ImageBlocksPoints to the beginning of a series of image blocks stored in order.
ImageIdIf input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK; else use this id to find its corresponding image block address.
Returns
The image block address when input ImageId is not zero; otherwise return NULL.

Definition at line 29 of file Image.c.

◆ HiiDrawImage()

EFI_STATUS EFIAPI HiiDrawImage ( IN CONST EFI_HII_IMAGE_PROTOCOL This,
IN EFI_HII_DRAW_FLAGS  Flags,
IN CONST EFI_IMAGE_INPUT Image,
IN OUT EFI_IMAGE_OUTPUT **  Blt,
IN UINTN  BltX,
IN UINTN  BltY 
)

This function renders an image to a bitmap or the screen using the specified color and options. It draws the image on an existing bitmap, allocates a new bitmap or uses the screen. The images can be clipped.

Parameters
ThisA pointer to the EFI_HII_IMAGE_PROTOCOL instance.
FlagsDescribes how the image is to be drawn.
ImagePoints to the image to be displayed.
BltIf this points to a non-NULL on entry, this points to the image, which is Width pixels wide and Height pixels high. The image will be drawn onto this image and EFI_HII_DRAW_FLAG_CLIP is implied. If this points to a NULL on entry, then a buffer will be allocated to hold the generated image and the pointer updated on exit. It is the caller's responsibility to free this buffer.
BltXSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
BltYSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
Return values
EFI_SUCCESSThe image was successfully drawn.
EFI_OUT_OF_RESOURCESUnable to allocate an output buffer for Blt.
EFI_INVALID_PARAMETERThe Image or Blt was NULL.
EFI_INVALID_PARAMETERAny combination of Flags is invalid.

Definition at line 1274 of file Image.c.

◆ HiiDrawImageId()

EFI_STATUS EFIAPI HiiDrawImageId ( IN CONST EFI_HII_IMAGE_PROTOCOL This,
IN EFI_HII_DRAW_FLAGS  Flags,
IN EFI_HII_HANDLE  PackageList,
IN EFI_IMAGE_ID  ImageId,
IN OUT EFI_IMAGE_OUTPUT **  Blt,
IN UINTN  BltX,
IN UINTN  BltY 
)

This function renders an image to a bitmap or the screen using the specified color and options. It draws the image on an existing bitmap, allocates a new bitmap or uses the screen. The images can be clipped.

Parameters
ThisA pointer to the EFI_HII_IMAGE_PROTOCOL instance.
FlagsDescribes how the image is to be drawn.
PackageListThe package list in the HII database to search for the specified image.
ImageIdThe image's id, which is unique within PackageList.
BltIf this points to a non-NULL on entry, this points to the image, which is Width pixels wide and Height pixels high. The image will be drawn onto this image and EFI_HII_DRAW_FLAG_CLIP is implied. If this points to a NULL on entry, then a buffer will be allocated to hold the generated image and the pointer updated on exit. It is the caller's responsibility to free this buffer.
BltXSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
BltYSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
Return values
EFI_SUCCESSThe image was successfully drawn.
EFI_OUT_OF_RESOURCESUnable to allocate an output buffer for Blt.
EFI_INVALID_PARAMETERThe Blt was NULL.
EFI_NOT_FOUNDThe image specified by ImageId is not in the database. The specified PackageList is not in the database.

Definition at line 1547 of file Image.c.

◆ HiiGetImage()

EFI_STATUS EFIAPI HiiGetImage ( IN CONST EFI_HII_IMAGE_PROTOCOL This,
IN EFI_HII_HANDLE  PackageList,
IN EFI_IMAGE_ID  ImageId,
OUT EFI_IMAGE_INPUT Image 
)

This function retrieves the image specified by ImageId which is associated with the specified PackageList and copies it into the buffer specified by Image.

Parameters
ThisA pointer to the EFI_HII_IMAGE_PROTOCOL instance.
PackageListHandle of the package list where this image will be searched.
ImageIdThe image's id,, which is unique within PackageList.
ImagePoints to the image.
Return values
EFI_SUCCESSThe new image was returned successfully.
EFI_NOT_FOUNDThe image specified by ImageId is not in the database. The specified PackageList is not in the database.
EFI_BUFFER_TOO_SMALLThe buffer specified by ImageSize is too small to hold the image.
EFI_INVALID_PARAMETERThe Image or ImageSize was NULL.
EFI_OUT_OF_RESOURCESThe bitmap could not be retrieved because there was not enough memory.

Definition at line 1048 of file Image.c.

◆ HiiNewImage()

EFI_STATUS EFIAPI HiiNewImage ( IN CONST EFI_HII_IMAGE_PROTOCOL This,
IN EFI_HII_HANDLE  PackageList,
OUT EFI_IMAGE_ID *  ImageId,
IN CONST EFI_IMAGE_INPUT Image 
)

This function adds the image Image to the group of images owned by PackageList, and returns a new image identifier (ImageId).

Parameters
ThisA pointer to the EFI_HII_IMAGE_PROTOCOL instance.
PackageListHandle of the package list where this image will be added.
ImageIdOn return, contains the new image id, which is unique within PackageList.
ImagePoints to the image.
Return values
EFI_SUCCESSThe new image was added successfully.
EFI_NOT_FOUNDThe specified PackageList could not be found in database.
EFI_OUT_OF_RESOURCESCould not add the image due to lack of resources.
EFI_INVALID_PARAMETERImage is NULL or ImageId is NULL.

Definition at line 620 of file Image.c.

◆ HiiSetImage()

EFI_STATUS EFIAPI HiiSetImage ( IN CONST EFI_HII_IMAGE_PROTOCOL This,
IN EFI_HII_HANDLE  PackageList,
IN EFI_IMAGE_ID  ImageId,
IN CONST EFI_IMAGE_INPUT Image 
)

This function updates the image specified by ImageId in the specified PackageListHandle to the image specified by Image.

Parameters
ThisA pointer to the EFI_HII_IMAGE_PROTOCOL instance.
PackageListThe package list containing the images.
ImageIdThe image's id,, which is unique within PackageList.
ImagePoints to the image.
Return values
EFI_SUCCESSThe new image was updated successfully.
EFI_NOT_FOUNDThe image specified by ImageId is not in the database. The specified PackageList is not in the database.
EFI_INVALID_PARAMETERThe Image was NULL.

Definition at line 1079 of file Image.c.

◆ IGetImage()

EFI_STATUS IGetImage ( IN LIST_ENTRY Database,
IN EFI_HII_HANDLE  PackageList,
IN EFI_IMAGE_ID  ImageId,
OUT EFI_IMAGE_INPUT Image,
IN BOOLEAN  BitmapOnly 
)

This function retrieves the image specified by ImageId which is associated with the specified PackageList and copies it into the buffer specified by Image.

Parameters
DatabaseA pointer to the database list header.
PackageListHandle of the package list where this image will be searched.
ImageIdThe image's id,, which is unique within PackageList.
ImagePoints to the image.
BitmapOnlyTRUE to only return the bitmap type image. FALSE to locate image decoder instance to decode image.
Return values
EFI_SUCCESSThe new image was returned successfully.
EFI_NOT_FOUNDThe image specified by ImageId is not in the database. The specified PackageList is not in the database.
EFI_BUFFER_TOO_SMALLThe buffer specified by ImageSize is too small to hold the image.
EFI_INVALID_PARAMETERThe Image or ImageSize was NULL.
EFI_OUT_OF_RESOURCESThe bitmap could not be retrieved because there was not enough memory.

Definition at line 832 of file Image.c.

◆ ImageToBlt()

EFI_STATUS ImageToBlt ( IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL BltBuffer,
IN UINTN  BltX,
IN UINTN  BltY,
IN UINTN  Width,
IN UINTN  Height,
IN BOOLEAN  Transparent,
IN OUT EFI_IMAGE_OUTPUT **  Blt 
)

Convert the image from EFI_IMAGE_INPUT to EFI_IMAGE_OUTPUT format.

This is a internal function.

Parameters
BltBufferBuffer points to bitmap data of incoming image.
BltXSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
BltYSpecifies the offset from the left and top edge of the output image of the first pixel in the image.
WidthWidth of the incoming image, in pixels.
HeightHeight of the incoming image, in pixels.
TransparentIf TRUE, all "off" pixels in the image will be drawn using the pixel value from blt and all other pixels will be copied.
BltBuffer points to bitmap data of output image.
Return values
EFI_SUCCESSThe image was successfully converted.
EFI_INVALID_PARAMETERAny incoming parameter is invalid.

Definition at line 514 of file Image.c.

◆ LocatePackageList()

HII_DATABASE_PACKAGE_LIST_INSTANCE * LocatePackageList ( IN LIST_ENTRY Database,
IN EFI_HII_HANDLE  PackageList 
)

Return the HII package list identified by PackageList HII handle.

Parameters
DatabasePointer to HII database list header.
PackageListHII handle of the package list to locate.
Return values
TheHII package list instance.

Definition at line 575 of file Image.c.

◆ Output1bitPixel()

VOID Output1bitPixel ( IN OUT EFI_IMAGE_INPUT Image,
IN UINT8 *  Data,
IN EFI_HII_IMAGE_PALETTE_INFO PaletteInfo 
)

Output pixels in "1 bit per pixel" format to an image.

This is a internal function.

Parameters
ImagePoints to the image which will store the pixels.
DataStores the value of output pixels, 0 or 1.
PaletteInfoPaletteInfo which stores the color of the output pixels. First entry corresponds to color 0 and second one to color 1.

Definition at line 239 of file Image.c.

◆ Output24bitPixel()

VOID Output24bitPixel ( IN OUT EFI_IMAGE_INPUT Image,
IN EFI_HII_RGB_PIXEL Data 
)

Output pixels in "24 bit per pixel" format to an image.

This is a internal function.

Parameters
ImagePoints to the image which will store the pixels.
DataStores the color of output pixels, allowing 16.8 millions colors.

Definition at line 472 of file Image.c.

◆ Output4bitPixel()

VOID Output4bitPixel ( IN OUT EFI_IMAGE_INPUT Image,
IN UINT8 *  Data,
IN EFI_HII_IMAGE_PALETTE_INFO PaletteInfo 
)

Output pixels in "4 bit per pixel" format to an image.

This is a internal function.

Parameters
ImagePoints to the image which will store the pixels.
DataStores the value of output pixels, 0 ~ 15.
[in]PaletteInfoPaletteInfo which stores the color of the output pixels. Each entry corresponds to a color within [0, 15].

Definition at line 328 of file Image.c.

◆ Output8bitPixel()

VOID Output8bitPixel ( IN OUT EFI_IMAGE_INPUT Image,
IN UINT8 *  Data,
IN EFI_HII_IMAGE_PALETTE_INFO PaletteInfo 
)

Output pixels in "8 bit per pixel" format to an image.

This is a internal function.

Parameters
ImagePoints to the image which will store the pixels.
DataStores the value of output pixels, 0 ~ 255.
[in]PaletteInfoPaletteInfo which stores the color of the output pixels. Each entry corresponds to a color within [0, 255].

Definition at line 406 of file Image.c.