Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
13#include "include/core/SkRect.h"
15#include "include/core/SkSize.h"
20
21#include <cstddef>
22#include <cstdint>
23#include <utility>
24
25class SkColorSpace;
26
27/** Returns the number of bytes required to store a pixel, including unused padding.
28 Returns zero if ct is kUnknown_SkColorType or invalid.
29
30 @return bytes per pixel
31*/
33
34/** Returns true if SkColorType always decodes alpha to 1.0, making the pixel
35 fully opaque. If true, SkColorType does not reserve bits to encode alpha.
36
37 @return true if alpha is always set to 1.0
38*/
40
41/** Returns true if canonical can be set to a valid SkAlphaType for colorType. If
42 there is more than one valid canonical SkAlphaType, set to alphaType, if valid.
43 If true is returned and canonical is not nullptr, store valid SkAlphaType.
44
45 Returns false only if alphaType is kUnknown_SkAlphaType, color type is not
46 kUnknown_SkColorType, and SkColorType is not always opaque. If false is returned,
47 canonical is ignored.
48
49 @param canonical storage for SkAlphaType
50 @return true if valid SkAlphaType can be associated with colorType
51*/
53 SkAlphaType* canonical = nullptr);
54
55/** \enum SkImageInfo::SkYUVColorSpace
56 Describes color range of YUV pixels. The color mapping from YUV to RGB varies
57 depending on the source. YUV pixels may be generated by JPEG images, standard
58 video streams, or high definition video streams. Each has its own mapping from
59 YUV to RGB.
60
61 JPEG YUV values encode the full range of 0 to 255 for all three components.
62 Video YUV values often range from 16 to 235 for Y and from 16 to 240 for U and V (limited).
63 Details of encoding and conversion to RGB are described in YCbCr color space.
64
65 The identity colorspace exists to provide a utility mapping from Y to R, U to G and V to B.
66 It can be used to visualize the YUV planes or to explicitly post process the YUV channels.
67*/
68enum SkYUVColorSpace : int {
69 kJPEG_Full_SkYUVColorSpace, //!< describes full range
70 kRec601_Limited_SkYUVColorSpace, //!< describes SDTV range
71 kRec709_Full_SkYUVColorSpace, //!< describes HDTV range
73 kBT2020_8bit_Full_SkYUVColorSpace, //!< describes UHDTV range, non-constant-luminance
79 kFCC_Full_SkYUVColorSpace, //!< describes FCC range
81 kSMPTE240_Full_SkYUVColorSpace, //!< describes SMPTE240M range
83 kYDZDX_Full_SkYUVColorSpace, //!< describes YDZDX range
85 kGBR_Full_SkYUVColorSpace, //!< describes GBR range
87 kYCgCo_8bit_Full_SkYUVColorSpace, //!< describes YCgCo matrix
93 kIdentity_SkYUVColorSpace, //!< maps Y->R, U->G, V->B
94
96
97 // Legacy (deprecated) names:
102};
103
104/** \struct SkColorInfo
105 Describes pixel and encoding. SkImageInfo can be created from SkColorInfo by
106 providing dimensions.
107
108 It encodes how pixel bits describe alpha, transparency; color components red, blue,
109 and green; and SkColorSpace, the range and linearity of colors.
110*/
112public:
113 /** Creates an SkColorInfo with kUnknown_SkColorType, kUnknown_SkAlphaType,
114 and no SkColorSpace.
115
116 @return empty SkImageInfo
117 */
120
121 /** Creates SkColorInfo from SkColorType ct, SkAlphaType at, and optionally SkColorSpace cs.
122
123 If SkColorSpace cs is nullptr and SkColorInfo is part of drawing source: SkColorSpace
124 defaults to sRGB, mapping into SkSurface SkColorSpace.
125
126 Parameters are not validated to see if their values are legal, or that the
127 combination is supported.
128 @return created SkColorInfo
129 */
131
134
137
138 SkColorSpace* colorSpace() const;
139 sk_sp<SkColorSpace> refColorSpace() const;
140 SkColorType colorType() const { return fColorType; }
141 SkAlphaType alphaType() const { return fAlphaType; }
142
143 bool isOpaque() const {
144 return SkAlphaTypeIsOpaque(fAlphaType)
146 }
147
148 bool gammaCloseToSRGB() const;
149
150 /** Does other represent the same color type, alpha type, and color space? */
151 bool operator==(const SkColorInfo& other) const;
152
153 /** Does other represent a different color type, alpha type, or color space? */
154 bool operator!=(const SkColorInfo& other) const;
155
156 /** Creates SkColorInfo with same SkColorType, SkColorSpace, with SkAlphaType set
157 to newAlphaType.
158
159 Created SkColorInfo contains newAlphaType even if it is incompatible with
160 SkColorType, in which case SkAlphaType in SkColorInfo is ignored.
161 */
162 SkColorInfo makeAlphaType(SkAlphaType newAlphaType) const;
163
164 /** Creates new SkColorInfo with same SkAlphaType, SkColorSpace, with SkColorType
165 set to newColorType.
166 */
167 SkColorInfo makeColorType(SkColorType newColorType) const;
168
169 /** Creates SkColorInfo with same SkAlphaType, SkColorType, with SkColorSpace
170 set to cs. cs may be nullptr.
171 */
172 SkColorInfo makeColorSpace(sk_sp<SkColorSpace> cs) const;
173
174 /** Returns number of bytes per pixel required by SkColorType.
175 Returns zero if colorType() is kUnknown_SkColorType.
176
177 @return bytes in pixel
178
179 example: https://fiddle.skia.org/c/@ImageInfo_bytesPerPixel
180 */
181 int bytesPerPixel() const;
182
183 /** Returns bit shift converting row bytes to row pixels.
184 Returns zero for kUnknown_SkColorType.
185
186 @return one of: 0, 1, 2, 3, 4; left shift to convert pixels to bytes
187
188 example: https://fiddle.skia.org/c/@ImageInfo_shiftPerPixel
189 */
190 int shiftPerPixel() const;
191
192private:
193 sk_sp<SkColorSpace> fColorSpace;
196};
197
198/** \struct SkImageInfo
199 Describes pixel dimensions and encoding. SkBitmap, SkImage, PixMap, and SkSurface
200 can be created from SkImageInfo. SkImageInfo can be retrieved from SkBitmap and
201 SkPixmap, but not from SkImage and SkSurface. For example, SkImage and SkSurface
202 implementations may defer pixel depth, so may not completely specify SkImageInfo.
203
204 SkImageInfo contains dimensions, the pixel integral width and height. It encodes
205 how pixel bits describe alpha, transparency; color components red, blue,
206 and green; and SkColorSpace, the range and linearity of colors.
207*/
209public:
210
211 /** Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType,
212 a width and height of zero, and no SkColorSpace.
213
214 @return empty SkImageInfo
215 */
216 SkImageInfo() = default;
217
218 /** Creates SkImageInfo from integral dimensions width and height, SkColorType ct,
219 SkAlphaType at, and optionally SkColorSpace cs.
220
221 If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace
222 defaults to sRGB, mapping into SkSurface SkColorSpace.
223
224 Parameters are not validated to see if their values are legal, or that the
225 combination is supported.
226
227 @param width pixel column count; must be zero or greater
228 @param height pixel row count; must be zero or greater
229 @param cs range of colors; may be nullptr
230 @return created SkImageInfo
231 */
232 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at);
233 static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
235 static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at);
236 static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at,
238
239 /** Creates SkImageInfo from integral dimensions and SkColorInfo colorInfo,
240
241 Parameters are not validated to see if their values are legal, or that the
242 combination is supported.
243
244 @param dimensions pixel column and row count; must be zeros or greater
245 @param SkColorInfo the pixel encoding consisting of SkColorType, SkAlphaType, and
246 SkColorSpace (which may be nullptr)
247 @return created SkImageInfo
248 */
249 static SkImageInfo Make(SkISize dimensions, const SkColorInfo& colorInfo) {
250 return SkImageInfo(dimensions, colorInfo);
251 }
252 static SkImageInfo Make(SkISize dimensions, SkColorInfo&& colorInfo) {
253 return SkImageInfo(dimensions, std::move(colorInfo));
254 }
255
256 /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
257 SkAlphaType at, and optionally SkColorSpace cs. kN32_SkColorType will equal either
258 kBGRA_8888_SkColorType or kRGBA_8888_SkColorType, whichever is optimal.
259
260 If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace
261 defaults to sRGB, mapping into SkSurface SkColorSpace.
262
263 Parameters are not validated to see if their values are legal, or that the
264 combination is supported.
265
266 @param width pixel column count; must be zero or greater
267 @param height pixel row count; must be zero or greater
268 @param cs range of colors; may be nullptr
269 @return created SkImageInfo
270 */
271 static SkImageInfo MakeN32(int width, int height, SkAlphaType at);
272 static SkImageInfo MakeN32(int width, int height, SkAlphaType at, sk_sp<SkColorSpace> cs);
273
274 /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
275 SkAlphaType at, with sRGB SkColorSpace.
276
277 Parameters are not validated to see if their values are legal, or that the
278 combination is supported.
279
280 @param width pixel column count; must be zero or greater
281 @param height pixel row count; must be zero or greater
282 @return created SkImageInfo
283
284 example: https://fiddle.skia.org/c/@ImageInfo_MakeS32
285 */
286 static SkImageInfo MakeS32(int width, int height, SkAlphaType at);
287
288 /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
289 kPremul_SkAlphaType, with optional SkColorSpace.
290
291 If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace
292 defaults to sRGB, mapping into SkSurface SkColorSpace.
293
294 Parameters are not validated to see if their values are legal, or that the
295 combination is supported.
296
297 @param width pixel column count; must be zero or greater
298 @param height pixel row count; must be zero or greater
299 @param cs range of colors; may be nullptr
300 @return created SkImageInfo
301 */
302 static SkImageInfo MakeN32Premul(int width, int height);
303 static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs);
304
305 /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
306 kPremul_SkAlphaType, with SkColorSpace set to nullptr.
307
308 If SkImageInfo is part of drawing source: SkColorSpace defaults to sRGB, mapping
309 into SkSurface SkColorSpace.
310
311 Parameters are not validated to see if their values are legal, or that the
312 combination is supported.
313
314 @param dimensions width and height, each must be zero or greater
315 @param cs range of colors; may be nullptr
316 @return created SkImageInfo
317 */
318 static SkImageInfo MakeN32Premul(SkISize dimensions);
319 static SkImageInfo MakeN32Premul(SkISize dimensions, sk_sp<SkColorSpace> cs);
320
321 /** Creates SkImageInfo from integral dimensions width and height, kAlpha_8_SkColorType,
322 kPremul_SkAlphaType, with SkColorSpace set to nullptr.
323
324 @param width pixel column count; must be zero or greater
325 @param height pixel row count; must be zero or greater
326 @return created SkImageInfo
327 */
328 static SkImageInfo MakeA8(int width, int height);
329 /** Creates SkImageInfo from integral dimensions, kAlpha_8_SkColorType,
330 kPremul_SkAlphaType, with SkColorSpace set to nullptr.
331
332 @param dimensions pixel row and column count; must be zero or greater
333 @return created SkImageInfo
334 */
335 static SkImageInfo MakeA8(SkISize dimensions);
336
337 /** Creates SkImageInfo from integral dimensions width and height, kUnknown_SkColorType,
338 kUnknown_SkAlphaType, with SkColorSpace set to nullptr.
339
340 Returned SkImageInfo as part of source does not draw, and as part of destination
341 can not be drawn to.
342
343 @param width pixel column count; must be zero or greater
344 @param height pixel row count; must be zero or greater
345 @return created SkImageInfo
346 */
347 static SkImageInfo MakeUnknown(int width, int height);
348
349 /** Creates SkImageInfo from integral dimensions width and height set to zero,
350 kUnknown_SkColorType, kUnknown_SkAlphaType, with SkColorSpace set to nullptr.
351
352 Returned SkImageInfo as part of source does not draw, and as part of destination
353 can not be drawn to.
354
355 @return created SkImageInfo
356 */
358 return MakeUnknown(0, 0);
359 }
360
361 /** Returns pixel count in each row.
362
363 @return pixel width
364 */
365 int width() const { return fDimensions.width(); }
366
367 /** Returns pixel row count.
368
369 @return pixel height
370 */
371 int height() const { return fDimensions.height(); }
372
373 SkColorType colorType() const { return fColorInfo.colorType(); }
374
375 SkAlphaType alphaType() const { return fColorInfo.alphaType(); }
376
377 /** Returns SkColorSpace, the range of colors. The reference count of
378 SkColorSpace is unchanged. The returned SkColorSpace is immutable.
379
380 @return SkColorSpace, or nullptr
381 */
382 SkColorSpace* colorSpace() const;
383
384 /** Returns smart pointer to SkColorSpace, the range of colors. The smart pointer
385 tracks the number of objects sharing this SkColorSpace reference so the memory
386 is released when the owners destruct.
387
388 The returned SkColorSpace is immutable.
389
390 @return SkColorSpace wrapped in a smart pointer
391 */
392 sk_sp<SkColorSpace> refColorSpace() const;
393
394 /** Returns if SkImageInfo describes an empty area of pixels by checking if either
395 width or height is zero or smaller.
396
397 @return true if either dimension is zero or smaller
398 */
399 bool isEmpty() const { return fDimensions.isEmpty(); }
400
401 /** Returns the dimensionless SkColorInfo that represents the same color type,
402 alpha type, and color space as this SkImageInfo.
403 */
404 const SkColorInfo& colorInfo() const { return fColorInfo; }
405
406 /** Returns true if SkAlphaType is set to hint that all pixels are opaque; their
407 alpha value is implicitly or explicitly 1.0. If true, and all pixels are
408 not opaque, Skia may draw incorrectly.
409
410 Does not check if SkColorType allows alpha, or if any pixel value has
411 transparency.
412
413 @return true if SkAlphaType is kOpaque_SkAlphaType
414 */
415 bool isOpaque() const { return fColorInfo.isOpaque(); }
416
417 /** Returns SkISize { width(), height() }.
418
419 @return integral size of width() and height()
420 */
421 SkISize dimensions() const { return fDimensions; }
422
423 /** Returns SkIRect { 0, 0, width(), height() }.
424
425 @return integral rectangle from origin to width() and height()
426 */
427 SkIRect bounds() const { return SkIRect::MakeSize(fDimensions); }
428
429 /** Returns true if associated SkColorSpace is not nullptr, and SkColorSpace gamma
430 is approximately the same as sRGB.
431 This includes the
432
433 @return true if SkColorSpace gamma is approximately the same as sRGB
434 */
435 bool gammaCloseToSRGB() const { return fColorInfo.gammaCloseToSRGB(); }
436
437 /** Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType,
438 with dimensions set to width and height.
439
440 @param newWidth pixel column count; must be zero or greater
441 @param newHeight pixel row count; must be zero or greater
442 @return created SkImageInfo
443 */
444 SkImageInfo makeWH(int newWidth, int newHeight) const {
445 return Make({newWidth, newHeight}, fColorInfo);
446 }
447
448 /** Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType,
449 with dimensions set to newDimensions.
450
451 @param newSize pixel column and row count; must be zero or greater
452 @return created SkImageInfo
453 */
455 return Make(newSize, fColorInfo);
456 }
457
458 /** Creates SkImageInfo with same SkColorType, SkColorSpace, width, and height,
459 with SkAlphaType set to newAlphaType.
460
461 Created SkImageInfo contains newAlphaType even if it is incompatible with
462 SkColorType, in which case SkAlphaType in SkImageInfo is ignored.
463
464 @return created SkImageInfo
465 */
467 return Make(fDimensions, fColorInfo.makeAlphaType(newAlphaType));
468 }
469
470 /** Creates SkImageInfo with same SkAlphaType, SkColorSpace, width, and height,
471 with SkColorType set to newColorType.
472
473 @return created SkImageInfo
474 */
476 return Make(fDimensions, fColorInfo.makeColorType(newColorType));
477 }
478
479 /** Creates SkImageInfo with same SkAlphaType, SkColorType, width, and height,
480 with SkColorSpace set to cs.
481
482 @param cs range of colors; may be nullptr
483 @return created SkImageInfo
484 */
485 SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const;
486
487 /** Returns number of bytes per pixel required by SkColorType.
488 Returns zero if colorType( is kUnknown_SkColorType.
489
490 @return bytes in pixel
491 */
492 int bytesPerPixel() const { return fColorInfo.bytesPerPixel(); }
493
494 /** Returns bit shift converting row bytes to row pixels.
495 Returns zero for kUnknown_SkColorType.
496
497 @return one of: 0, 1, 2, 3; left shift to convert pixels to bytes
498 */
499 int shiftPerPixel() const { return fColorInfo.shiftPerPixel(); }
500
501 /** Returns minimum bytes per row, computed from pixel width() and SkColorType, which
502 specifies bytesPerPixel(). SkBitmap maximum value for row bytes must fit
503 in 31 bits.
504
505 @return width() times bytesPerPixel() as unsigned 64-bit integer
506 */
507 uint64_t minRowBytes64() const {
508 return (uint64_t)sk_64_mul(this->width(), this->bytesPerPixel());
509 }
510
511 /** Returns minimum bytes per row, computed from pixel width() and SkColorType, which
512 specifies bytesPerPixel(). SkBitmap maximum value for row bytes must fit
513 in 31 bits.
514
515 @return width() times bytesPerPixel() as size_t
516 */
517 size_t minRowBytes() const {
518 uint64_t minRowBytes = this->minRowBytes64();
519 if (!SkTFitsIn<int32_t>(minRowBytes)) {
520 return 0;
521 }
522 return (size_t)minRowBytes;
523 }
524
525 /** Returns byte offset of pixel from pixel base address.
526
527 Asserts in debug build if x or y is outside of bounds. Does not assert if
528 rowBytes is smaller than minRowBytes(), even though result may be incorrect.
529
530 @param x column index, zero or greater, and less than width()
531 @param y row index, zero or greater, and less than height()
532 @param rowBytes size of pixel row or larger
533 @return offset within pixel array
534
535 example: https://fiddle.skia.org/c/@ImageInfo_computeOffset
536 */
537 size_t computeOffset(int x, int y, size_t rowBytes) const;
538
539 /** Compares SkImageInfo with other, and returns true if width, height, SkColorType,
540 SkAlphaType, and SkColorSpace are equivalent.
541
542 @param other SkImageInfo to compare
543 @return true if SkImageInfo equals other
544 */
545 bool operator==(const SkImageInfo& other) const {
546 return fDimensions == other.fDimensions && fColorInfo == other.fColorInfo;
547 }
548
549 /** Compares SkImageInfo with other, and returns true if width, height, SkColorType,
550 SkAlphaType, and SkColorSpace are not equivalent.
551
552 @param other SkImageInfo to compare
553 @return true if SkImageInfo is not equal to other
554 */
555 bool operator!=(const SkImageInfo& other) const {
556 return !(*this == other);
557 }
558
559 /** Returns storage required by pixel array, given SkImageInfo dimensions, SkColorType,
560 and rowBytes. rowBytes is assumed to be at least as large as minRowBytes().
561
562 Returns zero if height is zero.
563 Returns SIZE_MAX if answer exceeds the range of size_t.
564
565 @param rowBytes size of pixel row or larger
566 @return memory required by pixel buffer
567 */
568 size_t computeByteSize(size_t rowBytes) const;
569
570 /** Returns storage required by pixel array, given SkImageInfo dimensions, and
571 SkColorType. Uses minRowBytes() to compute bytes for pixel row.
572
573 Returns zero if height is zero.
574 Returns SIZE_MAX if answer exceeds the range of size_t.
575
576 @return least memory required by pixel buffer
577 */
578 size_t computeMinByteSize() const {
579 return this->computeByteSize(this->minRowBytes());
580 }
581
582 /** Returns true if byteSize equals SIZE_MAX. computeByteSize() and
583 computeMinByteSize() return SIZE_MAX if size_t can not hold buffer size.
584
585 @param byteSize result of computeByteSize() or computeMinByteSize()
586 @return true if computeByteSize() or computeMinByteSize() result exceeds size_t
587 */
588 static bool ByteSizeOverflowed(size_t byteSize) {
589 return SIZE_MAX == byteSize;
590 }
591
592 /** Returns true if rowBytes is valid for this SkImageInfo.
593
594 @param rowBytes size of pixel row including padding
595 @return true if rowBytes is large enough to contain pixel row and is properly
596 aligned
597 */
598 bool validRowBytes(size_t rowBytes) const {
599 if (rowBytes < this->minRowBytes64()) {
600 return false;
601 }
602 int shift = this->shiftPerPixel();
603 size_t alignedRowBytes = rowBytes >> shift << shift;
604 return alignedRowBytes == rowBytes;
605 }
606
607 /** Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType,
608 a width and height of zero, and no SkColorSpace.
609 */
610 void reset() { *this = {}; }
611
612 /** Asserts if internal values are illegal or inconsistent. Only available if
613 SK_DEBUG is defined at compile time.
614 */
615 SkDEBUGCODE(void validate() const;)
616
617private:
618 SkColorInfo fColorInfo;
619 SkISize fDimensions = {0, 0};
620
621 SkImageInfo(SkISize dimensions, const SkColorInfo& colorInfo)
622 : fColorInfo(colorInfo), fDimensions(dimensions) {}
623
624 SkImageInfo(SkISize dimensions, SkColorInfo&& colorInfo)
625 : fColorInfo(std::move(colorInfo)), fDimensions(dimensions) {}
626};
627
628#endif
SkColorType fColorType
#define SK_API
Definition SkAPI.h:35
static bool SkAlphaTypeIsOpaque(SkAlphaType at)
Definition SkAlphaType.h:41
SkAlphaType
Definition SkAlphaType.h:26
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27
SkColorType
Definition SkColorType.h:19
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
SkYUVColorSpace
Definition SkImageInfo.h:68
@ kRec709_Full_SkYUVColorSpace
describes HDTV range
Definition SkImageInfo.h:71
@ kYCgCo_10bit_Full_SkYUVColorSpace
Definition SkImageInfo.h:89
@ kYCgCo_12bit_Full_SkYUVColorSpace
Definition SkImageInfo.h:91
@ kYCgCo_12bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:92
@ kYCgCo_10bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:90
@ kGBR_Limited_SkYUVColorSpace
Definition SkImageInfo.h:86
@ kBT2020_8bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:74
@ kBT2020_SkYUVColorSpace
@ kFCC_Full_SkYUVColorSpace
describes FCC range
Definition SkImageInfo.h:79
@ kJPEG_SkYUVColorSpace
Definition SkImageInfo.h:98
@ kLastEnum_SkYUVColorSpace
last valid value
Definition SkImageInfo.h:95
@ kYCgCo_8bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:88
@ kYDZDX_Full_SkYUVColorSpace
describes YDZDX range
Definition SkImageInfo.h:83
@ kRec601_SkYUVColorSpace
Definition SkImageInfo.h:99
@ kFCC_Limited_SkYUVColorSpace
Definition SkImageInfo.h:80
@ kBT2020_12bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:78
@ kYCgCo_8bit_Full_SkYUVColorSpace
describes YCgCo matrix
Definition SkImageInfo.h:87
@ kBT2020_8bit_Full_SkYUVColorSpace
describes UHDTV range, non-constant-luminance
Definition SkImageInfo.h:73
@ kRec601_Limited_SkYUVColorSpace
describes SDTV range
Definition SkImageInfo.h:70
@ kRec709_Limited_SkYUVColorSpace
Definition SkImageInfo.h:72
@ kSMPTE240_Full_SkYUVColorSpace
describes SMPTE240M range
Definition SkImageInfo.h:81
@ kGBR_Full_SkYUVColorSpace
describes GBR range
Definition SkImageInfo.h:85
@ kSMPTE240_Limited_SkYUVColorSpace
Definition SkImageInfo.h:82
@ kBT2020_12bit_Full_SkYUVColorSpace
Definition SkImageInfo.h:77
@ kBT2020_10bit_Full_SkYUVColorSpace
Definition SkImageInfo.h:75
@ kRec709_SkYUVColorSpace
@ kIdentity_SkYUVColorSpace
maps Y->R, U->G, V->B
Definition SkImageInfo.h:93
@ kBT2020_10bit_Limited_SkYUVColorSpace
Definition SkImageInfo.h:76
@ kYDZDX_Limited_SkYUVColorSpace
Definition SkImageInfo.h:84
@ kJPEG_Full_SkYUVColorSpace
describes full range
Definition SkImageInfo.h:69
SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
SK_API bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, SkAlphaType *canonical=nullptr)
static std::unique_ptr< SkEncoder > Make(SkWStream *dst, const SkPixmap *src, const SkYUVAPixmaps *srcYUVA, const SkColorSpace *srcYUVAColorSpace, const SkJpegEncoder::Options &options)
static int64_t sk_64_mul(int64_t a, int64_t b)
Definition SkMath.h:33
bool operator!=(const sk_sp< T > &a, const sk_sp< U > &b)
Definition SkRefCnt.h:355
SkAlphaType alphaType() const
SkColorInfo(const SkColorInfo &)
bool isOpaque() const
SkColorInfo & operator=(SkColorInfo &&)
SkColorInfo & operator=(const SkColorInfo &)
SkColorInfo(SkColorInfo &&)
SkColorType colorType() const
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
double y
double x
Definition ref_ptr.h:256
int32_t height
int32_t width
static constexpr SkIRect MakeSize(const SkISize &size)
Definition SkRect.h:66
SkImageInfo makeWH(int newWidth, int newHeight) const
static bool ByteSizeOverflowed(size_t byteSize)
bool isEmpty() const
bool isOpaque() const
bool operator!=(const SkImageInfo &other) const
const SkColorInfo & colorInfo() const
SkImageInfo(SkISize dimensions, SkColorInfo &&colorInfo)
static SkImageInfo Make(SkISize dimensions, SkColorInfo &&colorInfo)
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
bool operator==(const SkImageInfo &other) const
SkIRect bounds() const
size_t minRowBytes() const
static SkImageInfo Make(SkISize dimensions, const SkColorInfo &colorInfo)
SkImageInfo makeDimensions(SkISize newSize) const
int bytesPerPixel() const
SkISize dimensions() const
SkDEBUGCODE(void validate() const ;) private SkISize fDimensions
bool gammaCloseToSRGB() const
size_t computeMinByteSize() const
static SkImageInfo MakeUnknown()
int width() const
SkImageInfo(SkISize dimensions, const SkColorInfo &colorInfo)
SkAlphaType alphaType() const
SkColorType colorType() const
uint64_t minRowBytes64() const
int shiftPerPixel() const
int height() const
SkImageInfo()=default
SkImageInfo makeColorType(SkColorType newColorType) const
bool validRowBytes(size_t rowBytes) const