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