mirror of https://github.com/ipxe/ipxe.git
[efi] Import EFI_HII_FONT_PROTOCOL definitions
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/41/head
parent
42e0c7e956
commit
fb2af441c2
|
@ -0,0 +1,474 @@
|
|||
/** @file
|
||||
The file provides services to retrieve font information.
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that 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_FONT_H__
|
||||
#define __HII_FONT_H__
|
||||
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#include <ipxe/efi/Protocol/GraphicsOutput.h>
|
||||
#include <ipxe/efi/Protocol/HiiImage.h>
|
||||
|
||||
#define EFI_HII_FONT_PROTOCOL_GUID \
|
||||
{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }
|
||||
|
||||
typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL;
|
||||
|
||||
typedef VOID *EFI_FONT_HANDLE;
|
||||
|
||||
///
|
||||
/// EFI_HII_OUT_FLAGS.
|
||||
///
|
||||
typedef UINT32 EFI_HII_OUT_FLAGS;
|
||||
|
||||
#define EFI_HII_OUT_FLAG_CLIP 0x00000001
|
||||
#define EFI_HII_OUT_FLAG_WRAP 0x00000002
|
||||
#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004
|
||||
#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008
|
||||
#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010
|
||||
#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020
|
||||
#define EFI_HII_IGNORE_LINE_BREAK 0x00000040
|
||||
#define EFI_HII_DIRECT_TO_SCREEN 0x00000080
|
||||
|
||||
/**
|
||||
Definition of EFI_HII_ROW_INFO.
|
||||
**/
|
||||
typedef struct _EFI_HII_ROW_INFO {
|
||||
///
|
||||
/// The index of the first character in the string which is displayed on the line.
|
||||
///
|
||||
UINTN StartIndex;
|
||||
///
|
||||
/// The index of the last character in the string which is displayed on the line.
|
||||
/// If this is the same as StartIndex, then no characters are displayed.
|
||||
///
|
||||
UINTN EndIndex;
|
||||
UINTN LineHeight; ///< The height of the line, in pixels.
|
||||
UINTN LineWidth; ///< The width of the text on the line, in pixels.
|
||||
|
||||
///
|
||||
/// The font baseline offset in pixels from the bottom of the row, or 0 if none.
|
||||
///
|
||||
UINTN BaselineOffset;
|
||||
} EFI_HII_ROW_INFO;
|
||||
|
||||
///
|
||||
/// Font info flag. All flags (FONT, SIZE, STYLE, and COLOR) are defined.
|
||||
/// They are defined as EFI_FONT_INFO_***
|
||||
///
|
||||
typedef UINT32 EFI_FONT_INFO_MASK;
|
||||
|
||||
#define EFI_FONT_INFO_SYS_FONT 0x00000001
|
||||
#define EFI_FONT_INFO_SYS_SIZE 0x00000002
|
||||
#define EFI_FONT_INFO_SYS_STYLE 0x00000004
|
||||
#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010
|
||||
#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020
|
||||
#define EFI_FONT_INFO_RESIZE 0x00001000
|
||||
#define EFI_FONT_INFO_RESTYLE 0x00002000
|
||||
#define EFI_FONT_INFO_ANY_FONT 0x00010000
|
||||
#define EFI_FONT_INFO_ANY_SIZE 0x00020000
|
||||
#define EFI_FONT_INFO_ANY_STYLE 0x00040000
|
||||
|
||||
//
|
||||
// EFI_FONT_INFO
|
||||
//
|
||||
typedef struct {
|
||||
EFI_HII_FONT_STYLE FontStyle;
|
||||
UINT16 FontSize; ///< character cell height in pixels
|
||||
CHAR16 FontName[1];
|
||||
} EFI_FONT_INFO;
|
||||
|
||||
/**
|
||||
Describes font output-related information.
|
||||
|
||||
This structure is used for describing the way in which a string
|
||||
should be rendered in a particular font. FontInfo specifies the
|
||||
basic font information and ForegroundColor and BackgroundColor
|
||||
specify the color in which they should be displayed. The flags
|
||||
in FontInfoMask describe where the system default should be
|
||||
supplied instead of the specified information. The flags also
|
||||
describe what options can be used to make a match between the
|
||||
font requested and the font available.
|
||||
**/
|
||||
typedef struct _EFI_FONT_DISPLAY_INFO {
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;
|
||||
EFI_FONT_INFO_MASK FontInfoMask;
|
||||
EFI_FONT_INFO FontInfo;
|
||||
} EFI_FONT_DISPLAY_INFO;
|
||||
|
||||
/**
|
||||
|
||||
This function renders a string to a bitmap or the screen using
|
||||
the specified font, color and options. It either draws the
|
||||
string and glyphs on an existing bitmap, allocates a new bitmap,
|
||||
or uses the screen. The strings can be clipped or wrapped.
|
||||
Optionally, the function also returns the information about each
|
||||
row and the character position on that row. If
|
||||
EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only
|
||||
based on explicit line breaks and all pixels which would lie
|
||||
outside the bounding box specified by Width and Height are
|
||||
ignored. The information in the RowInfoArray only describes
|
||||
characters which are at least partially displayed. For the final
|
||||
row, the LineHeight and BaseLine may describe pixels that are
|
||||
outside the limit specified by Height (unless
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those
|
||||
pixels were not drawn. The LineWidth may describe pixels which
|
||||
are outside the limit specified by Width (unless
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those
|
||||
pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set,
|
||||
then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that
|
||||
if a character's right-most on pixel cannot fit, then it will
|
||||
not be drawn at all. This flag requires that
|
||||
EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y
|
||||
is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP
|
||||
so that if a row's bottom-most pixel cannot fit, then it will
|
||||
not be drawn at all. This flag requires that
|
||||
EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set,
|
||||
then text will be wrapped at the right-most line-break
|
||||
opportunity prior to a character whose right-most extent would
|
||||
exceed Width. If no line-break opportunity can be found, then
|
||||
the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set.
|
||||
This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
|
||||
EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
|
||||
ignored and all 'off' pixels in the character's drawn
|
||||
will use the pixel value from Blt. This flag cannot be used if
|
||||
Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set,
|
||||
then characters which have no glyphs are not drawn. Otherwise,
|
||||
they are replaced with Unicode character code 0xFFFD (REPLACEMENT
|
||||
CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
|
||||
line break characters will be ignored. If
|
||||
EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written
|
||||
directly to the output device specified by Screen. Otherwise the
|
||||
string will be rendered to the bitmap specified by Bitmap.
|
||||
|
||||
@param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
|
||||
|
||||
@param Flags Describes how the string is to be drawn.
|
||||
|
||||
@param String Points to the null-terminated string to be
|
||||
|
||||
@param StringInfo Points to the string output information,
|
||||
including the color and font. If NULL, then
|
||||
the string will be output in the default
|
||||
system font and color.
|
||||
|
||||
@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 string will be drawn onto
|
||||
this image and EFI_HII_OUT_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.
|
||||
|
||||
@param BltX, BltY Specifies the offset from the left and top
|
||||
edge of the image of the first character
|
||||
cell in the image.
|
||||
|
||||
@param RowInfoArray If this is non-NULL on entry, then on
|
||||
exit, this will point to an allocated buffer
|
||||
containing row information and
|
||||
RowInfoArraySize will be updated to contain
|
||||
the number of elements. This array describes
|
||||
the characters that were at least partially
|
||||
drawn and the heights of the rows. It is the
|
||||
caller's responsibility to free this buffer.
|
||||
|
||||
@param RowInfoArraySize If this is non-NULL on entry, then on
|
||||
exit it contains the number of
|
||||
elements in RowInfoArray.
|
||||
|
||||
@param ColumnInfoArray If this is non-NULL, then on return it
|
||||
will be filled with the horizontal
|
||||
offset for each character in the
|
||||
string on the row where it is
|
||||
displayed. Non-printing characters
|
||||
will have the offset ~0. The caller is
|
||||
responsible for allocating a buffer large
|
||||
enough so that there is one entry for
|
||||
each character in the string, not
|
||||
including the null-terminator. It is
|
||||
possible when character display is
|
||||
normalized that some character cells
|
||||
overlap.
|
||||
|
||||
@retval EFI_SUCCESS The string was successfully updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for RowInfoArray or Blt.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The String or Blt was NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Flags were invalid combination.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_STRING_TO_IMAGE)(
|
||||
IN CONST EFI_HII_FONT_PROTOCOL *This,
|
||||
IN EFI_HII_OUT_FLAGS Flags,
|
||||
IN CONST EFI_STRING String,
|
||||
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
|
||||
IN OUT EFI_IMAGE_OUTPUT **Blt,
|
||||
IN UINTN BltX,
|
||||
IN UINTN BltY,
|
||||
OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
|
||||
OUT UINTN *RowInfoArraySize OPTIONAL,
|
||||
OUT UINTN *ColumnInfoArray OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
This function renders a string as a bitmap or to the screen
|
||||
and can clip or wrap the string. The bitmap is either supplied
|
||||
by the caller or allocated by the function. The
|
||||
strings are drawn with the font, size and style specified and
|
||||
can be drawn transparently or opaquely. The function can also
|
||||
return information about each row and each character's
|
||||
position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then
|
||||
text will be formatted based only on explicit line breaks, and
|
||||
all pixels that would lie outside the bounding box specified
|
||||
by Width and Height are ignored. The information in the
|
||||
RowInfoArray only describes characters which are at least
|
||||
partially displayed. For the final row, the LineHeight and
|
||||
BaseLine may describe pixels which are outside the limit
|
||||
specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is
|
||||
specified) even though those pixels were not drawn. If
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the
|
||||
behavior of EFI_HII_OUT_FLAG_CLIP so that if a character's
|
||||
right-most on pixel cannot fit, then it will not be drawn at
|
||||
all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the
|
||||
behavior of EFI_HII_OUT_FLAG_CLIP so that if a row's bottom
|
||||
most pixel cannot fit, then it will not be drawn at all. This
|
||||
flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
|
||||
EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the
|
||||
right-most line-break opportunity prior to a character whose
|
||||
right-most extent would exceed Width. If no line-break
|
||||
opportunity can be found, then the text will behave as if
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used
|
||||
with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
|
||||
EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
|
||||
ignored and 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_IGNORE_IF_NO_GLYPH is set, then
|
||||
characters which have no glyphs are not drawn. Otherwise, they
|
||||
are replaced with Unicode character code 0xFFFD (REPLACEMENT
|
||||
CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
|
||||
line break characters will be ignored. If
|
||||
EFI_HII_DIRECT_TO_SCREEN is set, then the string will be
|
||||
written directly to the output device specified by Screen.
|
||||
Otherwise the string will be rendered to the bitmap specified
|
||||
by Bitmap.
|
||||
|
||||
|
||||
@param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
|
||||
|
||||
@param Flags Describes how the string is to be drawn.
|
||||
|
||||
@param PackageList
|
||||
The package list in the HII database to
|
||||
search for the specified string.
|
||||
|
||||
@param StringId The string's id, which is unique within
|
||||
PackageList.
|
||||
|
||||
@param Language Points to the language for the retrieved
|
||||
string. If NULL, then the current system
|
||||
language is used.
|
||||
|
||||
@param StringInfo Points to the string output information,
|
||||
including the color and font. If NULL, then
|
||||
the string will be output in the default
|
||||
system font and color.
|
||||
|
||||
@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 string will be drawn onto
|
||||
this image and EFI_HII_OUT_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.
|
||||
|
||||
@param BltX, BltY Specifies the offset from the left and top
|
||||
edge of the output image of the first
|
||||
character cell in the image.
|
||||
|
||||
@param RowInfoArray If this is non-NULL on entry, then on
|
||||
exit, this will point to an allocated
|
||||
buffer containing row information and
|
||||
RowInfoArraySize will be updated to
|
||||
contain the number of elements. This array
|
||||
describes the characters which were at
|
||||
least partially drawn and the heights of
|
||||
the rows. It is the caller's
|
||||
responsibility to free this buffer.
|
||||
|
||||
@param RowInfoArraySize If this is non-NULL on entry, then on
|
||||
exit it contains the number of
|
||||
elements in RowInfoArray.
|
||||
|
||||
@param ColumnInfoArray If non-NULL, on return it is filled
|
||||
with the horizontal offset for each
|
||||
character in the string on the row
|
||||
where it is displayed. Non-printing
|
||||
characters will have the offset ~0.
|
||||
The caller is responsible to allocate
|
||||
a buffer large enough so that there is
|
||||
one entry for each character in the
|
||||
string, not including the
|
||||
null-terminator. It is possible when
|
||||
character display is normalized that
|
||||
some character cells overlap.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The string was successfully updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output
|
||||
buffer for RowInfoArray or Blt.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The String, or Blt, or Height, or
|
||||
Width was NULL.
|
||||
@retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
|
||||
@retval EFI_INVALID_PARAMETER Flags were invalid combination.
|
||||
@retval EFI_NOT_FOUND The specified PackageList is not in the Database,
|
||||
or the stringid is not in the specified PackageList.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE)(
|
||||
IN CONST EFI_HII_FONT_PROTOCOL *This,
|
||||
IN EFI_HII_OUT_FLAGS Flags,
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
IN EFI_STRING_ID StringId,
|
||||
IN CONST CHAR8 *Language,
|
||||
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,
|
||||
IN OUT EFI_IMAGE_OUTPUT **Blt,
|
||||
IN UINTN BltX,
|
||||
IN UINTN BltY,
|
||||
OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
|
||||
OUT UINTN *RowInfoArraySize OPTIONAL,
|
||||
OUT UINTN *ColumnInfoArray OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Convert the glyph for a single character into a bitmap.
|
||||
|
||||
@param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
|
||||
|
||||
@param Char The character to retrieve.
|
||||
|
||||
@param StringInfo Points to the string font and color
|
||||
information or NULL if the string should use
|
||||
the default system font and color.
|
||||
|
||||
@param Blt This must point to a NULL on entry. A buffer will
|
||||
be allocated to hold the output and the pointer
|
||||
updated on exit. It is the caller's responsibility
|
||||
to free this buffer.
|
||||
|
||||
@param Baseline The number of pixels from the bottom of the bitmap
|
||||
to the baseline.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The glyph bitmap created.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Unable to allocate the output buffer Blt.
|
||||
|
||||
@retval EFI_WARN_UNKNOWN_GLYPH The glyph was unknown and was
|
||||
replaced with the glyph for
|
||||
Unicode character code 0xFFFD.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Blt is NULL, or Width is NULL, or
|
||||
Height is NULL
|
||||
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_GET_GLYPH)(
|
||||
IN CONST EFI_HII_FONT_PROTOCOL *This,
|
||||
IN CONST CHAR16 Char,
|
||||
IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
|
||||
OUT EFI_IMAGE_OUTPUT **Blt,
|
||||
OUT UINTN *Baseline OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
This function iterates through fonts which match the specified
|
||||
font, using the specified criteria. If String is non-NULL, then
|
||||
all of the characters in the string must exist in order for a
|
||||
candidate font to be returned.
|
||||
|
||||
@param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
|
||||
|
||||
@param FontHandle On entry, points to the font handle returned
|
||||
by a previous call to GetFontInfo() or NULL
|
||||
to start with the first font. On return,
|
||||
points to the returned font handle or points
|
||||
to NULL if there are no more matching fonts.
|
||||
|
||||
@param StringInfoIn Upon entry, points to the font to return
|
||||
information about. If NULL, then the information
|
||||
about the system default font will be returned.
|
||||
|
||||
@param StringInfoOut Upon return, contains the matching font's information.
|
||||
If NULL, then no information is returned. This buffer
|
||||
is allocated with a call to the Boot Service AllocatePool().
|
||||
It is the caller's responsibility to call the Boot
|
||||
Service FreePool() when the caller no longer requires
|
||||
the contents of StringInfoOut.
|
||||
|
||||
@param String Points to the string which will be tested to
|
||||
determine if all characters are available. If
|
||||
NULL, then any font is acceptable.
|
||||
|
||||
@retval EFI_SUCCESS Matching font returned successfully.
|
||||
|
||||
@retval EFI_NOT_FOUND No matching font was found.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the request.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_GET_FONT_INFO)(
|
||||
IN CONST EFI_HII_FONT_PROTOCOL *This,
|
||||
IN OUT EFI_FONT_HANDLE *FontHandle,
|
||||
IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL
|
||||
OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
|
||||
IN CONST EFI_STRING String OPTIONAL
|
||||
);
|
||||
|
||||
///
|
||||
/// The protocol provides the service to retrieve the font informations.
|
||||
///
|
||||
struct _EFI_HII_FONT_PROTOCOL {
|
||||
EFI_HII_STRING_TO_IMAGE StringToImage;
|
||||
EFI_HII_STRING_ID_TO_IMAGE StringIdToImage;
|
||||
EFI_HII_GET_GLYPH GetGlyph;
|
||||
EFI_HII_GET_FONT_INFO GetFontInfo;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiHiiFontProtocolGuid;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,356 @@
|
|||
/** @file
|
||||
The file provides services to access to images in the images database.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
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__
|
||||
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
///
|
||||
/// Flags in EFI_IMAGE_INPUT
|
||||
///
|
||||
#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.
|
||||
|
||||
@param Bitmap A pointer to the actual bitmap, organized left-to-right,
|
||||
top-to-bottom. The size of the bitmap is
|
||||
Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
|
||||
|
||||
|
||||
**/
|
||||
typedef struct _EFI_IMAGE_INPUT {
|
||||
UINT32 Flags;
|
||||
UINT16 Width;
|
||||
UINT16 Height;
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
|
||||
} EFI_IMAGE_INPUT;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
This function adds the image Image to the group of images
|
||||
owned by PackageList, and returns a new image identifier
|
||||
(ImageId).
|
||||
|
||||
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
||||
|
||||
@param PackageList Handle of the package list where this image will be added.
|
||||
|
||||
@param ImageId On return, contains the new image id, which is
|
||||
unique within PackageList.
|
||||
|
||||
@param Image Points to the image.
|
||||
|
||||
@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
|
||||
(EFIAPI *EFI_HII_NEW_IMAGE)(
|
||||
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 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.
|
||||
|
||||
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
||||
|
||||
@param PackageList The package list in the HII database to
|
||||
search for the specified image.
|
||||
|
||||
@param ImageId The image's id, which is unique within
|
||||
PackageList.
|
||||
|
||||
@param Image Points to the new image.
|
||||
|
||||
@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.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
|
||||
enough memory.
|
||||
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_GET_IMAGE)(
|
||||
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
IN EFI_IMAGE_ID ImageId,
|
||||
OUT EFI_IMAGE_INPUT *Image
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
This function updates the image specified by ImageId in the
|
||||
specified PackageListHandle to the image specified by Image.
|
||||
|
||||
|
||||
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
||||
|
||||
@param PackageList The package list containing the images.
|
||||
|
||||
@param ImageId The image id, which is unique within PackageList.
|
||||
|
||||
@param Image Points to the image.
|
||||
|
||||
@retval EFI_SUCCESS The image was successfully updated.
|
||||
|
||||
@retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
|
||||
The specified PackageList is not in the database.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The Image or Language was NULL.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_SET_IMAGE)(
|
||||
IN CONST EFI_HII_IMAGE_PROTOCOL *This,
|
||||
IN EFI_HII_HANDLE PackageList,
|
||||
IN EFI_IMAGE_ID ImageId,
|
||||
IN CONST EFI_IMAGE_INPUT *Image
|
||||
);
|
||||
|
||||
|
||||
///
|
||||
/// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
|
||||
/// These flags are defined as EFI_HII_DRAW_FLAG_***
|
||||
///
|
||||
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
|
||||
#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
|
||||
#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
|
||||
#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,
|
||||
then all 'off' pixels in the images drawn 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.
|
||||
|
||||
|
||||
@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.
|
||||
|
||||
@param Image Points to the image to be displayed.
|
||||
|
||||
@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.
|
||||
|
||||
@param BltX, BltY Specifies the offset from the left and top
|
||||
edge of the image of the first pixel in
|
||||
the image.
|
||||
|
||||
@retval EFI_SUCCESS The image was successfully updated.
|
||||
|
||||
@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
|
||||
(EFIAPI *EFI_HII_DRAW_IMAGE)(
|
||||
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 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
|
||||
will be drawn so that all 'off' pixels in the image will
|
||||
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
|
||||
the image's pixels will be copied directly to the
|
||||
destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
|
||||
will be drawn transparently or opaque, depending on the
|
||||
image's transparency setting (see EFI_IMAGE_TRANSPARENT).
|
||||
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.
|
||||
|
||||
@param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
|
||||
|
||||
@param Flags Describes how the image is to be drawn.
|
||||
|
||||
@param PackageList The package list in the HII database to
|
||||
search for the specified image.
|
||||
|
||||
@param ImageId The image's id, which is unique within PackageList.
|
||||
|
||||
@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.
|
||||
|
||||
@param BltX, BltY Specifies the offset from the left and top
|
||||
edge of the output image of the first
|
||||
pixel in the image.
|
||||
|
||||
@retval EFI_SUCCESS The image was successfully updated.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output
|
||||
buffer for RowInfoArray or Blt.
|
||||
|
||||
@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.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
///
|
||||
/// Services to access to images in the images database.
|
||||
///
|
||||
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
|
||||
|
||||
|
|
@ -168,6 +168,7 @@ extern EFI_GUID efi_disk_io_protocol_guid;
|
|||
extern EFI_GUID efi_driver_binding_protocol_guid;
|
||||
extern EFI_GUID efi_graphics_output_protocol_guid;
|
||||
extern EFI_GUID efi_hii_config_access_protocol_guid;
|
||||
extern EFI_GUID efi_hii_font_protocol_guid;
|
||||
extern EFI_GUID efi_ip4_protocol_guid;
|
||||
extern EFI_GUID efi_ip4_config_protocol_guid;
|
||||
extern EFI_GUID efi_ip4_service_binding_protocol_guid;
|
||||
|
|
|
@ -99,6 +99,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
|
|||
"GraphicsOutput" },
|
||||
{ &efi_hii_config_access_protocol_guid,
|
||||
"HiiConfigAccess" },
|
||||
{ &efi_hii_font_protocol_guid,
|
||||
"HiiFont" },
|
||||
{ &efi_ip4_protocol_guid,
|
||||
"Ip4" },
|
||||
{ &efi_ip4_config_protocol_guid,
|
||||
|
|
|
@ -38,6 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||
#include <ipxe/efi/Protocol/DriverBinding.h>
|
||||
#include <ipxe/efi/Protocol/GraphicsOutput.h>
|
||||
#include <ipxe/efi/Protocol/HiiConfigAccess.h>
|
||||
#include <ipxe/efi/Protocol/HiiFont.h>
|
||||
#include <ipxe/efi/Protocol/Ip4.h>
|
||||
#include <ipxe/efi/Protocol/Ip4Config.h>
|
||||
#include <ipxe/efi/Protocol/LoadFile.h>
|
||||
|
@ -137,6 +138,10 @@ EFI_GUID efi_graphics_output_protocol_guid
|
|||
EFI_GUID efi_hii_config_access_protocol_guid
|
||||
= EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID;
|
||||
|
||||
/** HII font protocol GUID */
|
||||
EFI_GUID efi_hii_font_protocol_guid
|
||||
= EFI_HII_FONT_PROTOCOL_GUID;
|
||||
|
||||
/** IPv4 protocol GUID */
|
||||
EFI_GUID efi_ip4_protocol_guid
|
||||
= EFI_IP4_PROTOCOL_GUID;
|
||||
|
|
Loading…
Reference in New Issue