Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
SkEncodedInfo Struct Reference

#include <SkEncodedInfo.h>

Classes

class  ICCProfile
 

Public Types

enum  Alpha { kOpaque_Alpha , kUnpremul_Alpha , kBinary_Alpha }
 
enum  Color {
  kGray_Color , kGrayAlpha_Color , kXAlpha_Color , k565_Color ,
  kPalette_Color , kRGB_Color , kRGBA_Color , kBGR_Color ,
  kBGRX_Color , kBGRA_Color , kYUV_Color , kYUVA_Color ,
  kInvertedCMYK_Color , kYCCK_Color
}
 

Public Member Functions

SkImageInfo makeImageInfo () const
 
int width () const
 
int height () const
 
Color color () const
 
Alpha alpha () const
 
bool opaque () const
 
const skcms_ICCProfileprofile () const
 
sk_sp< SkDataprofileData () const
 
uint8_t bitsPerComponent () const
 
uint8_t bitsPerPixel () const
 
 SkEncodedInfo (const SkEncodedInfo &orig)=delete
 
SkEncodedInfooperator= (const SkEncodedInfo &)=delete
 
 SkEncodedInfo (SkEncodedInfo &&orig)=default
 
SkEncodedInfooperator= (SkEncodedInfo &&)=default
 
SkEncodedInfo copy () const
 
uint8_t getColorDepth () const
 

Static Public Member Functions

static SkEncodedInfo Make (int width, int height, Color color, Alpha alpha, int bitsPerComponent)
 
static SkEncodedInfo Make (int width, int height, Color color, Alpha alpha, int bitsPerComponent, std::unique_ptr< ICCProfile > profile)
 
static SkEncodedInfo Make (int width, int height, Color color, Alpha alpha, int bitsPerComponent, std::unique_ptr< ICCProfile > profile, int colorDepth)
 

Detailed Description

Definition at line 25 of file SkEncodedInfo.h.

Member Enumeration Documentation

◆ Alpha

Enumerator
kOpaque_Alpha 
kUnpremul_Alpha 
kBinary_Alpha 

Definition at line 41 of file SkEncodedInfo.h.

41 {
44
45 // Each pixel is either fully opaque or fully transparent.
46 // There is no difference between requesting kPremul or kUnpremul.
48 };

◆ Color

Enumerator
kGray_Color 
kGrayAlpha_Color 
kXAlpha_Color 
k565_Color 
kPalette_Color 
kRGB_Color 
kRGBA_Color 
kBGR_Color 
kBGRX_Color 
kBGRA_Color 
kYUV_Color 
kYUVA_Color 
kInvertedCMYK_Color 
kYCCK_Color 

Definition at line 58 of file SkEncodedInfo.h.

58 {
59 // PNG, WBMP
61
62 // PNG
64
65 // PNG with Skia-specific sBIT
66 // Like kGrayAlpha, except this expects to be treated as
67 // kAlpha_8_SkColorType, which ignores the gray component. If
68 // decoded to full color (e.g. kN32), the gray component is respected
69 // (so it can share code with kGrayAlpha).
71
72 // PNG
73 // 565 images may be encoded to PNG by specifying the number of
74 // significant bits for each channel. This is a strange 565
75 // representation because the image is still encoded with 8 bits per
76 // component.
78
79 // PNG, GIF, BMP
81
82 // PNG, RAW
85
86 // BMP
90
91 // JPEG, WEBP
93
94 // WEBP
96
97 // JPEG
98 // Photoshop actually writes inverted CMYK data into JPEGs, where zero
99 // represents 100% ink coverage. For this reason, we treat CMYK JPEGs
100 // as having inverted CMYK. libjpeg-turbo warns that this may break
101 // other applications, but the CMYK JPEGs we see on the web expect to
102 // be treated as inverted CMYK.
105 };

Constructor & Destructor Documentation

◆ SkEncodedInfo() [1/2]

SkEncodedInfo::SkEncodedInfo ( const SkEncodedInfo orig)
delete

◆ SkEncodedInfo() [2/2]

SkEncodedInfo::SkEncodedInfo ( SkEncodedInfo &&  orig)
default

Member Function Documentation

◆ alpha()

Alpha SkEncodedInfo::alpha ( ) const
inline

Definition at line 201 of file SkEncodedInfo.h.

201{ return fAlpha; }

◆ bitsPerComponent()

uint8_t SkEncodedInfo::bitsPerComponent ( ) const
inline

Definition at line 212 of file SkEncodedInfo.h.

212{ return fBitsPerComponent; }

◆ bitsPerPixel()

uint8_t SkEncodedInfo::bitsPerPixel ( ) const
inline

Definition at line 214 of file SkEncodedInfo.h.

214 {
215 switch (fColor) {
216 case kGray_Color:
217 return fBitsPerComponent;
218 case kXAlpha_Color:
219 case kGrayAlpha_Color:
220 return 2 * fBitsPerComponent;
221 case kPalette_Color:
222 return fBitsPerComponent;
223 case kRGB_Color:
224 case kBGR_Color:
225 case kYUV_Color:
226 case k565_Color:
227 return 3 * fBitsPerComponent;
228 case kRGBA_Color:
229 case kBGRA_Color:
230 case kBGRX_Color:
231 case kYUVA_Color:
233 case kYCCK_Color:
234 return 4 * fBitsPerComponent;
235 default:
236 SkASSERT(false);
237 return 0;
238 }
239 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ color()

Color SkEncodedInfo::color ( ) const
inline

Definition at line 200 of file SkEncodedInfo.h.

200{ return fColor; }

◆ copy()

SkEncodedInfo SkEncodedInfo::copy ( ) const
inline

Definition at line 248 of file SkEncodedInfo.h.

248 {
250 fWidth, fHeight, fColor, fAlpha, fBitsPerComponent, nullptr, fColorDepth);
251 if (fProfile) {
252 copy.fProfile = std::make_unique<ICCProfile>(*fProfile);
253 }
254 return copy;
255 }
Definition copy.py:1
SkEncodedInfo copy() const
static SkEncodedInfo Make(int width, int height, Color color, Alpha alpha, int bitsPerComponent)

◆ getColorDepth()

uint8_t SkEncodedInfo::getColorDepth ( ) const
inline

Definition at line 258 of file SkEncodedInfo.h.

258 {
259 return fColorDepth;
260 }

◆ height()

int SkEncodedInfo::height ( ) const
inline

Definition at line 199 of file SkEncodedInfo.h.

199{ return fHeight; }

◆ Make() [1/3]

static SkEncodedInfo SkEncodedInfo::Make ( int  width,
int  height,
Color  color,
Alpha  alpha,
int  bitsPerComponent 
)
inlinestatic

Definition at line 107 of file SkEncodedInfo.h.

108 {
109 return Make(width, height, color, alpha, bitsPerComponent, nullptr);
110 }
Color color() const
int width() const
int height() const
Alpha alpha() const
uint8_t bitsPerComponent() const

◆ Make() [2/3]

static SkEncodedInfo SkEncodedInfo::Make ( int  width,
int  height,
Color  color,
Alpha  alpha,
int  bitsPerComponent,
std::unique_ptr< ICCProfile profile 
)
inlinestatic

Definition at line 112 of file SkEncodedInfo.h.

113 {
114 return Make(width, height, color, alpha, /*bitsPerComponent*/ bitsPerComponent,
115 std::move(profile), /*colorDepth*/ bitsPerComponent);
116 }
const skcms_ICCProfile * profile() const

◆ Make() [3/3]

static SkEncodedInfo SkEncodedInfo::Make ( int  width,
int  height,
Color  color,
Alpha  alpha,
int  bitsPerComponent,
std::unique_ptr< ICCProfile profile,
int  colorDepth 
)
inlinestatic

Definition at line 118 of file SkEncodedInfo.h.

120 {
122 2 == bitsPerComponent ||
123 4 == bitsPerComponent ||
124 8 == bitsPerComponent ||
125 16 == bitsPerComponent);
126
127 switch (color) {
128 case kGray_Color:
130 break;
131 case kGrayAlpha_Color:
133 break;
134 case kPalette_Color:
136 break;
137 case kRGB_Color:
138 case kBGR_Color:
139 case kBGRX_Color:
142 break;
143 case kYUV_Color:
145 case kYCCK_Color:
148 break;
149 case kRGBA_Color:
151 break;
152 case kBGRA_Color:
153 case kYUVA_Color:
155 break;
156 case kXAlpha_Color:
159 break;
160 case k565_Color:
163 break;
164 default:
165 SkASSERT(false);
166 break;
167 }
168
169 return SkEncodedInfo(width,
170 height,
171 color,
172 alpha,
174 SkToU8(colorDepth),
175 std::move(profile));
176 }
constexpr uint8_t SkToU8(S x)
Definition SkTo.h:22

◆ makeImageInfo()

SkImageInfo SkEncodedInfo::makeImageInfo ( ) const
inline

Definition at line 183 of file SkEncodedInfo.h.

183 {
184 auto ct = kGray_Color == fColor ? kGray_8_SkColorType :
186 k565_Color == fColor ? kRGB_565_SkColorType :
187 kN32_SkColorType ;
188 auto alpha = kOpaque_Alpha == fAlpha ? kOpaque_SkAlphaType
190 sk_sp<SkColorSpace> cs = fProfile ? SkColorSpace::Make(*fProfile->profile())
191 : nullptr;
192 if (!cs) {
194 }
195 return SkImageInfo::Make(fWidth, fHeight, ct, alpha, std::move(cs));
196 }
kUnpremul_SkAlphaType
@ kOpaque_SkAlphaType
pixel is opaque
Definition SkAlphaType.h:28
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition SkColorType.h:21
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > Make(const skcms_ICCProfile &)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ opaque()

bool SkEncodedInfo::opaque ( ) const
inline

Definition at line 202 of file SkEncodedInfo.h.

202{ return fAlpha == kOpaque_Alpha; }

◆ operator=() [1/2]

SkEncodedInfo & SkEncodedInfo::operator= ( const SkEncodedInfo )
delete

◆ operator=() [2/2]

SkEncodedInfo & SkEncodedInfo::operator= ( SkEncodedInfo &&  )
default

◆ profile()

const skcms_ICCProfile * SkEncodedInfo::profile ( ) const
inline

Definition at line 203 of file SkEncodedInfo.h.

203 {
204 if (!fProfile) return nullptr;
205 return fProfile->profile();
206 }

◆ profileData()

sk_sp< SkData > SkEncodedInfo::profileData ( ) const
inline

Definition at line 207 of file SkEncodedInfo.h.

207 {
208 if (!fProfile) return nullptr;
209 return fProfile->data();
210 }

◆ width()

int SkEncodedInfo::width ( ) const
inline

Definition at line 198 of file SkEncodedInfo.h.

198{ return fWidth; }

The documentation for this struct was generated from the following file: