• 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     ASTC_4X4 = 11,
97     ASTC_6X6 = 12,
98     ASTC_8X8 = 13,
99 };
100 
101 enum class PlAlphaType : int32_t {
102     IMAGE_ALPHA_TYPE_UNKNOWN = 0,
103     IMAGE_ALPHA_TYPE_OPAQUE = 1,
104     IMAGE_ALPHA_TYPE_PREMUL = 2,
105     IMAGE_ALPHA_TYPE_UNPREMUL = 3,
106 };
107 
108 struct PlPosition {
109     uint32_t x = 0;
110     uint32_t y = 0;
111 };
112 
113 struct PlRect {
114     uint32_t left = 0;
115     uint32_t top = 0;
116     uint32_t width = 0;
117     uint32_t height = 0;
118 };
119 
120 struct PlSize {
121     uint32_t width = 0;
122     uint32_t height = 0;
123 };
124 
125 struct PlFillColor {
126     bool isValidColor = false;
127     uint32_t color = 0;
128 };
129 
130 struct PlSVGResize {
131     bool isValidPercentage = false;
132     uint32_t resizePercentage = 100;
133 };
134 
135 struct PlImageInfo {
136     PlSize size;
137     PlPixelFormat pixelFormat = PlPixelFormat::UNKNOWN;
138     PlColorSpace colorSpace = PlColorSpace::UNKNOWN;
139     PlAlphaType alphaType = PlAlphaType::IMAGE_ALPHA_TYPE_UNKNOWN;
140 };
141 
142 struct PlImageBuffer {
143     void *buffer = nullptr;
144     uint32_t bufferSize = 0;
145     uint32_t dataSize = 0;
146     void *context = nullptr;
147 };
148 } // namespace ImagePlugin
149 } // namespace OHOS
150 
151 #endif // IMAGE_PLUGIN_TYPE_H
152