Skia
2D Graphics Library
SkImageInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkImageInfo_DEFINED
9 #define SkImageInfo_DEFINED
10 
12 #include "include/core/SkMath.h"
13 #include "include/core/SkRect.h"
14 #include "include/core/SkSize.h"
15 
16 #include "include/private/SkTFitsIn.h"
17 #include "include/private/SkTo.h"
18 
19 class SkReadBuffer;
20 class SkWriteBuffer;
21 
43 };
44 
52 static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) {
53  return kOpaque_SkAlphaType == at;
54 }
55 
57 
78  // in 64-bit word
80  // in 64-bit word
82 
83  // The following 6 colortypes are just for reading from - not for rendering to
85 
88 
92  // and alpha
93 
95 
96 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
97  kN32_SkColorType = kBGRA_8888_SkColorType,
98 
99 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
100  kN32_SkColorType = kRGBA_8888_SkColorType,
101 
102 #else
103  #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
104 #endif
105 };
106 
113 
120 
133  SkAlphaType* canonical = nullptr);
134 
160 
162 
163  // Legacy (deprecated) names:
168 };
169 
178 public:
184  SkColorInfo() = default;
185 
196  : fColorSpace(std::move(cs)), fColorType(ct), fAlphaType(at) {}
197 
198  SkColorInfo(const SkColorInfo&) = default;
199  SkColorInfo(SkColorInfo&&) = default;
200 
201  SkColorInfo& operator=(const SkColorInfo&) = default;
203 
204  SkColorSpace* colorSpace() const { return fColorSpace.get(); }
205  sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
206  SkColorType colorType() const { return fColorType; }
207  SkAlphaType alphaType() const { return fAlphaType; }
208 
209  bool isOpaque() const {
210  return SkAlphaTypeIsOpaque(fAlphaType)
211  || SkColorTypeIsAlwaysOpaque(fColorType);
212  }
213 
214  bool gammaCloseToSRGB() const { return fColorSpace && fColorSpace->gammaCloseToSRGB(); }
215 
217  bool operator==(const SkColorInfo& other) const {
218  return fColorType == other.fColorType && fAlphaType == other.fAlphaType &&
219  SkColorSpace::Equals(fColorSpace.get(), other.fColorSpace.get());
220  }
221 
223  bool operator!=(const SkColorInfo& other) const { return !(*this == other); }
224 
231  SkColorInfo makeAlphaType(SkAlphaType newAlphaType) const {
232  return SkColorInfo(this->colorType(), newAlphaType, this->refColorSpace());
233  }
234 
238  SkColorInfo makeColorType(SkColorType newColorType) const {
239  return SkColorInfo(newColorType, this->alphaType(), this->refColorSpace());
240  }
241 
246  return SkColorInfo(this->colorType(), this->alphaType(), std::move(cs));
247  }
248 
256  int bytesPerPixel() const;
257 
265  int shiftPerPixel() const;
266 
267 private:
268  sk_sp<SkColorSpace> fColorSpace;
269  SkColorType fColorType = kUnknown_SkColorType;
270  SkAlphaType fAlphaType = kUnknown_SkAlphaType;
271 };
272 
284 public:
285 
291  SkImageInfo() = default;
292 
307  static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
308  sk_sp<SkColorSpace> cs = nullptr) {
309  return SkImageInfo({width, height}, {ct, at, std::move(cs)});
310  }
311  static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at,
312  sk_sp<SkColorSpace> cs = nullptr) {
313  return SkImageInfo(dimensions, {ct, at, std::move(cs)});
314  }
315 
326  static SkImageInfo Make(SkISize dimensions, const SkColorInfo& colorInfo) {
327  return SkImageInfo(dimensions, colorInfo);
328  }
329  static SkImageInfo Make(SkISize dimensions, SkColorInfo&& colorInfo) {
330  return SkImageInfo(dimensions, std::move(colorInfo));
331  }
332 
348  static SkImageInfo MakeN32(int width, int height, SkAlphaType at,
349  sk_sp<SkColorSpace> cs = nullptr) {
350  return Make({width, height}, kN32_SkColorType, at, std::move(cs));
351  }
352 
365  static SkImageInfo MakeS32(int width, int height, SkAlphaType at);
366 
381  static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr) {
382  return Make({width, height}, kN32_SkColorType, kPremul_SkAlphaType, std::move(cs));
383  }
384 
398  static SkImageInfo MakeN32Premul(SkISize dimensions, sk_sp<SkColorSpace> cs = nullptr) {
399  return Make(dimensions, kN32_SkColorType, kPremul_SkAlphaType, std::move(cs));
400  }
401 
409  static SkImageInfo MakeA8(int width, int height) {
410  return Make({width, height}, kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr);
411  }
418  static SkImageInfo MakeA8(SkISize dimensions) {
419  return Make(dimensions, kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr);
420  }
421 
432  static SkImageInfo MakeUnknown(int width, int height) {
433  return Make({width, height}, kUnknown_SkColorType, kUnknown_SkAlphaType, nullptr);
434  }
435 
445  return MakeUnknown(0, 0);
446  }
447 
452  int width() const { return fDimensions.width(); }
453 
458  int height() const { return fDimensions.height(); }
459 
460  SkColorType colorType() const { return fColorInfo.colorType(); }
461 
462  SkAlphaType alphaType() const { return fColorInfo.alphaType(); }
463 
469  SkColorSpace* colorSpace() const { return fColorInfo.colorSpace(); }
470 
479  sk_sp<SkColorSpace> refColorSpace() const { return fColorInfo.refColorSpace(); }
480 
486  bool isEmpty() const { return fDimensions.isEmpty(); }
487 
491  const SkColorInfo& colorInfo() const { return fColorInfo; }
492 
502  bool isOpaque() const { return fColorInfo.isOpaque(); }
503 
508  SkISize dimensions() const { return fDimensions; }
509 
514  SkIRect bounds() const { return SkIRect::MakeSize(fDimensions); }
515 
522  bool gammaCloseToSRGB() const { return fColorInfo.gammaCloseToSRGB(); }
523 
531  SkImageInfo makeWH(int newWidth, int newHeight) const {
532  return Make({newWidth, newHeight}, fColorInfo);
533  }
534 
542  return Make(newSize, fColorInfo);
543  }
544 
553  SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const {
554  return Make(fDimensions, fColorInfo.makeAlphaType(newAlphaType));
555  }
556 
562  SkImageInfo makeColorType(SkColorType newColorType) const {
563  return Make(fDimensions, fColorInfo.makeColorType(newColorType));
564  }
565 
573  return Make(fDimensions, fColorInfo.makeColorSpace(std::move(cs)));
574  }
575 
581  int bytesPerPixel() const { return fColorInfo.bytesPerPixel(); }
582 
588  int shiftPerPixel() const { return fColorInfo.shiftPerPixel(); }
589 
596  uint64_t minRowBytes64() const {
597  return (uint64_t)sk_64_mul(this->width(), this->bytesPerPixel());
598  }
599 
606  size_t minRowBytes() const {
607  uint64_t minRowBytes = this->minRowBytes64();
608  if (!SkTFitsIn<int32_t>(minRowBytes)) {
609  return 0;
610  }
611  return (size_t)minRowBytes;
612  }
613 
626  size_t computeOffset(int x, int y, size_t rowBytes) const;
627 
634  bool operator==(const SkImageInfo& other) const {
635  return fDimensions == other.fDimensions && fColorInfo == other.fColorInfo;
636  }
637 
644  bool operator!=(const SkImageInfo& other) const {
645  return !(*this == other);
646  }
647 
659  size_t computeByteSize(size_t rowBytes) const;
660 
669  size_t computeMinByteSize() const {
670  return this->computeByteSize(this->minRowBytes());
671  }
672 
679  static bool ByteSizeOverflowed(size_t byteSize) {
680  return SIZE_MAX == byteSize;
681  }
682 
689  bool validRowBytes(size_t rowBytes) const {
690  if (rowBytes < this->minRowBytes64()) {
691  return false;
692  }
693  int shift = this->shiftPerPixel();
694  size_t alignedRowBytes = rowBytes >> shift << shift;
695  return alignedRowBytes == rowBytes;
696  }
697 
701  void reset() { *this = {}; }
702 
706  SkDEBUGCODE(void validate() const;)
707 
708 private:
709  SkColorInfo fColorInfo;
710  SkISize fDimensions = {0, 0};
711 
712  SkImageInfo(SkISize dimensions, const SkColorInfo& colorInfo)
713  : fColorInfo(colorInfo), fDimensions(dimensions) {}
714 
715  SkImageInfo(SkISize dimensions, SkColorInfo&& colorInfo)
716  : fColorInfo(std::move(colorInfo)), fDimensions(dimensions) {}
717 };
718 
719 #endif
kR16G16_unorm_SkColorType
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition: SkImageInfo.h:90
kBT2020_12bit_Full_SkYUVColorSpace
@ kBT2020_12bit_Full_SkYUVColorSpace
Definition: SkImageInfo.h:157
kGray_8_SkColorType
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition: SkImageInfo.h:76
SkImageInfo::height
int height() const
Returns pixel row count.
Definition: SkImageInfo.h:458
SkSize.h
SkImageInfo::isEmpty
bool isEmpty() const
Returns if SkImageInfo describes an empty area of pixels by checking if either width or height is zer...
Definition: SkImageInfo.h:486
SkColorInfo::refColorSpace
sk_sp< SkColorSpace > refColorSpace() const
Definition: SkImageInfo.h:205
kBGRA_1010102_SkColorType
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
Definition: SkImageInfo.h:73
SkColorInfo::SkColorInfo
SkColorInfo(SkColorInfo &&)=default
kUnknown_SkAlphaType
@ kUnknown_SkAlphaType
uninitialized
Definition: SkImageInfo.h:38
SkImageInfo::alphaType
SkAlphaType alphaType() const
Definition: SkImageInfo.h:462
SkColorTypeIsAlwaysOpaque
SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
Returns true if SkColorType always decodes alpha to 1.0, making the pixel fully opaque.
SkColorSpace.h
SkImageInfo::SkImageInfo
SkImageInfo(SkISize dimensions, const SkColorInfo &colorInfo)
Definition: SkImageInfo.h:712
SkColorInfo::isOpaque
bool isOpaque() const
Definition: SkImageInfo.h:209
SkImageInfo::minRowBytes64
uint64_t minRowBytes64() const
Returns minimum bytes per row, computed from pixel width() and SkColorType, which specifies bytesPerP...
Definition: SkImageInfo.h:596
SkYUVColorSpace
SkYUVColorSpace
Definition: SkImageInfo.h:148
SkImageInfo::makeColorSpace
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
Creates SkImageInfo with same SkAlphaType, SkColorType, width, and height, with SkColorSpace set to c...
Definition: SkImageInfo.h:572
SkRect.h
kR16G16B16A16_unorm_SkColorType
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition: SkImageInfo.h:91
SkImageInfo::MakeA8
static SkImageInfo MakeA8(SkISize dimensions)
Creates SkImageInfo from integral dimensions, kAlpha_8_SkColorType, kPremul_SkAlphaType,...
Definition: SkImageInfo.h:418
SkImageInfo::MakeUnknown
static SkImageInfo MakeUnknown()
Creates SkImageInfo from integral dimensions width and height set to zero, kUnknown_SkColorType,...
Definition: SkImageInfo.h:444
kLastEnum_SkYUVColorSpace
@ kLastEnum_SkYUVColorSpace
last valid value
Definition: SkImageInfo.h:161
SkColorInfo::SkColorInfo
SkColorInfo()=default
Creates an SkColorInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, and no SkColorSpace.
SkImageInfo::bounds
SkIRect bounds() const
Returns SkIRect { 0, 0, width(), height() }.
Definition: SkImageInfo.h:514
SkImageInfo::computeOffset
size_t computeOffset(int x, int y, size_t rowBytes) const
Returns byte offset of pixel from pixel base address.
kBT2020_8bit_Limited_SkYUVColorSpace
@ kBT2020_8bit_Limited_SkYUVColorSpace
Definition: SkImageInfo.h:154
SkColorInfo::makeColorSpace
SkColorInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
Creates SkColorInfo with same SkAlphaType, SkColorType, with SkColorSpace set to cs.
Definition: SkImageInfo.h:245
SkImageInfo::ByteSizeOverflowed
static bool ByteSizeOverflowed(size_t byteSize)
Returns true if byteSize equals SIZE_MAX.
Definition: SkImageInfo.h:679
kBGRA_8888_SkColorType
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkImageInfo.h:71
kLastEnum_SkColorType
@ kLastEnum_SkColorType
last valid value
Definition: SkImageInfo.h:94
SkColorTypeValidateAlphaType
SK_API bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, SkAlphaType *canonical=nullptr)
Returns true if canonical can be set to a valid SkAlphaType for colorType.
kRGB_101010x_SkColorType
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition: SkImageInfo.h:74
SkColorInfo::colorType
SkColorType colorType() const
Definition: SkImageInfo.h:206
kBT2020_10bit_Limited_SkYUVColorSpace
@ kBT2020_10bit_Limited_SkYUVColorSpace
Definition: SkImageInfo.h:156
kJPEG_SkYUVColorSpace
@ kJPEG_SkYUVColorSpace
Definition: SkImageInfo.h:164
SkColorInfo::operator==
bool operator==(const SkColorInfo &other) const
Does other represent the same color type, alpha type, and color space?
Definition: SkImageInfo.h:217
SkImageInfo::makeColorType
SkImageInfo makeColorType(SkColorType newColorType) const
Creates SkImageInfo with same SkAlphaType, SkColorSpace, width, and height, with SkColorType set to n...
Definition: SkImageInfo.h:562
kBT2020_12bit_Limited_SkYUVColorSpace
@ kBT2020_12bit_Limited_SkYUVColorSpace
Definition: SkImageInfo.h:158
SkImageInfo::colorSpace
SkColorSpace * colorSpace() const
Returns SkColorSpace, the range of colors.
Definition: SkImageInfo.h:469
sk_sp< SkColorSpace >
kR16G16_float_SkColorType
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition: SkImageInfo.h:87
kJPEG_Full_SkYUVColorSpace
@ kJPEG_Full_SkYUVColorSpace
describes full range
Definition: SkImageInfo.h:149
SkImageInfo::fDimensions
SkDEBUGCODE(void validate() const ;) private SkISize fDimensions
Asserts if internal values are illegal or inconsistent.
Definition: SkImageInfo.h:710
SkImageInfo::shiftPerPixel
int shiftPerPixel() const
Returns bit shift converting row bytes to row pixels.
Definition: SkImageInfo.h:588
SkColorInfo::gammaCloseToSRGB
bool gammaCloseToSRGB() const
Definition: SkImageInfo.h:214
SkImageInfo::makeWH
SkImageInfo makeWH(int newWidth, int newHeight) const
Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType, with dimensions set to ...
Definition: SkImageInfo.h:531
SkDEBUGCODE
#define SkDEBUGCODE(...)
Definition: SkTypes.h:467
kUnpremul_SkAlphaType
@ kUnpremul_SkAlphaType
pixel components are independent of alpha
Definition: SkImageInfo.h:41
SK_API
#define SK_API
Definition: SkTypes.h:181
SkColorInfo::SkColorInfo
SkColorInfo(const SkColorInfo &)=default
SkImageInfo::Make
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs=nullptr)
Creates SkImageInfo from integral dimensions width and height, SkColorType ct, SkAlphaType at,...
Definition: SkImageInfo.h:307
SkImageInfo::gammaCloseToSRGB
bool gammaCloseToSRGB() const
Returns true if associated SkColorSpace is not nullptr, and SkColorSpace gamma is approximately the s...
Definition: SkImageInfo.h:522
kRGBA_F16_SkColorType
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkImageInfo.h:79
SkImageInfo
Definition: SkImageInfo.h:283
sk_64_mul
static int64_t sk_64_mul(int64_t a, int64_t b)
Definition: SkMath.h:18
SkColorTypeBytesPerPixel
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
Returns the number of bytes required to store a pixel, including unused padding.
SkColorInfo::shiftPerPixel
int shiftPerPixel() const
Returns bit shift converting row bytes to row pixels.
SkImageInfo::SkImageInfo
SkImageInfo()=default
Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, a width and height of z...
kBT2020_8bit_Full_SkYUVColorSpace
@ kBT2020_8bit_Full_SkYUVColorSpace
describes UHDTV range, non-constant-luminance
Definition: SkImageInfo.h:153
SkImageInfo::MakeS32
static SkImageInfo MakeS32(int width, int height, SkAlphaType at)
Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, SkAlphaType at,...
SkImageInfo::MakeUnknown
static SkImageInfo MakeUnknown(int width, int height)
Creates SkImageInfo from integral dimensions width and height, kUnknown_SkColorType,...
Definition: SkImageInfo.h:432
kRec601_Limited_SkYUVColorSpace
@ kRec601_Limited_SkYUVColorSpace
describes SDTV range
Definition: SkImageInfo.h:150
SkISize
Definition: SkSize.h:13
kLastEnum_SkAlphaType
@ kLastEnum_SkAlphaType
last valid value
Definition: SkImageInfo.h:42
kRec709_Limited_SkYUVColorSpace
@ kRec709_Limited_SkYUVColorSpace
Definition: SkImageInfo.h:152
SkColorInfo::operator!=
bool operator!=(const SkColorInfo &other) const
Does other represent a different color type, alpha type, or color space?
Definition: SkImageInfo.h:223
sk_sp::get
T * get() const
Definition: SkRefCnt.h:298
SkImageInfo::refColorSpace
sk_sp< SkColorSpace > refColorSpace() const
Returns smart pointer to SkColorSpace, the range of colors.
Definition: SkImageInfo.h:479
SkImageInfo::computeByteSize
size_t computeByteSize(size_t rowBytes) const
Returns storage required by pixel array, given SkImageInfo dimensions, SkColorType,...
SkImageInfo::SkImageInfo
SkImageInfo(SkISize dimensions, SkColorInfo &&colorInfo)
Definition: SkImageInfo.h:715
SkImageInfo::bytesPerPixel
int bytesPerPixel() const
Returns number of bytes per pixel required by SkColorType.
Definition: SkImageInfo.h:581
SkImageInfo::isOpaque
bool isOpaque() const
Returns true if SkAlphaType is set to hint that all pixels are opaque; their alpha value is implicitl...
Definition: SkImageInfo.h:502
SkImageInfo::colorInfo
const SkColorInfo & colorInfo() const
Returns the dimensionless SkColorInfo that represents the same color type, alpha type,...
Definition: SkImageInfo.h:491
kRGBA_1010102_SkColorType
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition: SkImageInfo.h:72
kARGB_4444_SkColorType
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition: SkImageInfo.h:68
SkImageInfo::MakeN32Premul
static SkImageInfo MakeN32Premul(int width, int height, sk_sp< SkColorSpace > cs=nullptr)
Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, kPremul_SkAlphaType,...
Definition: SkImageInfo.h:381
kR8G8_unorm_SkColorType
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
Definition: SkImageInfo.h:84
SkColorInfo::makeColorType
SkColorInfo makeColorType(SkColorType newColorType) const
Creates new SkColorInfo with same SkAlphaType, SkColorSpace, with SkColorType set to newColorType.
Definition: SkImageInfo.h:238
kAlpha_8_SkColorType
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition: SkImageInfo.h:66
SkImageInfo::validRowBytes
bool validRowBytes(size_t rowBytes) const
Returns true if rowBytes is valid for this SkImageInfo.
Definition: SkImageInfo.h:689
kOpaque_SkAlphaType
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkImageInfo.h:39
SkImageInfo::width
int width() const
Returns pixel count in each row.
Definition: SkImageInfo.h:452
kBT2020_SkYUVColorSpace
@ kBT2020_SkYUVColorSpace
Definition: SkImageInfo.h:167
SkImageInfo::makeDimensions
SkImageInfo makeDimensions(SkISize newSize) const
Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType, with dimensions set to ...
Definition: SkImageInfo.h:541
SkImageInfo::Make
static SkImageInfo Make(SkISize dimensions, SkColorInfo &&colorInfo)
Definition: SkImageInfo.h:329
kRGBA_F32_SkColorType
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition: SkImageInfo.h:81
SkImageInfo::MakeN32Premul
static SkImageInfo MakeN32Premul(SkISize dimensions, sk_sp< SkColorSpace > cs=nullptr)
Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, kPremul_SkAlphaType,...
Definition: SkImageInfo.h:398
kA16_unorm_SkColorType
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition: SkImageInfo.h:89
SkImageInfo::colorType
SkColorType colorType() const
Definition: SkImageInfo.h:460
kRGBA_F16Norm_SkColorType
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
Definition: SkImageInfo.h:77
SkColorSpace::Equals
static bool Equals(const SkColorSpace *, const SkColorSpace *)
If both are null, we return true.
SkImageInfo::makeAlphaType
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
Creates SkImageInfo with same SkColorType, SkColorSpace, width, and height, with SkAlphaType set to n...
Definition: SkImageInfo.h:553
SkImageInfo::Make
static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs=nullptr)
Definition: SkImageInfo.h:311
kRGBA_8888_SkColorType
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkImageInfo.h:69
SkColorInfo
Definition: SkImageInfo.h:177
SkImageInfo::operator!=
bool operator!=(const SkImageInfo &other) const
Compares SkImageInfo with other, and returns true if width, height, SkColorType, SkAlphaType,...
Definition: SkImageInfo.h:644
kA16_float_SkColorType
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition: SkImageInfo.h:86
SkIRect::MakeSize
static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize &size)
Returns constructed SkIRect set to (0, 0, size.width(), size.height()).
Definition: SkRect.h:62
SkImageInfo::reset
void reset()
Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, a width and height of z...
Definition: SkImageInfo.h:701
SkIRect
Definition: SkRect.h:28
SkImageInfo::minRowBytes
size_t minRowBytes() const
Returns minimum bytes per row, computed from pixel width() and SkColorType, which specifies bytesPerP...
Definition: SkImageInfo.h:606
SkColorInfo::alphaType
SkAlphaType alphaType() const
Definition: SkImageInfo.h:207
SkColorInfo::operator=
SkColorInfo & operator=(SkColorInfo &&)=default
SkColorInfo::SkColorInfo
SkColorInfo(SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs)
Creates SkColorInfo from SkColorType ct, SkAlphaType at, and optionally SkColorSpace cs.
Definition: SkImageInfo.h:195
SkBlurDrawLooper::Make
sk_sp< SkDrawLooper > SK_API Make(SkColor4f color, SkColorSpace *cs, SkScalar sigma, SkScalar dx, SkScalar dy)
kRGB_565_SkColorType
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkImageInfo.h:67
SkImageInfo::dimensions
SkISize dimensions() const
Returns SkISize { width(), height() }.
Definition: SkImageInfo.h:508
SkImageInfo::Make
static SkImageInfo Make(SkISize dimensions, const SkColorInfo &colorInfo)
Creates SkImageInfo from integral dimensions and SkColorInfo colorInfo,.
Definition: SkImageInfo.h:326
kIdentity_SkYUVColorSpace
@ kIdentity_SkYUVColorSpace
maps Y->R, U->G, V->B
Definition: SkImageInfo.h:159
SkImageInfo::operator==
bool operator==(const SkImageInfo &other) const
Compares SkImageInfo with other, and returns true if width, height, SkColorType, SkAlphaType,...
Definition: SkImageInfo.h:634
SkImageInfo::MakeN32
static SkImageInfo MakeN32(int width, int height, SkAlphaType at, sk_sp< SkColorSpace > cs=nullptr)
Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, SkAlphaType at,...
Definition: SkImageInfo.h:348
kRec709_SkYUVColorSpace
@ kRec709_SkYUVColorSpace
Definition: SkImageInfo.h:166
kBGR_101010x_SkColorType
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition: SkImageInfo.h:75
SkColorType
SkColorType
Definition: SkImageInfo.h:64
kUnknown_SkColorType
@ kUnknown_SkColorType
uninitialized
Definition: SkImageInfo.h:65
SkColorInfo::bytesPerPixel
int bytesPerPixel() const
Returns number of bytes per pixel required by SkColorType.
SkColorInfo::makeAlphaType
SkColorInfo makeAlphaType(SkAlphaType newAlphaType) const
Creates SkColorInfo with same SkColorType, SkColorSpace, with SkAlphaType set to newAlphaType.
Definition: SkImageInfo.h:231
kPremul_SkAlphaType
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkImageInfo.h:40
kRGB_888x_SkColorType
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition: SkImageInfo.h:70
SkAlphaType
SkAlphaType
Definition: SkImageInfo.h:37
SkAlphaTypeIsOpaque
static bool SkAlphaTypeIsOpaque(SkAlphaType at)
Returns true if SkAlphaType equals kOpaque_SkAlphaType.
Definition: SkImageInfo.h:52
SkColorInfo::operator=
SkColorInfo & operator=(const SkColorInfo &)=default
kBT2020_10bit_Full_SkYUVColorSpace
@ kBT2020_10bit_Full_SkYUVColorSpace
Definition: SkImageInfo.h:155
SkImageInfo::computeMinByteSize
size_t computeMinByteSize() const
Returns storage required by pixel array, given SkImageInfo dimensions, and SkColorType.
Definition: SkImageInfo.h:669
SkImageInfo::MakeA8
static SkImageInfo MakeA8(int width, int height)
Creates SkImageInfo from integral dimensions width and height, kAlpha_8_SkColorType,...
Definition: SkImageInfo.h:409
kRec709_Full_SkYUVColorSpace
@ kRec709_Full_SkYUVColorSpace
describes HDTV range
Definition: SkImageInfo.h:151
SkColorSpace
Definition: SkColorSpace.h:104
kRec601_SkYUVColorSpace
@ kRec601_SkYUVColorSpace
Definition: SkImageInfo.h:165
SkColorInfo::colorSpace
SkColorSpace * colorSpace() const
Definition: SkImageInfo.h:204
SkMath.h