Преглед изворни кода

[efi] Import EFI_HII_FONT_PROTOCOL definitions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown пре 9 година
родитељ
комит
fb2af441c2

+ 474
- 0
src/include/ipxe/efi/Protocol/HiiFont.h Прегледај датотеку

@@ -0,0 +1,474 @@
1
+/** @file
2
+  The file provides services to retrieve font information.
3
+
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9
+
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+**/
14
+
15
+#ifndef __HII_FONT_H__
16
+#define __HII_FONT_H__
17
+
18
+FILE_LICENCE ( BSD3 );
19
+
20
+#include <ipxe/efi/Protocol/GraphicsOutput.h>
21
+#include <ipxe/efi/Protocol/HiiImage.h>
22
+
23
+#define EFI_HII_FONT_PROTOCOL_GUID \
24
+{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }
25
+
26
+typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL;
27
+
28
+typedef VOID    *EFI_FONT_HANDLE;
29
+
30
+///
31
+/// EFI_HII_OUT_FLAGS.
32
+///
33
+typedef UINT32  EFI_HII_OUT_FLAGS;
34
+
35
+#define EFI_HII_OUT_FLAG_CLIP         0x00000001
36
+#define EFI_HII_OUT_FLAG_WRAP         0x00000002
37
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004
38
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008
39
+#define EFI_HII_OUT_FLAG_TRANSPARENT  0x00000010
40
+#define EFI_HII_IGNORE_IF_NO_GLYPH    0x00000020
41
+#define EFI_HII_IGNORE_LINE_BREAK     0x00000040
42
+#define EFI_HII_DIRECT_TO_SCREEN      0x00000080
43
+
44
+/**
45
+  Definition of EFI_HII_ROW_INFO.
46
+**/
47
+typedef struct _EFI_HII_ROW_INFO {
48
+  ///
49
+  /// The index of the first character in the string which is displayed on the line.
50
+  ///
51
+  UINTN   StartIndex;
52
+  ///
53
+  /// The index of the last character in the string which is displayed on the line.
54
+  /// If this is the same as StartIndex, then no characters are displayed.
55
+  ///
56
+  UINTN   EndIndex;
57
+  UINTN   LineHeight; ///< The height of the line, in pixels.
58
+  UINTN   LineWidth;  ///< The width of the text on the line, in pixels.
59
+
60
+  ///
61
+  /// The font baseline offset in pixels from the bottom of the row, or 0 if none.
62
+  ///
63
+  UINTN   BaselineOffset;
64
+} EFI_HII_ROW_INFO;
65
+
66
+///
67
+/// Font info flag. All flags (FONT, SIZE, STYLE, and COLOR) are defined.
68
+/// They are defined as EFI_FONT_INFO_***
69
+///
70
+typedef UINT32  EFI_FONT_INFO_MASK;
71
+
72
+#define EFI_FONT_INFO_SYS_FONT        0x00000001
73
+#define EFI_FONT_INFO_SYS_SIZE        0x00000002
74
+#define EFI_FONT_INFO_SYS_STYLE       0x00000004
75
+#define EFI_FONT_INFO_SYS_FORE_COLOR  0x00000010
76
+#define EFI_FONT_INFO_SYS_BACK_COLOR  0x00000020
77
+#define EFI_FONT_INFO_RESIZE          0x00001000
78
+#define EFI_FONT_INFO_RESTYLE         0x00002000
79
+#define EFI_FONT_INFO_ANY_FONT        0x00010000
80
+#define EFI_FONT_INFO_ANY_SIZE        0x00020000
81
+#define EFI_FONT_INFO_ANY_STYLE       0x00040000
82
+
83
+//
84
+// EFI_FONT_INFO
85
+//
86
+typedef struct {
87
+  EFI_HII_FONT_STYLE FontStyle;
88
+  UINT16             FontSize;      ///< character cell height in pixels
89
+  CHAR16             FontName[1];
90
+} EFI_FONT_INFO;
91
+
92
+/**
93
+  Describes font output-related information.
94
+
95
+  This structure is used for describing the way in which a string
96
+  should be rendered in a particular font. FontInfo specifies the
97
+  basic font information and ForegroundColor and BackgroundColor
98
+  specify the color in which they should be displayed. The flags
99
+  in FontInfoMask describe where the system default should be
100
+  supplied instead of the specified information. The flags also
101
+  describe what options can be used to make a match between the
102
+  font requested and the font available.
103
+**/
104
+typedef struct _EFI_FONT_DISPLAY_INFO {
105
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;
106
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;
107
+  EFI_FONT_INFO_MASK            FontInfoMask;
108
+  EFI_FONT_INFO                 FontInfo;
109
+} EFI_FONT_DISPLAY_INFO;
110
+
111
+/**
112
+
113
+  This function renders a string to a bitmap or the screen using
114
+  the specified font, color and options. It either draws the
115
+  string and glyphs on an existing bitmap, allocates a new bitmap,
116
+  or uses the screen. The strings can be clipped or wrapped.
117
+  Optionally, the function also returns the information about each
118
+  row and the character position on that row. If
119
+  EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only
120
+  based on explicit line breaks and all pixels which would lie
121
+  outside the bounding box specified by Width and Height are
122
+  ignored. The information in the RowInfoArray only describes
123
+  characters which are at least partially displayed. For the final
124
+  row, the LineHeight and BaseLine may describe pixels that are
125
+  outside the limit specified by Height (unless
126
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those
127
+  pixels were not drawn. The LineWidth may describe pixels which
128
+  are outside the limit specified by Width (unless
129
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those
130
+  pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set,
131
+  then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that
132
+  if a character's right-most on pixel cannot fit, then it will
133
+  not be drawn at all. This flag requires that
134
+  EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y
135
+  is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP
136
+  so that if a row's bottom-most pixel cannot fit, then it will
137
+  not be drawn at all. This flag requires that
138
+  EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set,
139
+  then text will be wrapped at the right-most line-break
140
+  opportunity prior to a character whose right-most extent would
141
+  exceed Width. If no line-break opportunity can be found, then
142
+  the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set.
143
+  This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
144
+  EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
145
+  ignored and all 'off' pixels in the character's drawn
146
+  will use the pixel value from Blt. This flag cannot be used if
147
+  Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set,
148
+  then characters which have no glyphs are not drawn. Otherwise,
149
+  they are replaced with Unicode character code 0xFFFD (REPLACEMENT
150
+  CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
151
+  line break characters will be ignored. If
152
+  EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written
153
+  directly to the output device specified by Screen. Otherwise the
154
+  string will be rendered to the bitmap specified by Bitmap.
155
+
156
+  @param This             A pointer to the EFI_HII_FONT_PROTOCOL instance.
157
+
158
+  @param Flags            Describes how the string is to be drawn.
159
+
160
+  @param String           Points to the null-terminated string to be
161
+
162
+  @param StringInfo       Points to the string output information,
163
+                          including the color and font. If NULL, then
164
+                          the string will be output in the default
165
+                          system font and color.
166
+
167
+  @param Blt              If this points to a non-NULL on entry, this points
168
+                          to the image, which is Width pixels wide and
169
+                          Height pixels high. The string will be drawn onto
170
+                          this image and EFI_HII_OUT_FLAG_CLIP is implied.
171
+                          If this points to a NULL on entry, then a buffer
172
+                          will be allocated to hold the generated image and
173
+                          the pointer updated on exit. It is the caller's
174
+                          responsibility to free this buffer.
175
+
176
+  @param BltX, BltY       Specifies the offset from the left and top
177
+                          edge of the image of the first character
178
+                          cell in the image.
179
+
180
+  @param RowInfoArray     If this is non-NULL on entry, then on
181
+                          exit, this will point to an allocated buffer
182
+                          containing row information and
183
+                          RowInfoArraySize will be updated to contain
184
+                          the number of elements. This array describes
185
+                          the characters that were at least partially
186
+                          drawn and the heights of the rows. It is the
187
+                          caller's responsibility to free this buffer.
188
+
189
+  @param RowInfoArraySize If this is non-NULL on entry, then on
190
+                          exit it contains the number of
191
+                          elements in RowInfoArray.
192
+
193
+  @param ColumnInfoArray  If this is non-NULL, then on return it
194
+                          will be filled with the horizontal
195
+                          offset for each character in the
196
+                          string on the row where it is
197
+                          displayed. Non-printing characters
198
+                          will have the offset ~0. The caller is
199
+                          responsible for allocating a buffer large
200
+                          enough so that there is one entry for
201
+                          each character in the string, not
202
+                          including the null-terminator. It is
203
+                          possible when character display is
204
+                          normalized that some character cells
205
+                          overlap.
206
+
207
+  @retval EFI_SUCCESS           The string was successfully updated.
208
+
209
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output buffer for RowInfoArray or Blt.
210
+
211
+  @retval EFI_INVALID_PARAMETER The String or Blt was NULL.
212
+
213
+  @retval EFI_INVALID_PARAMETER Flags were invalid combination.
214
+**/
215
+typedef
216
+EFI_STATUS
217
+(EFIAPI *EFI_HII_STRING_TO_IMAGE)(
218
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,
219
+  IN        EFI_HII_OUT_FLAGS     Flags,
220
+  IN CONST  EFI_STRING            String,
221
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo,
222
+  IN OUT    EFI_IMAGE_OUTPUT      **Blt,
223
+  IN        UINTN                 BltX,
224
+  IN        UINTN                 BltY,
225
+  OUT       EFI_HII_ROW_INFO      **RowInfoArray OPTIONAL,
226
+  OUT       UINTN                 *RowInfoArraySize OPTIONAL,
227
+  OUT       UINTN                 *ColumnInfoArray OPTIONAL
228
+);
229
+
230
+
231
+
232
+/**
233
+
234
+  This function renders a string as a bitmap or to the screen
235
+  and can clip or wrap the string. The bitmap is either supplied
236
+  by the caller or allocated by the function. The
237
+  strings are drawn with the font, size and style specified and
238
+  can be drawn transparently or opaquely. The function can also
239
+  return information about each row and each character's
240
+  position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then
241
+  text will be formatted based only on explicit line breaks, and
242
+  all pixels that would lie outside the bounding box specified
243
+  by Width and Height are ignored. The information in the
244
+  RowInfoArray only describes characters which are at least
245
+  partially displayed. For the final row, the LineHeight and
246
+  BaseLine may describe pixels which are outside the limit
247
+  specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is
248
+  specified) even though those pixels were not drawn. If
249
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the
250
+  behavior of EFI_HII_OUT_FLAG_CLIP so that if a character's
251
+  right-most on pixel cannot fit, then it will not be drawn at
252
+  all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
253
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the
254
+  behavior of EFI_HII_OUT_FLAG_CLIP so that if a row's bottom
255
+  most pixel cannot fit, then it will not be drawn at all. This
256
+  flag requires that EFI_HII_OUT_FLAG_CLIP be set. If
257
+  EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the
258
+  right-most line-break opportunity prior to a character whose
259
+  right-most extent would exceed Width. If no line-break
260
+  opportunity can be found, then the text will behave as if
261
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used
262
+  with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If
263
+  EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is
264
+  ignored and all off" pixels in the character's glyph will
265
+  use the pixel value from Blt. This flag cannot be used if Blt
266
+  is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set, then
267
+  characters which have no glyphs are not drawn. Otherwise, they
268
+  are replaced with Unicode character code 0xFFFD (REPLACEMENT
269
+  CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit
270
+  line break characters will be ignored. If
271
+  EFI_HII_DIRECT_TO_SCREEN is set, then the string will be
272
+  written directly to the output device specified by Screen.
273
+  Otherwise the string will be rendered to the bitmap specified
274
+  by Bitmap.
275
+
276
+
277
+  @param This       A pointer to the EFI_HII_FONT_PROTOCOL instance.
278
+
279
+  @param Flags      Describes how the string is to be drawn.
280
+
281
+  @param PackageList
282
+                    The package list in the HII database to
283
+                    search for the specified string.
284
+
285
+  @param StringId   The string's id, which is unique within
286
+                    PackageList.
287
+
288
+  @param Language   Points to the language for the retrieved
289
+                    string. If NULL, then the current system
290
+                    language is used.
291
+
292
+  @param StringInfo Points to the string output information,
293
+                    including the color and font. If NULL, then
294
+                    the string will be output in the default
295
+                    system font and color.
296
+
297
+  @param Blt        If this points to a non-NULL on entry, this points
298
+                    to the image, which is Width pixels wide and
299
+                    Height pixels high. The string will be drawn onto
300
+                    this image and EFI_HII_OUT_FLAG_CLIP is implied.
301
+                    If this points to a NULL on entry, then a buffer
302
+                    will be allocated to hold the generated image and
303
+                    the pointer updated on exit. It is the caller's
304
+                    responsibility to free this buffer.
305
+
306
+  @param BltX, BltY Specifies the offset from the left and top
307
+                    edge of the output image of the first
308
+                    character cell in the image.
309
+
310
+  @param RowInfoArray     If this is non-NULL on entry, then on
311
+                          exit, this will point to an allocated
312
+                          buffer containing row information and
313
+                          RowInfoArraySize will be updated to
314
+                          contain the number of elements. This array
315
+                          describes the characters which were at
316
+                          least partially drawn and the heights of
317
+                          the rows. It is the caller's
318
+                          responsibility to free this buffer.
319
+
320
+  @param RowInfoArraySize If this is non-NULL on entry, then on
321
+                          exit it contains the number of
322
+                          elements in RowInfoArray.
323
+
324
+  @param ColumnInfoArray  If non-NULL, on return it is filled
325
+                          with the horizontal offset for each
326
+                          character in the string on the row
327
+                          where it is displayed. Non-printing
328
+                          characters will have the offset ~0.
329
+                          The caller is responsible to allocate
330
+                          a buffer large enough so that there is
331
+                          one entry for each character in the
332
+                          string, not including the
333
+                          null-terminator. It is possible when
334
+                          character display is normalized that
335
+                          some character cells overlap.
336
+
337
+
338
+  @retval EFI_SUCCESS           The string was successfully updated.
339
+
340
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output
341
+                                buffer for RowInfoArray or Blt.
342
+
343
+  @retval EFI_INVALID_PARAMETER The String, or Blt, or Height, or
344
+                                Width was NULL.
345
+  @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
346
+  @retval EFI_INVALID_PARAMETER Flags were invalid combination.
347
+  @retval EFI_NOT_FOUND         The specified PackageList is not in the Database,
348
+                                or the stringid is not in the specified PackageList.
349
+
350
+**/
351
+typedef
352
+EFI_STATUS
353
+(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE)(
354
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,
355
+  IN        EFI_HII_OUT_FLAGS     Flags,
356
+  IN        EFI_HII_HANDLE        PackageList,
357
+  IN        EFI_STRING_ID         StringId,
358
+  IN CONST  CHAR8                 *Language,
359
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo       OPTIONAL,
360
+  IN OUT    EFI_IMAGE_OUTPUT      **Blt,
361
+  IN        UINTN                 BltX,
362
+  IN        UINTN                 BltY,
363
+  OUT       EFI_HII_ROW_INFO      **RowInfoArray    OPTIONAL,
364
+  OUT       UINTN                 *RowInfoArraySize OPTIONAL,
365
+  OUT       UINTN                 *ColumnInfoArray  OPTIONAL
366
+);
367
+
368
+
369
+/**
370
+
371
+  Convert the glyph for a single character into a bitmap.
372
+
373
+  @param This       A pointer to the EFI_HII_FONT_PROTOCOL instance.
374
+
375
+  @param Char       The character to retrieve.
376
+
377
+  @param StringInfo Points to the string font and color
378
+                    information or NULL if the string should use
379
+                    the default system font and color.
380
+
381
+  @param Blt        This must point to a NULL on entry. A buffer will
382
+                    be allocated to hold the output and the pointer
383
+                    updated on exit. It is the caller's responsibility
384
+                    to free this buffer.
385
+
386
+  @param Baseline   The number of pixels from the bottom of the bitmap
387
+                    to the baseline.
388
+
389
+
390
+  @retval EFI_SUCCESS             The glyph bitmap created.
391
+
392
+  @retval EFI_OUT_OF_RESOURCES    Unable to allocate the output buffer Blt.
393
+
394
+  @retval EFI_WARN_UNKNOWN_GLYPH  The glyph was unknown and was
395
+                                  replaced with the glyph for
396
+                                  Unicode character code 0xFFFD.
397
+
398
+  @retval EFI_INVALID_PARAMETER   Blt is NULL, or Width is NULL, or
399
+                                  Height is NULL
400
+
401
+
402
+**/
403
+typedef
404
+EFI_STATUS
405
+(EFIAPI *EFI_HII_GET_GLYPH)(
406
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,
407
+  IN CONST  CHAR16                Char,
408
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo,
409
+  OUT       EFI_IMAGE_OUTPUT      **Blt,
410
+  OUT       UINTN                 *Baseline OPTIONAL
411
+);
412
+
413
+/**
414
+
415
+  This function iterates through fonts which match the specified
416
+  font, using the specified criteria. If String is non-NULL, then
417
+  all of the characters in the string must exist in order for a
418
+  candidate font to be returned.
419
+
420
+  @param This           A pointer to the EFI_HII_FONT_PROTOCOL instance.
421
+
422
+  @param FontHandle     On entry, points to the font handle returned
423
+                        by a previous call to GetFontInfo() or NULL
424
+                        to start with the first font. On return,
425
+                        points to the returned font handle or points
426
+                        to NULL if there are no more matching fonts.
427
+
428
+  @param StringInfoIn   Upon entry, points to the font to return
429
+                        information about. If NULL, then the information
430
+                        about the system default font will be returned.
431
+
432
+  @param  StringInfoOut Upon return, contains the matching font's information.
433
+                        If NULL, then no information is returned. This buffer
434
+                        is allocated with a call to the Boot Service AllocatePool().
435
+                        It is the caller's responsibility to call the Boot
436
+                        Service FreePool() when the caller no longer requires
437
+                        the contents of StringInfoOut.
438
+
439
+  @param String         Points to the string which will be tested to
440
+                        determine if all characters are available. If
441
+                        NULL, then any font is acceptable.
442
+
443
+  @retval EFI_SUCCESS            Matching font returned successfully.
444
+
445
+  @retval EFI_NOT_FOUND          No matching font was found.
446
+
447
+  @retval EFI_OUT_OF_RESOURCES   There were insufficient resources to complete the request.
448
+
449
+**/
450
+typedef
451
+EFI_STATUS
452
+(EFIAPI *EFI_HII_GET_FONT_INFO)(
453
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,
454
+  IN OUT    EFI_FONT_HANDLE       *FontHandle,
455
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL
456
+  OUT       EFI_FONT_DISPLAY_INFO **StringInfoOut,
457
+  IN CONST  EFI_STRING            String OPTIONAL
458
+);
459
+
460
+///
461
+/// The protocol provides the service to retrieve the font informations.
462
+///
463
+struct _EFI_HII_FONT_PROTOCOL {
464
+  EFI_HII_STRING_TO_IMAGE     StringToImage;
465
+  EFI_HII_STRING_ID_TO_IMAGE  StringIdToImage;
466
+  EFI_HII_GET_GLYPH           GetGlyph;
467
+  EFI_HII_GET_FONT_INFO       GetFontInfo;
468
+};
469
+
470
+extern EFI_GUID gEfiHiiFontProtocolGuid;
471
+
472
+
473
+#endif
474
+

+ 356
- 0
src/include/ipxe/efi/Protocol/HiiImage.h Прегледај датотеку

@@ -0,0 +1,356 @@
1
+/** @file
2
+  The file provides services to access to images in the images database.
3
+
4
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5
+  This program and the accompanying materials
6
+  are licensed and made available under the terms and conditions of the BSD License
7
+  which accompanies this distribution.  The full text of the license may be found at
8
+  http://opensource.org/licenses/bsd-license.php
9
+
10
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+**/
14
+
15
+#ifndef __HII_IMAGE_H__
16
+#define __HII_IMAGE_H__
17
+
18
+FILE_LICENCE ( BSD3 );
19
+
20
+#define EFI_HII_IMAGE_PROTOCOL_GUID \
21
+  { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }
22
+
23
+typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;
24
+
25
+
26
+///
27
+/// Flags in EFI_IMAGE_INPUT
28
+///
29
+#define EFI_IMAGE_TRANSPARENT 0x00000001
30
+
31
+/**
32
+
33
+  Definition of EFI_IMAGE_INPUT.
34
+
35
+  @param Flags  Describe image characteristics. If
36
+                EFI_IMAGE_TRANSPARENT is set, then the image was
37
+                designed for transparent display.
38
+
39
+  @param Width  Image width, in pixels.
40
+
41
+  @param Height Image height, in pixels.
42
+
43
+  @param Bitmap A pointer to the actual bitmap, organized left-to-right,
44
+                top-to-bottom. The size of the bitmap is
45
+                Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
46
+
47
+
48
+**/
49
+typedef struct _EFI_IMAGE_INPUT {
50
+  UINT32                          Flags;
51
+  UINT16                          Width;
52
+  UINT16                          Height;
53
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL   *Bitmap;
54
+} EFI_IMAGE_INPUT;
55
+
56
+
57
+/**
58
+
59
+  This function adds the image Image to the group of images
60
+  owned by PackageList, and returns a new image identifier
61
+  (ImageId).
62
+
63
+  @param This        A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
64
+
65
+  @param PackageList Handle of the package list where this image will be added.
66
+
67
+  @param ImageId     On return, contains the new image id, which is
68
+                     unique within PackageList.
69
+
70
+  @param Image       Points to the image.
71
+
72
+  @retval EFI_SUCCESS             The new image was added
73
+                                  successfully
74
+
75
+  @retval EFI_OUT_OF_RESOURCES    Could not add the image.
76
+
77
+  @retval EFI_INVALID_PARAMETER   Image is NULL or ImageId is
78
+                                  NULL.
79
+
80
+
81
+**/
82
+typedef
83
+EFI_STATUS
84
+(EFIAPI *EFI_HII_NEW_IMAGE)(
85
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,
86
+  IN        EFI_HII_HANDLE          PackageList,
87
+  OUT       EFI_IMAGE_ID            *ImageId,
88
+  IN CONST  EFI_IMAGE_INPUT         *Image
89
+);
90
+
91
+/**
92
+
93
+  This function retrieves the image specified by ImageId which
94
+  is associated with the specified PackageList and copies it
95
+  into the buffer specified by Image. If the image specified by
96
+  ImageId is not present in the specified PackageList, then
97
+  EFI_NOT_FOUND is returned. If the buffer specified by
98
+  ImageSize is too small to hold the image, then
99
+  EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be
100
+  updated to the size of buffer actually required to hold the
101
+  image.
102
+
103
+  @param This         A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
104
+
105
+  @param PackageList  The package list in the HII database to
106
+                      search for the specified image.
107
+
108
+  @param ImageId      The image's id, which is unique within
109
+                      PackageList.
110
+
111
+  @param Image        Points to the new image.
112
+
113
+  @retval EFI_SUCCESS            The image was returned successfully.
114
+
115
+  @retval EFI_NOT_FOUND          The image specified by ImageId is not
116
+                                 available. Or The specified PackageList is not in the database.
117
+
118
+  @retval EFI_INVALID_PARAMETER  The Image or Langugae was NULL.
119
+  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not
120
+                                 enough memory.
121
+
122
+
123
+**/
124
+typedef
125
+EFI_STATUS
126
+(EFIAPI *EFI_HII_GET_IMAGE)(
127
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,
128
+  IN        EFI_HII_HANDLE          PackageList,
129
+  IN        EFI_IMAGE_ID            ImageId,
130
+  OUT       EFI_IMAGE_INPUT         *Image
131
+);
132
+
133
+/**
134
+
135
+  This function updates the image specified by ImageId in the
136
+  specified PackageListHandle to the image specified by Image.
137
+
138
+
139
+  @param This         A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
140
+
141
+  @param PackageList  The package list containing the images.
142
+
143
+  @param ImageId      The image id, which is unique within PackageList.
144
+
145
+  @param Image        Points to the image.
146
+
147
+  @retval EFI_SUCCESS           The image was successfully updated.
148
+
149
+  @retval EFI_NOT_FOUND         The image specified by ImageId is not in the database.
150
+                                The specified PackageList is not in the database.
151
+
152
+  @retval EFI_INVALID_PARAMETER The Image or Language was NULL.
153
+
154
+**/
155
+typedef
156
+EFI_STATUS
157
+(EFIAPI *EFI_HII_SET_IMAGE)(
158
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,
159
+  IN        EFI_HII_HANDLE          PackageList,
160
+  IN        EFI_IMAGE_ID            ImageId,
161
+  IN CONST  EFI_IMAGE_INPUT         *Image
162
+);
163
+
164
+
165
+///
166
+/// EFI_HII_DRAW_FLAGS describes how the image is to be drawn.
167
+/// These flags are defined as EFI_HII_DRAW_FLAG_***
168
+///
169
+typedef UINT32  EFI_HII_DRAW_FLAGS;
170
+
171
+#define EFI_HII_DRAW_FLAG_CLIP          0x00000001
172
+#define EFI_HII_DRAW_FLAG_TRANSPARENT   0x00000030
173
+#define EFI_HII_DRAW_FLAG_DEFAULT       0x00000000
174
+#define EFI_HII_DRAW_FLAG_FORCE_TRANS   0x00000010
175
+#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE  0x00000020
176
+#define EFI_HII_DIRECT_TO_SCREEN        0x00000080
177
+
178
+/**
179
+
180
+  Definition of EFI_IMAGE_OUTPUT.
181
+
182
+  @param Width  Width of the output image.
183
+
184
+  @param Height Height of the output image.
185
+
186
+  @param Bitmap Points to the output bitmap.
187
+
188
+  @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which
189
+                describes the screen on which to draw the
190
+                specified image.
191
+
192
+**/
193
+typedef struct _EFI_IMAGE_OUTPUT {
194
+  UINT16  Width;
195
+  UINT16  Height;
196
+  union {
197
+    EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
198
+    EFI_GRAPHICS_OUTPUT_PROTOCOL  *Screen;
199
+  } Image;
200
+} EFI_IMAGE_OUTPUT;
201
+
202
+
203
+/**
204
+
205
+  This function renders an image to a bitmap or the screen using
206
+  the specified color and options. It draws the image on an
207
+  existing bitmap, allocates a new bitmap or uses the screen. The
208
+  images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
209
+  all pixels drawn outside the bounding box specified by Width and
210
+  Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,
211
+  then all 'off' pixels in the images drawn will use the
212
+  pixel value from Blt. This flag cannot be used if Blt is NULL
213
+  upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image
214
+  will be written directly to the output device specified by
215
+  Screen. Otherwise the image will be rendered to the bitmap
216
+  specified by Bitmap.
217
+
218
+
219
+  @param This       A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
220
+
221
+  @param Flags      Describes how the image is to be drawn.
222
+                    EFI_HII_DRAW_FLAGS is defined in Related
223
+                    Definitions, below.
224
+
225
+  @param Image      Points to the image to be displayed.
226
+
227
+  @param Blt        If this points to a non-NULL on entry, this points
228
+                    to the image, which is Width pixels wide and
229
+                    Height pixels high. The image will be drawn onto
230
+                    this image and EFI_HII_DRAW_FLAG_CLIP is implied.
231
+                    If this points to a NULL on entry, then a buffer
232
+                    will be allocated to hold the generated image and
233
+                    the pointer updated on exit. It is the caller's
234
+                    responsibility to free this buffer.
235
+
236
+  @param BltX, BltY Specifies the offset from the left and top
237
+                    edge of the image of the first pixel in
238
+                    the image.
239
+
240
+  @retval EFI_SUCCESS           The image was successfully updated.
241
+
242
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output
243
+                                buffer for RowInfoArray or Blt.
244
+
245
+  @retval EFI_INVALID_PARAMETER The Image or Blt or Height or
246
+                                Width was NULL.
247
+
248
+
249
+**/
250
+typedef
251
+EFI_STATUS
252
+(EFIAPI *EFI_HII_DRAW_IMAGE)(
253
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,
254
+  IN        EFI_HII_DRAW_FLAGS      Flags,
255
+  IN CONST  EFI_IMAGE_INPUT         *Image,
256
+  IN OUT    EFI_IMAGE_OUTPUT        **Blt,
257
+  IN        UINTN                   BltX,
258
+  IN        UINTN                   BltY
259
+);
260
+
261
+/**
262
+
263
+  This function renders an image as a bitmap or to the screen and
264
+  can clip the image. The bitmap is either supplied by the caller
265
+  or else is allocated by the function. The images can be drawn
266
+  transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,
267
+  then all pixels drawn outside the bounding box specified by
268
+  Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT
269
+  is set, then all "off" pixels in the character's glyph will
270
+  use the pixel value from Blt. This flag cannot be used if Blt
271
+  is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then
272
+  the image will be written directly to the output device
273
+  specified by Screen. Otherwise the image will be rendered to
274
+  the bitmap specified by Bitmap.
275
+  This function renders an image to a bitmap or the screen using
276
+  the specified color and options. It draws the image on an
277
+  existing bitmap, allocates a new bitmap or uses the screen. The
278
+  images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then
279
+  all pixels drawn outside the bounding box specified by Width and
280
+  Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag
281
+  determines whether the image will be drawn transparent or
282
+  opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image
283
+  will be drawn so that all 'off' pixels in the image will
284
+  be drawn using the pixel value from Blt and all other pixels
285
+  will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then
286
+  the image's pixels will be copied directly to the
287
+  destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image
288
+  will be drawn transparently or opaque, depending on the
289
+  image's transparency setting (see EFI_IMAGE_TRANSPARENT).
290
+  Images cannot be drawn transparently if Blt is NULL. If
291
+  EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written
292
+  directly to the output device specified by Screen. Otherwise the
293
+  image will be rendered to the bitmap specified by Bitmap.
294
+
295
+  @param This         A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
296
+
297
+  @param Flags        Describes how the image is to be drawn.
298
+
299
+  @param PackageList  The package list in the HII database to
300
+                      search for the specified image.
301
+
302
+  @param ImageId      The image's id, which is unique within PackageList.
303
+
304
+  @param Blt          If this points to a non-NULL on entry, this points
305
+                      to the image, which is Width pixels wide and
306
+                      Height pixels high. The image will be drawn onto
307
+                      this image and EFI_HII_DRAW_FLAG_CLIP is implied.
308
+                      If this points to a NULL on entry, then a buffer
309
+                      will be allocated to hold the generated image and
310
+                      the pointer updated on exit. It is the caller's
311
+                      responsibility to free this buffer.
312
+
313
+  @param BltX, BltY   Specifies the offset from the left and top
314
+                      edge of the output image of the first
315
+                      pixel in the image.
316
+
317
+  @retval EFI_SUCCESS           The image was successfully updated.
318
+
319
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output
320
+                                buffer for RowInfoArray or Blt.
321
+
322
+  @retval EFI_NOT_FOUND         The image specified by ImageId is not in the database.
323
+                                Or The specified PackageList is not in the database.
324
+
325
+  @retval EFI_INVALID_PARAMETER The Blt was NULL.
326
+
327
+**/
328
+typedef
329
+EFI_STATUS
330
+(EFIAPI *EFI_HII_DRAW_IMAGE_ID)(
331
+IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,
332
+IN        EFI_HII_DRAW_FLAGS      Flags,
333
+IN        EFI_HII_HANDLE          PackageList,
334
+IN        EFI_IMAGE_ID            ImageId,
335
+IN OUT    EFI_IMAGE_OUTPUT        **Blt,
336
+IN        UINTN                   BltX,
337
+IN        UINTN                   BltY
338
+);
339
+
340
+
341
+///
342
+/// Services to access to images in the images database.
343
+///
344
+struct _EFI_HII_IMAGE_PROTOCOL {
345
+  EFI_HII_NEW_IMAGE     NewImage;
346
+  EFI_HII_GET_IMAGE     GetImage;
347
+  EFI_HII_SET_IMAGE     SetImage;
348
+  EFI_HII_DRAW_IMAGE    DrawImage;
349
+  EFI_HII_DRAW_IMAGE_ID DrawImageId;
350
+};
351
+
352
+extern EFI_GUID gEfiHiiImageProtocolGuid;
353
+
354
+#endif
355
+
356
+

+ 1
- 0
src/include/ipxe/efi/efi.h Прегледај датотеку

@@ -168,6 +168,7 @@ extern EFI_GUID efi_disk_io_protocol_guid;
168 168
 extern EFI_GUID efi_driver_binding_protocol_guid;
169 169
 extern EFI_GUID efi_graphics_output_protocol_guid;
170 170
 extern EFI_GUID efi_hii_config_access_protocol_guid;
171
+extern EFI_GUID efi_hii_font_protocol_guid;
171 172
 extern EFI_GUID efi_ip4_protocol_guid;
172 173
 extern EFI_GUID efi_ip4_config_protocol_guid;
173 174
 extern EFI_GUID efi_ip4_service_binding_protocol_guid;

+ 2
- 0
src/interface/efi/efi_debug.c Прегледај датотеку

@@ -99,6 +99,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
99 99
 	  "GraphicsOutput" },
100 100
 	{ &efi_hii_config_access_protocol_guid,
101 101
 	  "HiiConfigAccess" },
102
+	{ &efi_hii_font_protocol_guid,
103
+	  "HiiFont" },
102 104
 	{ &efi_ip4_protocol_guid,
103 105
 	  "Ip4" },
104 106
 	{ &efi_ip4_config_protocol_guid,

+ 5
- 0
src/interface/efi/efi_guid.c Прегледај датотеку

@@ -38,6 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
38 38
 #include <ipxe/efi/Protocol/DriverBinding.h>
39 39
 #include <ipxe/efi/Protocol/GraphicsOutput.h>
40 40
 #include <ipxe/efi/Protocol/HiiConfigAccess.h>
41
+#include <ipxe/efi/Protocol/HiiFont.h>
41 42
 #include <ipxe/efi/Protocol/Ip4.h>
42 43
 #include <ipxe/efi/Protocol/Ip4Config.h>
43 44
 #include <ipxe/efi/Protocol/LoadFile.h>
@@ -137,6 +138,10 @@ EFI_GUID efi_graphics_output_protocol_guid
137 138
 EFI_GUID efi_hii_config_access_protocol_guid
138 139
 	= EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID;
139 140
 
141
+/** HII font protocol GUID */
142
+EFI_GUID efi_hii_font_protocol_guid
143
+	= EFI_HII_FONT_PROTOCOL_GUID;
144
+
140 145
 /** IPv4 protocol GUID */
141 146
 EFI_GUID efi_ip4_protocol_guid
142 147
 	= EFI_IP4_PROTOCOL_GUID;

Loading…
Откажи
Сачувај