• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef IMAGE_PLUGIN_TYPE_H
17 #define IMAGE_PLUGIN_TYPE_H
18 
19 #include <cstdint>
20 
21 namespace OHOS {
22 namespace ImagePlugin {
23 enum class PlColorSpace {
24     // unknown color space.
25     UNKNOWN = 0,
26 
27     // based on SMPTE RP 431-2-2007 & IEC 61966-2.1:1999.
28     DISPLAY_P3 = 1,
29 
30     // standard Red Green Blue based on IEC 61966-2.1:1999.
31     SRGB = 2,
32 
33     // SRGB with a linear transfer function based on IEC 61966-2.1:1999.
34     LINEAR_SRGB = 3,
35 
36     // based on IEC 61966-2-2:2003.
37     EXTENDED_SRGB = 4,
38 
39     // based on IEC 61966-2-2:2003.
40     LINEAR_EXTENDED_SRGB = 5,
41 
42     // based on standard illuminant D50 as the white point.
43     GENERIC_XYZ = 6,
44 
45     // based on CIE XYZ D50 as the profile conversion space.
46     GENERIC_LAB = 7,
47 
48     // based on SMPTE ST 2065-1:2012.
49     ACES = 8,
50 
51     // based on Academy S-2014-004.
52     ACES_CG = 9,
53 
54     // based on Adobe RGB (1998).
55     ADOBE_RGB_1998 = 10,
56 
57     // based on SMPTE RP 431-2-2007.
58     DCI_P3 = 11,
59 
60     // based on Rec. ITU-R BT.709-5.
61     ITU_709 = 12,
62 
63     // based on Rec. ITU-R BT.2020-1.
64     ITU_2020 = 13,
65 
66     // based on ROMM RGB ISO 22028-2:2013.
67     ROMM_RGB = 14,
68 
69     // based on 1953 standard.
70     NTSC_1953 = 15,
71 
72     // based on SMPTE C.
73     SMPTE_C = 16
74 };
75 
76 enum class PlEncodedFormat {
77     UNKNOWN = 0,
78     JPEG = 1,
79     PNG = 2,
80     GIF = 3,
81     HEIF = 4
82 };
83 
84 enum class PlPixelFormat {
85     UNKNOWN = 0,
86     ARGB_8888 = 1,
87     RGB_565 = 2,
88     RGBA_8888 = 3,
89     BGRA_8888 = 4,
90     RGB_888 = 5,
91     ALPHA_8 = 6,
92     RGBA_F16 = 7,
93     NV21 = 8,
94     NV12 = 9,
95     CMYK = 10,
96 };
97 
98 enum class PlAlphaType : int32_t {
99     IMAGE_ALPHA_TYPE_UNKNOWN = 0,
100     IMAGE_ALPHA_TYPE_OPAQUE = 1,
101     IMAGE_ALPHA_TYPE_PREMUL = 2,
102     IMAGE_ALPHA_TYPE_UNPREMUL = 3,
103 };
104 
105 struct PlPosition {
106     uint32_t x = 0;
107     uint32_t y = 0;
108 };
109 
110 struct PlRect {
111     uint32_t left = 0;
112     uint32_t top = 0;
113     uint32_t width = 0;
114     uint32_t height = 0;
115 };
116 
117 struct PlSize {
118     uint32_t width = 0;
119     uint32_t height = 0;
120 };
121 
122 struct PlFillColor {
123     bool isValidColor = false;
124     uint32_t color = 0;
125 };
126 
127 struct PlSVGResize {
128     bool isValidPercentage = false;
129     uint32_t resizePercentage = 100;
130 };
131 
132 struct PlImageInfo {
133     PlSize size;
134     PlPixelFormat pixelFormat = PlPixelFormat::UNKNOWN;
135     PlColorSpace colorSpace = PlColorSpace::UNKNOWN;
136     PlAlphaType alphaType = PlAlphaType::IMAGE_ALPHA_TYPE_UNKNOWN;
137 };
138 
139 struct PlImageBuffer {
140     void *buffer = nullptr;
141     uint32_t bufferSize = 0;
142     uint32_t dataSize = 0;
143     void *context = nullptr;
144 };
145 } // namespace ImagePlugin
146 } // namespace OHOS
147 
148 #endif // IMAGE_PLUGIN_TYPE_H
149