2007-06-19 12:12:02 +02:00
|
|
|
/** @file
|
|
|
|
The file provides services to access to images in the images database.
|
|
|
|
|
2008-06-23 11:38:38 +02:00
|
|
|
Copyright (c) 2006 - 2008, Intel Corporation
|
2007-06-19 12:12:02 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __HII_IMAGE_H__
|
|
|
|
#define __HII_IMAGE_H__
|
|
|
|
|
|
|
|
#define EFI_HII_IMAGE_PROTOCOL_GUID \
|
|
|
|
{ 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
|
|
|
|
|
|
|
|
typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;
|
|
|
|
|
|
|
|
|
2008-08-14 06:29:48 +02:00
|
|
|
///
|
|
|
|
/// Flags in EFI_IMAGE_INPUT
|
|
|
|
///
|
2007-06-19 12:12:02 +02:00
|
|
|
#define EFI_IMAGE_TRANSPARENT 0x00000001
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Definition of EFI_IMAGE_INPUT.
|
|
|
|
|
|
|
|
@param Flags Describe image characteristics. If
|
|
|
|
EFI_IMAGE_TRANSPARENT is set, then the image was
|
|
|
|
designed for transparent display.
|
|
|
|
|
|
|
|
@param Width Image width, in pixels.
|
|
|
|
|
|
|
|
@param Height Image height, in pixels.
|
|
|
|
|
2009-04-30 11:26:15 +02:00
|
|
|
@param Bitmap A pointer to the actual bitmap, organized left-to-right,
|
2007-06-19 12:12:02 +02:00
|
|
|
top-to-bottom. The size of the bitmap is
|
|
|
|
Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
|
|
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef struct _EFI_IMAGE_INPUT {
|
2008-01-21 15:41:31 +01:00
|
|
|
UINT32 Flags;
|
|
|
|
UINT16 Width;
|
|
|
|
UINT16 Height;
|
2008-06-23 11:38:38 +02:00
|
|
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
|
2007-06-19 12:12:02 +02:00
|
|
|
} EFI_IMAGE_INPUT;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This function adds the image Image to the group of images
|
|
|
|
owned by PackageList, and returns a new image identifier
|
|
|
|
(ImageId).
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
|
|
|
|
|
|
|
@param PackageList Handle of the package list where this image will be added.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param ImageId On return, contains the new image id, which is
|
|
|
|
unique within PackageList.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Image Points to the image.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The new image was added
|
|
|
|
successfully
|
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Could not add the image.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER Image is NULL or ImageId is
|
|
|
|
NULL.
|
|
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_HII_NEW_IMAGE)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN EFI_HII_HANDLE PackageList,
|
2007-06-19 12:12:02 +02:00
|
|
|
OUT EFI_IMAGE_ID *ImageId,
|
|
|
|
IN CONST 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. If the image specified by
|
|
|
|
ImageId is not present in the specified PackageList, then
|
|
|
|
EFI_NOT_FOUND is returned. If the buffer specified by
|
|
|
|
ImageSize is too small to hold the image, then
|
|
|
|
EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be
|
|
|
|
updated to the size of buffer actually required to hold the
|
|
|
|
image.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param PackageList The package list in the HII database to
|
|
|
|
search for the specified image.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param ImageId The image's id, which is unique within
|
|
|
|
PackageList.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Image Points to the new image.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The image was returned successfully.
|
|
|
|
|
|
|
|
@retval EFI_NOT_FOUND The image specified by ImageId is not
|
|
|
|
available. Or The specified PackageList is not in the database.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
|
2008-06-23 11:38:38 +02:00
|
|
|
@retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
|
2008-07-25 12:37:15 +02:00
|
|
|
enough memory.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_HII_GET_IMAGE)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN EFI_HII_HANDLE PackageList,
|
|
|
|
IN EFI_IMAGE_ID ImageId,
|
2008-06-23 11:38:38 +02:00
|
|
|
OUT EFI_IMAGE_INPUT *Image
|
2007-06-19 12:12:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This function updates the image specified by ImageId in the
|
|
|
|
specified PackageListHandle to the image specified by Image.
|
|
|
|
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param PackageList The package list containing the images.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param ImageId The image id, which is unique within PackageList.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Image Points to the image.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The image was successfully updated.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
|
|
|
|
The specified PackageList is not in the database.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_INVALID_PARAMETER The Image or Language was NULL.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_HII_SET_IMAGE)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN EFI_HII_HANDLE PackageList,
|
|
|
|
IN EFI_IMAGE_ID ImageId,
|
|
|
|
IN CONST EFI_IMAGE_INPUT *Image
|
2007-06-19 12:12:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2008-12-09 15:04:41 +01:00
|
|
|
///
|
|
|
|
/// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
|
|
|
|
/// These flags are defined as EFI_HII_DRAW_FLAG_***
|
|
|
|
///
|
2007-06-19 12:12:02 +02:00
|
|
|
typedef UINT32 EFI_HII_DRAW_FLAGS;
|
|
|
|
|
|
|
|
#define EFI_HII_DRAW_FLAG_CLIP 0x00000001
|
|
|
|
#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
|
|
|
|
#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
|
2008-06-23 11:38:38 +02:00
|
|
|
#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
|
|
|
|
#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
|
2007-06-19 12:12:02 +02:00
|
|
|
#define EFI_HII_DIRECT_TO_SCREEN 0x00000080
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Definition of EFI_IMAGE_OUTPUT.
|
|
|
|
|
|
|
|
@param Width Width of the output image.
|
|
|
|
|
|
|
|
@param Height Height of the output image.
|
|
|
|
|
|
|
|
@param Bitmap Points to the output bitmap.
|
|
|
|
|
|
|
|
@param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which
|
|
|
|
describes the screen on which to draw the
|
|
|
|
specified image.
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef struct _EFI_IMAGE_OUTPUT {
|
|
|
|
UINT16 Width;
|
|
|
|
UINT16 Height;
|
|
|
|
union {
|
|
|
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
|
|
|
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen;
|
|
|
|
} Image;
|
|
|
|
} EFI_IMAGE_OUTPUT;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
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. If EFI_HII_DRAW_FLAG_CLIP is set, then
|
|
|
|
all pixels drawn outside the bounding box specified by Width and
|
|
|
|
Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,
|
2008-07-25 12:37:15 +02:00
|
|
|
then all 'off' pixels in the images drawn will use the
|
2007-06-19 12:12:02 +02:00
|
|
|
pixel value from Blt. This flag cannot be used if Blt is NULL
|
|
|
|
upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image
|
|
|
|
will be written directly to the output device specified by
|
|
|
|
Screen. Otherwise the image will be rendered to the bitmap
|
|
|
|
specified by Bitmap.
|
|
|
|
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
|
|
|
|
|
|
|
@param Flags Describes how the image is to be drawn.
|
|
|
|
EFI_HII_DRAW_FLAGS is defined in Related
|
|
|
|
Definitions, below.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Image Points to the image to be displayed.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Blt If 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.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param BltX, BltY Specifies the offset from the left and top
|
|
|
|
edge of the image of the first pixel in
|
|
|
|
the image.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The image was successfully updated.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output
|
|
|
|
buffer for RowInfoArray or Blt.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER The Image or Blt or Height or
|
|
|
|
Width was NULL.
|
|
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_HII_DRAW_IMAGE)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN EFI_HII_DRAW_FLAGS Flags,
|
|
|
|
IN CONST EFI_IMAGE_INPUT *Image,
|
2007-06-19 12:12:02 +02:00
|
|
|
IN OUT EFI_IMAGE_OUTPUT **Blt,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN UINTN BltX,
|
|
|
|
IN UINTN BltY
|
2007-06-19 12:12:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
This function renders an image as a bitmap or to the screen and
|
|
|
|
can clip the image. The bitmap is either supplied by the caller
|
|
|
|
or else is allocated by the function. The images can be drawn
|
|
|
|
transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,
|
|
|
|
then all pixels drawn outside the bounding box specified by
|
|
|
|
Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT
|
|
|
|
is set, then all "off" pixels in the character's glyph will
|
|
|
|
use the pixel value from Blt. This flag cannot be used if Blt
|
|
|
|
is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then
|
|
|
|
the image will be written directly to the output device
|
|
|
|
specified by Screen. Otherwise the image will be rendered to
|
|
|
|
the bitmap specified by Bitmap.
|
|
|
|
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. If EFI_HII_DRAW_FLAG_CLIP is set, then
|
|
|
|
all pixels drawn outside the bounding box specified by Width and
|
|
|
|
Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag
|
|
|
|
determines whether the image will be drawn transparent or
|
|
|
|
opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image
|
2008-07-25 12:37:15 +02:00
|
|
|
will be drawn so that all 'off' pixels in the image will
|
2007-06-19 12:12:02 +02:00
|
|
|
be drawn using the pixel value from Blt and all other pixels
|
|
|
|
will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then
|
2008-07-25 12:37:15 +02:00
|
|
|
the image's pixels will be copied directly to the
|
2007-06-19 12:12:02 +02:00
|
|
|
destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
|
|
|
|
will be drawn transparently or opaque, depending on the
|
2008-07-25 12:37:15 +02:00
|
|
|
image's transparency setting (see EFI_IMAGE_TRANSPARENT).
|
2007-06-19 12:12:02 +02:00
|
|
|
Images cannot be drawn transparently if Blt is NULL. If
|
|
|
|
EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written
|
|
|
|
directly to the output device specified by Screen. Otherwise the
|
|
|
|
image will be rendered to the bitmap specified by Bitmap.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Flags Describes how the image is to be drawn.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param PackageList The package list in the HII database to
|
|
|
|
search for the specified image.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param ImageId The image's id, which is unique within PackageList.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@param Blt If 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.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@param BltX, BltY Specifies the offset from the left and top
|
|
|
|
edge of the output image of the first
|
|
|
|
pixel in the image.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_SUCCESS The image was successfully updated.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output
|
|
|
|
buffer for RowInfoArray or Blt.
|
|
|
|
|
2008-07-25 12:37:15 +02:00
|
|
|
@retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
|
|
|
|
Or The specified PackageList is not in the database.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER The Blt was NULL.
|
2007-06-19 12:12:02 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
2008-06-24 09:14:18 +02:00
|
|
|
(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(
|
2007-06-19 12:12:02 +02:00
|
|
|
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN EFI_HII_DRAW_FLAGS Flags,
|
|
|
|
IN EFI_HII_HANDLE PackageList,
|
|
|
|
IN EFI_IMAGE_ID ImageId,
|
2007-06-19 12:12:02 +02:00
|
|
|
IN OUT EFI_IMAGE_OUTPUT **Blt,
|
2008-01-21 15:41:31 +01:00
|
|
|
IN UINTN BltX,
|
|
|
|
IN UINTN BltY
|
2007-06-19 12:12:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2008-10-13 04:54:29 +02:00
|
|
|
///
|
|
|
|
/// Services to access to images in the images database.
|
|
|
|
///
|
2007-06-19 12:12:02 +02:00
|
|
|
struct _EFI_HII_IMAGE_PROTOCOL {
|
|
|
|
EFI_HII_NEW_IMAGE NewImage;
|
|
|
|
EFI_HII_GET_IMAGE GetImage;
|
|
|
|
EFI_HII_SET_IMAGE SetImage;
|
|
|
|
EFI_HII_DRAW_IMAGE DrawImage;
|
|
|
|
EFI_HII_DRAW_IMAGE_ID DrawImageId;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiHiiImageProtocolGuid;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2008-01-21 15:41:31 +01:00
|
|
|
|