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