]>
Commit | Line | Data |
---|---|---|
a48d0a3d CS |
1 | /** @file\r |
2 | This protocol provides generic image decoder interfaces to various image formats.\r | |
3 | \r | |
4 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r | |
497a5fb1 | 5 | Copyright (c) 2016-2018, Intel Corporation. All rights reserved.<BR>\r |
a48d0a3d CS |
6 | \r |
7 | This program and the accompanying materials are licensed and made available under\r | |
8 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
9 | The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php.\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
497a5fb1 SZ |
15 | @par Revision Reference:\r |
16 | This Protocol was introduced in UEFI Specification 2.6.\r | |
17 | \r | |
a48d0a3d | 18 | **/\r |
75f273d8 RN |
19 | #ifndef __HII_IMAGE_DECODER_H__\r |
20 | #define __HII_IMAGE_DECODER_H__\r | |
a48d0a3d CS |
21 | \r |
22 | #include <Protocol/HiiImage.h>\r | |
23 | \r | |
a48d0a3d | 24 | #define EFI_HII_IMAGE_DECODER_PROTOCOL_GUID \\r |
d35ec1e0 | 25 | {0x9e66f251, 0x727c, 0x418c, { 0xbf, 0xd6, 0xc2, 0xb4, 0x25, 0x28, 0x18, 0xea }}\r |
a48d0a3d CS |
26 | \r |
27 | \r | |
28 | #define EFI_HII_IMAGE_DECODER_NAME_JPEG_GUID \\r | |
29 | {0xefefd093, 0xd9b, 0x46eb, { 0xa8, 0x56, 0x48, 0x35, 0x7, 0x0, 0xc9, 0x8 }}\r | |
30 | \r | |
31 | #define EFI_HII_IMAGE_DECODER_NAME_PNG_GUID \\r | |
32 | {0xaf060190, 0x5e3a, 0x4025, { 0xaf, 0xbd, 0xe1, 0xf9, 0x5, 0xbf, 0xaa, 0x4c }}\r | |
33 | \r | |
34 | typedef struct _EFI_HII_IMAGE_DECODER_PROTOCOL EFI_HII_IMAGE_DECODER_PROTOCOL;\r | |
35 | \r | |
36 | typedef enum {\r | |
37 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGB = 0x0,\r | |
38 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_RGBA = 0x1,\r | |
39 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_CMYK = 0x2,\r | |
40 | EFI_HII_IMAGE_DECODER_COLOR_TYPE_UNKNOWN = 0xFF\r | |
41 | } EFI_HII_IMAGE_DECODER_COLOR_TYPE;\r | |
42 | \r | |
43 | //\r | |
44 | // EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER\r | |
45 | //\r | |
46 | // DecoderName Name of the decoder\r | |
47 | // ImageInfoSize The size of entire image information structure in bytes\r | |
48 | // ImageWidth The image width\r | |
49 | // ImageHeight The image height\r | |
50 | // ColorType The color type, see EFI_HII_IMAGE_DECODER_COLOR_TYPE.\r | |
51 | // ColorDepthInBits The color depth in bits\r | |
52 | //\r | |
53 | typedef struct _EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER {\r | |
54 | EFI_GUID DecoderName;\r | |
55 | UINT16 ImageInfoSize;\r | |
56 | UINT16 ImageWidth;\r | |
57 | UINT16 ImageHeight;\r | |
58 | EFI_HII_IMAGE_DECODER_COLOR_TYPE ColorType;\r | |
59 | UINT8 ColorDepthInBits;\r | |
60 | } EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER;\r | |
61 | \r | |
75f273d8 RN |
62 | #define EFI_IMAGE_JPEG_SCANTYPE_PROGREESSIVE 0x01\r |
63 | #define EFI_IMAGE_JPEG_SCANTYPE_INTERLACED 0x02\r | |
64 | \r | |
a48d0a3d CS |
65 | //\r |
66 | // EFI_HII_IMAGE_DECODER_JPEG_INFO\r | |
67 | // Header The common header\r | |
68 | // ScanType The scan type of JPEG image\r | |
69 | // Reserved Reserved\r | |
70 | //\r | |
71 | typedef struct _EFI_HII_IMAGE_DECODER_JPEG_INFO {\r | |
72 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
a48d0a3d CS |
73 | UINT16 ScanType;\r |
74 | UINT64 Reserved;\r | |
75 | } EFI_HII_IMAGE_DECODER_JPEG_INFO;\r | |
76 | \r | |
77 | //\r | |
78 | // EFI_HII_IMAGE_DECODER_PNG_INFO\r | |
79 | // Header The common header\r | |
80 | // Channels Number of channels in the PNG image\r | |
81 | // Reserved Reserved\r | |
82 | //\r | |
83 | typedef struct _EFI_HII_IMAGE_DECODER_PNG_INFO {\r | |
84 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
85 | UINT16 Channels;\r | |
86 | UINT64 Reserved;\r | |
87 | } EFI_HII_IMAGE_DECODER_PNG_INFO;\r | |
88 | \r | |
75f273d8 RN |
89 | //\r |
90 | // EFI_HII_IMAGE_DECODER_OTHER_INFO\r | |
91 | //\r | |
92 | typedef struct _EFI_HII_IMAGE_DECODER_OTHER_INFO {\r | |
93 | EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER Header;\r | |
94 | CHAR16 ImageExtenion[1];\r | |
95 | //\r | |
96 | // Variable length of image file extension name.\r | |
97 | //\r | |
98 | } EFI_HII_IMAGE_DECODER_OTHER_INFO;\r | |
99 | \r | |
a48d0a3d CS |
100 | /**\r |
101 | There could be more than one EFI_HII_IMAGE_DECODER_PROTOCOL instances installed\r | |
102 | in the system for different image formats. This function returns the decoder\r | |
103 | name which callers can use to find the proper image decoder for the image. It\r | |
104 | is possible to support multiple image formats in one EFI_HII_IMAGE_DECODER_PROTOCOL.\r | |
105 | The capability of the supported image formats is returned in DecoderName and\r | |
106 | NumberOfDecoderName.\r | |
107 | \r | |
108 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
109 | @param DecoderName Pointer to a dimension to retrieve the decoder\r | |
110 | names in EFI_GUID format. The number of the\r | |
111 | decoder names is returned in NumberOfDecoderName.\r | |
112 | @param NumberofDecoderName Pointer to retrieve the number of decoders which\r | |
113 | supported by this decoder driver.\r | |
114 | \r | |
115 | @retval EFI_SUCCESS Get decoder name success.\r | |
116 | @retval EFI_UNSUPPORTED Get decoder name fail.\r | |
117 | \r | |
118 | **/\r | |
119 | typedef\r | |
120 | EFI_STATUS\r | |
75f273d8 | 121 | (EFIAPI *EFI_HII_IMAGE_DECODER_GET_NAME)(\r |
a48d0a3d CS |
122 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r |
123 | IN OUT EFI_GUID **DecoderName,\r | |
75f273d8 | 124 | IN OUT UINT16 *NumberOfDecoderName\r |
a48d0a3d CS |
125 | );\r |
126 | \r | |
127 | /**\r | |
128 | This function returns the image information of the given image raw data. This\r | |
129 | function first checks whether the image raw data is supported by this decoder\r | |
130 | or not. This function may go through the first few bytes in the image raw data\r | |
131 | for the specific data structure or the image signature. If the image is not supported\r | |
132 | by this image decoder, this function returns EFI_UNSUPPORTED to the caller.\r | |
133 | Otherwise, this function returns the proper image information to the caller.\r | |
134 | It is the caller?s responsibility to free the ImageInfo.\r | |
135 | \r | |
136 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
137 | @param Image Pointer to the image raw data.\r | |
138 | @param SizeOfImage Size of the entire image raw data.\r | |
00b7cc0f | 139 | @param ImageInfo Pointer to receive EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER.\r |
a48d0a3d CS |
140 | \r |
141 | @retval EFI_SUCCESS Get image info success.\r | |
142 | @retval EFI_UNSUPPORTED Unsupported format of image.\r | |
143 | @retval EFI_INVALID_PARAMETER Incorrect parameter.\r | |
144 | @retval EFI_BAD_BUFFER_SIZE Not enough memory.\r | |
145 | \r | |
146 | **/\r | |
147 | typedef\r | |
148 | EFI_STATUS\r | |
149 | (EFIAPI *EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO)(\r | |
150 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r | |
151 | IN VOID *Image,\r | |
152 | IN UINTN SizeOfImage,\r | |
153 | IN OUT EFI_HII_IMAGE_DECODER_IMAGE_INFO_HEADER **ImageInfo\r | |
154 | );\r | |
155 | \r | |
156 | /**\r | |
157 | This function decodes the image which the image type of this image is supported\r | |
158 | by this EFI_HII_IMAGE_DECODER_PROTOCOL. If **Bitmap is not NULL, the caller intends\r | |
159 | to put the image in the given image buffer. That allows the caller to put an\r | |
160 | image overlap on the original image. The transparency is handled by the image\r | |
161 | decoder because the transparency capability depends on the image format. Callers\r | |
162 | can set Transparent to FALSE to force disabling the transparency process on the\r | |
163 | image. Forcing Transparent to FALSE may also improve the performance of the image\r | |
164 | decoding because the image decoder can skip the transparency processing. If **Bitmap\r | |
165 | is NULL, the image decoder allocates the memory buffer for the EFI_IMAGE_OUTPUT\r | |
166 | and decodes the image to the image buffer. It is the caller?s responsibility to\r | |
167 | free the memory for EFI_IMAGE_OUTPUT. Image decoder doesn?t have to handle the\r | |
168 | transparency in this case because there is no background image given by the caller.\r | |
169 | The background color in this case is all black (#00000000).\r | |
170 | \r | |
171 | @param This EFI_HII_IMAGE_DECODER_PROTOCOL instance.\r | |
172 | @param Image Pointer to the image raw data.\r | |
173 | @param ImageRawDataSize Size of the entire image raw data.\r | |
174 | @param Blt EFI_IMAGE_OUTPUT to receive the image or overlap\r | |
175 | the image on the original buffer.\r | |
176 | @param Transparent BOOLEAN value indicates whether the image decoder\r | |
177 | has to handle the transparent image or not.\r | |
178 | \r | |
179 | \r | |
180 | @retval EFI_SUCCESS Image decode success.\r | |
181 | @retval EFI_UNSUPPORTED Unsupported format of image.\r | |
182 | @retval EFI_INVALID_PARAMETER Incorrect parameter.\r | |
183 | @retval EFI_BAD_BUFFER_SIZE Not enough memory.\r | |
184 | \r | |
185 | **/\r | |
186 | typedef\r | |
187 | EFI_STATUS\r | |
188 | (EFIAPI *EFI_HII_IMAGE_DECODER_DECODE)(\r | |
189 | IN EFI_HII_IMAGE_DECODER_PROTOCOL *This,\r | |
190 | IN VOID *Image,\r | |
191 | IN UINTN ImageRawDataSize,\r | |
75f273d8 | 192 | IN OUT EFI_IMAGE_OUTPUT **Bitmap,\r |
a48d0a3d CS |
193 | IN BOOLEAN Transparent\r |
194 | );\r | |
195 | \r | |
196 | struct _EFI_HII_IMAGE_DECODER_PROTOCOL {\r | |
75f273d8 | 197 | EFI_HII_IMAGE_DECODER_GET_NAME GetImageDecoderName;\r |
a48d0a3d CS |
198 | EFI_HII_IMAGE_DECODER_GET_IMAGE_INFO GetImageInfo;\r |
199 | EFI_HII_IMAGE_DECODER_DECODE DecodeImage;\r | |
200 | };\r | |
201 | \r | |
202 | extern EFI_GUID gEfiHiiImageDecoderProtocolGuid;\r | |
203 | extern EFI_GUID gEfiHiiImageDecoderNameJpegGuid;\r | |
204 | extern EFI_GUID gEfiHiiImageDecoderNamePngGuid;\r | |
205 | \r | |
206 | #endif\r |