SkImageInfo_Reference.bmh revision 4855f78dd16ad50003ec537c98062e24a831cd45
1#Topic Image_Info
2#Alias Image_Info_Reference
3
4#Subtopic Overview
5    #Subtopic Subtopic
6    #Populate
7    ##
8##
9
10#Subtopic Constant
11#Populate
12##
13
14# ------------------------------------------------------------------------------
15#Subtopic Alpha_Type
16#Line # incomplete ##
17#Alias Alpha_Type
18#Alias Alpha_Types
19#Enum SkAlphaType
20#Line # incomplete ##
21
22#Code
23    enum SkAlphaType {
24        kUnknown_SkAlphaType,
25        kOpaque_SkAlphaType,
26        kPremul_SkAlphaType,
27        kUnpremul_SkAlphaType,
28        kLastEnum_SkAlphaType = kUnpremul_SkAlphaType,
29    };
30##
31
32Describes how to interpret the alpha component of a pixel.
33
34#Const kUnknown_SkAlphaType 0
35##
36#Const kOpaque_SkAlphaType 1
37All pixels are stored as opaque.
38##
39#Const kPremul_SkAlphaType 2
40All pixels have their alpha premultiplied in their color components.
41This is the natural format for the rendering target pixels.
42##
43#Const kUnpremul_SkAlphaType 3
44All pixels have their color components stored without any regard to the
45alpha. e.g. this is the default configuration for PNG images.
46kUnpremul_SkAlphaType is supported only for input images. Rendering cannot
47generate this on output.
48##
49
50#Example
51// incomplete
52##
53
54#SeeAlso incomplete
55
56#Enum SkAlphaType ##
57#Subtopic Alpha_Type ##
58
59# ------------------------------------------------------------------------------
60#Subtopic Color_Type
61#Line # incomplete ##
62#Alias Native_Color_Type
63#Substitute native SkColorType
64#Alias Color_Type
65#Alias Color_Types
66#Enum SkColorType
67#Line # incomplete ##
68
69#Code
70    enum SkColorType {
71        kUnknown_SkColorType,
72        kAlpha_8_SkColorType,
73        kRGB_565_SkColorType,
74        kARGB_4444_SkColorType,
75        kRGBA_8888_SkColorType,
76        kRGB_888x_SkColorType,
77        kBGRA_8888_SkColorType,
78        kRGBA_1010102_SkColorType,
79        kRGB_101010x_SkColorType,
80        kGray_8_SkColorType,
81        kRGBA_F16_SkColorType,
82        kLastEnum_SkColorType = kRGBA_F16_SkColorType,
83        kN32_SkColorType = kBGRA_8888_SkColorType,
84        kN32_SkColorType = kRGBA_8888_SkColorType,
85    };
86##
87
88Describes how to interpret the components of a pixel.
89
90kN32_SkColorType selects the native 32-bit Color_ARGB format. On Little_Endian
91processors, pixels containing 8-bit Color_ARGB components pack into 32-bit
92kBGRA_8888_SkColorType. On Big_Endian processors, pixels pack into 32-bit
93kRGBA_8888_SkColorType.
94
95#Const kUnknown_SkColorType 0
96##
97#Const kAlpha_8_SkColorType 1
98##
99#Const kRGB_565_SkColorType 2
100##
101#Const kARGB_4444_SkColorType 3
102##
103#Const kRGBA_8888_SkColorType 4
104##
105#Const kRGB_888x_SkColorType 5
106##
107#Const kBGRA_8888_SkColorType 6
108##
109#Const kRGBA_1010102_SkColorType 7
110##
111#Const kRGB_101010x_SkColorType 8
112##
113#Const kGray_8_SkColorType 9
114##
115#Const kRGBA_F16_SkColorType 10
116##
117#ToDo  can be 4 or 6; how to document? ##
118#Const kN32_SkColorType 4
119##
120
121#Example
122// incomplete
123##
124
125#SeeAlso incomplete
126
127#Enum SkColorType ##
128#Subtopic Color_Type ##
129
130# ------------------------------------------------------------------------------
131#Enum SkYUVColorSpace
132#Line # incomplete ##
133
134#Code
135    enum SkYUVColorSpace {
136        kJPEG_SkYUVColorSpace,
137        kRec601_SkYUVColorSpace,
138        kRec709_SkYUVColorSpace,
139        kLastEnum_SkYUVColorSpace = kRec709_SkYUVColorSpace,
140    };
141##
142
143Describes the color space a YUV pixel.
144
145#Const kJPEG_SkYUVColorSpace 0
146Standard JPEG color space.
147##
148#Const kRec601_SkYUVColorSpace 1
149SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color
150range. See http://en.wikipedia.org/wiki/Rec._601 for details.
151##
152#Const kRec709_SkYUVColorSpace 2
153HDTV standard Rec. 709 color space. Uses "studio swing" [16, 235] color
154range. See http://en.wikipedia.org/wiki/Rec._709 for details.
155##
156
157#Example
158// incomplete
159##
160
161#SeeAlso incomplete
162
163#Enum SkYUVColorSpace ##
164
165# ------------------------------------------------------------------------------
166#EnumClass SkDestinationSurfaceColorMode
167#Line # incomplete ##
168
169#Code
170    enum class SkDestinationSurfaceColorMode {
171        kLegacy,
172        kGammaAndColorSpaceAware,
173    };
174##
175
176#Const kLegacy 0
177##
178#Const kGammaAndColorSpaceAware 1
179##
180
181#Example
182// incomplete
183##
184
185#SeeAlso incomplete
186
187#EnumClass SkDestinationSurfaceColorMode ##
188
189# ------------------------------------------------------------------------------
190
191#Struct SkImageInfo
192
193Describes Image dimensions and pixel type.
194Used for both source images and render-targets (surfaces).
195
196#Subtopic Operator
197#Populate
198##
199
200#Subtopic Member_Function
201#Populate
202##
203
204#Subtopic Constructor
205#Populate
206##
207
208# ------------------------------------------------------------------------------
209
210#Method SkImageInfo()
211
212#In Constructor
213#Line # creates with zero dimensions, kUnknown_SkColorType, kUnknown_SkAlphaType ##
214#Return incomplete ##
215
216#Example
217// incomplete
218##
219
220#SeeAlso incomplete
221
222#Method ##
223
224# ------------------------------------------------------------------------------
225
226#Method static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
227                            sk_sp<SkColorSpace> cs = nullptr)
228#In Constructor
229#Line # creates Image_Info from dimensions, Color_Type, Alpha_Type, Color_Space ##
230
231#Param width  incomplete ##
232#Param height  incomplete ##
233#Param ct  incomplete ##
234#Param at  incomplete ##
235#Param cs  incomplete ##
236
237#Return incomplete ##
238
239#Example
240// incomplete
241##
242
243#SeeAlso incomplete
244
245#Method ##
246
247# ------------------------------------------------------------------------------
248
249#Method static SkImageInfo MakeN32(int width, int height, SkAlphaType at,
250                               sk_sp<SkColorSpace> cs = nullptr)
251#In Constructor
252#Line # creates Image_Info with Native_Color_Type ##
253
254Sets Color_Type to kN32_SkColorType.
255
256#Param width  incomplete ##
257#Param height  incomplete ##
258#Param at  incomplete ##
259#Param cs  incomplete ##
260
261#Return incomplete ##
262
263#Example
264// incomplete
265##
266
267#SeeAlso incomplete
268
269#Method ##
270
271# ------------------------------------------------------------------------------
272
273#Method static SkImageInfo MakeS32(int width, int height, SkAlphaType at)
274
275#In Constructor
276#Line # creates Image_Info with Native_Color_Type, sRGB Color_Space ##
277Creates Image_Info marked as sRGB with kN32_SkColorType swizzle.
278
279#Param width  incomplete ##
280#Param height  incomplete ##
281#Param at  incomplete ##
282
283#Return incomplete ##
284
285#Example
286// incomplete
287##
288
289#SeeAlso incomplete
290
291#Method ##
292
293# ------------------------------------------------------------------------------
294
295#Method static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr)
296
297#In Constructor
298#Line # creates Image_Info with Native_Color_Type, kPremul_SkAlphaType ##
299Sets Color_Type to kN32_SkColorType, and the Alpha_Type to kPremul_SkAlphaType.
300
301#Param width  incomplete ##
302#Param height  incomplete ##
303#Param cs  incomplete ##
304
305#Return incomplete ##
306
307#Example
308// incomplete
309##
310
311#SeeAlso incomplete
312
313#Method ##
314
315# ------------------------------------------------------------------------------
316
317#Method static SkImageInfo MakeN32Premul(const SkISize& size)
318
319#In Constructor
320#Param size  incomplete ##
321
322#Return incomplete ##
323
324#Example
325// incomplete
326##
327
328#SeeAlso incomplete
329
330#Method ##
331
332# ------------------------------------------------------------------------------
333
334#Method static SkImageInfo MakeA8(int width, int height)
335
336#In Constructor
337#Line # creates Image_Info with kAlpha_8_SkColorType, kPremul_SkAlphaType ##
338#Param width  incomplete ##
339#Param height  incomplete ##
340
341#Return incomplete ##
342
343#Example
344// incomplete
345##
346
347#SeeAlso incomplete
348
349#Method ##
350
351# ------------------------------------------------------------------------------
352
353#Method static SkImageInfo MakeUnknown(int width, int height)
354
355#In Constructor
356#Line # creates Image_Info with kUnknown_SkColorType, kUnknown_SkAlphaType ##
357#Param width  incomplete ##
358#Param height  incomplete ##
359
360#Return incomplete ##
361
362#Example
363// incomplete
364##
365
366#SeeAlso incomplete
367
368#Method ##
369
370# ------------------------------------------------------------------------------
371
372#Method static SkImageInfo MakeUnknown()
373
374#In Constructor
375#Return incomplete ##
376
377#Example
378// incomplete
379##
380
381#SeeAlso incomplete
382
383#Method ##
384
385
386# ------------------------------------------------------------------------------
387
388#Method int width() const
389
390#Line # incomplete ##
391#Return incomplete ##
392
393#Example
394// incomplete
395##
396
397#SeeAlso incomplete
398
399#Method ##
400
401# ------------------------------------------------------------------------------
402
403#Method int height() const
404
405#Line # incomplete ##
406#Return incomplete ##
407
408#Example
409// incomplete
410##
411
412#SeeAlso incomplete
413
414#Method ##
415
416# ------------------------------------------------------------------------------
417
418#Method SkColorType colorType() const
419
420#Line # incomplete ##
421#Return incomplete ##
422
423#Example
424// incomplete
425##
426
427#SeeAlso incomplete
428
429#Method ##
430
431# ------------------------------------------------------------------------------
432
433#Method SkAlphaType alphaType() const
434
435#Line # incomplete ##
436#Return incomplete ##
437
438#Example
439// incomplete
440##
441
442#SeeAlso incomplete
443
444#Method ##
445
446# ------------------------------------------------------------------------------
447
448#Method SkColorSpace* colorSpace() const
449
450#Line # incomplete ##
451#Return incomplete ##
452
453#Example
454// incomplete
455##
456
457#SeeAlso incomplete
458
459#Method ##
460
461# ------------------------------------------------------------------------------
462
463#Method sk_sp<SkColorSpace> refColorSpace() const
464
465#Line # incomplete ##
466#Return incomplete ##
467
468#Example
469// incomplete
470##
471
472#SeeAlso incomplete
473
474#Method ##
475
476# ------------------------------------------------------------------------------
477
478#Method bool isEmpty() const
479
480#Line # incomplete ##
481#Return incomplete ##
482
483#Example
484// incomplete
485##
486
487#SeeAlso incomplete
488
489#Method ##
490
491# ------------------------------------------------------------------------------
492
493#Method bool isOpaque() const
494
495#Line # incomplete ##
496#Return incomplete ##
497
498#Example
499// incomplete
500##
501
502#SeeAlso incomplete
503
504#Method ##
505
506# ------------------------------------------------------------------------------
507
508#Method SkISize dimensions() const
509
510#Line # incomplete ##
511#Return incomplete ##
512
513#Example
514// incomplete
515##
516
517#SeeAlso incomplete
518
519#Method ##
520
521# ------------------------------------------------------------------------------
522
523#Method SkIRect bounds() const
524
525#Line # incomplete ##
526#Return incomplete ##
527
528#Example
529// incomplete
530##
531
532#SeeAlso incomplete
533
534#Method ##
535
536# ------------------------------------------------------------------------------
537
538#Method bool gammaCloseToSRGB() const
539
540#Line # incomplete ##
541#Return incomplete ##
542
543#Example
544// incomplete
545##
546
547#SeeAlso incomplete
548
549#Method ##
550
551# ------------------------------------------------------------------------------
552
553#Method SkImageInfo makeWH(int newWidth, int newHeight) const
554
555#Line # creates Image_Info with changed dimensions ##
556Creates Image_Info with the same Color_Type and Alpha_Type as this info,
557but with the specified width and height.
558
559#Param newWidth  incomplete ##
560#Param newHeight  incomplete ##
561
562#Return incomplete ##
563
564#Example
565// incomplete
566##
567
568#SeeAlso incomplete
569
570#Method ##
571
572# ------------------------------------------------------------------------------
573
574#Method SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
575
576#Line # creates Image_Info with changed Alpha_Type ##
577#Param newAlphaType  incomplete ##
578
579#Return incomplete ##
580
581#Example
582// incomplete
583##
584
585#SeeAlso incomplete
586
587#Method ##
588
589# ------------------------------------------------------------------------------
590
591#Method SkImageInfo makeColorType(SkColorType newColorType) const
592
593#Line # creates Image_Info with changed Color_Type ##
594#Param newColorType  incomplete ##
595
596#Return incomplete ##
597
598#Example
599// incomplete
600##
601
602#SeeAlso incomplete
603
604#Method ##
605
606# ------------------------------------------------------------------------------
607
608#Method SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const
609
610#Line # creates Image_Info with changed Color_Space ##
611#Param cs  incomplete ##
612
613#Return incomplete ##
614
615#Example
616// incomplete
617##
618
619#SeeAlso incomplete
620
621#Method ##
622
623# ------------------------------------------------------------------------------
624
625#Method int bytesPerPixel() const
626
627#Line # incomplete ##
628#Return incomplete ##
629
630#Example
631// incomplete
632##
633
634#SeeAlso incomplete
635
636#Method ##
637
638# ------------------------------------------------------------------------------
639
640#Method int shiftPerPixel() const
641
642#Line # incomplete ##
643#Return incomplete ##
644
645#Example
646// incomplete
647##
648
649#SeeAlso incomplete
650
651#Method ##
652
653# ------------------------------------------------------------------------------
654
655#Method uint64_t minRowBytes64() const
656
657#Line # incomplete ##
658#Return incomplete ##
659
660#Example
661// incomplete
662##
663
664#SeeAlso incomplete
665
666#Method ##
667
668# ------------------------------------------------------------------------------
669
670#Method size_t minRowBytes() const
671
672#Line # incomplete ##
673#Return incomplete ##
674
675#Example
676// incomplete
677##
678
679#SeeAlso incomplete
680
681#Method ##
682
683# ------------------------------------------------------------------------------
684
685#Method size_t computeOffset(int x, int y, size_t rowBytes) const
686
687#Line # incomplete ##
688#Param x  incomplete ##
689#Param y  incomplete ##
690#Param rowBytes  incomplete ##
691
692#Return incomplete ##
693
694#Example
695// incomplete
696##
697
698#SeeAlso incomplete
699
700#Method ##
701
702# ------------------------------------------------------------------------------
703
704#Method bool operator==(const SkImageInfo& other)_const
705
706#Line # incomplete ##
707#Param other  incomplete ##
708
709#Return incomplete ##
710
711#Example
712// incomplete
713##
714
715#SeeAlso incomplete
716
717#Method ##
718
719# ------------------------------------------------------------------------------
720
721#Method bool operator!=(const SkImageInfo& other)_const
722
723#Line # incomplete ##
724#Param other  incomplete ##
725
726#Return incomplete ##
727
728#Example
729// incomplete
730##
731
732#SeeAlso incomplete
733
734#Method ##
735
736# ------------------------------------------------------------------------------
737
738#Method void unflatten(SkReadBuffer& buffer)
739
740#Line # incomplete ##
741#Param buffer  incomplete ##
742
743#Example
744// incomplete
745##
746
747#SeeAlso incomplete
748
749#Method ##
750
751# ------------------------------------------------------------------------------
752
753#Method void flatten(SkWriteBuffer& buffer) const
754
755#Line # incomplete ##
756#Param buffer  incomplete ##
757
758#Example
759// incomplete
760##
761
762#SeeAlso incomplete
763
764#Method ##
765
766# ------------------------------------------------------------------------------
767
768#Method size_t computeByteSize(size_t rowBytes) const
769
770#Line # incomplete ##
771Returns the size (in bytes) of the image buffer that this info needs, given the specified
772rowBytes. The rowBytes must be >= this->minRowBytes().
773if (height == 0) {
774return 0;
775} else {
776return (height - 1) * rowBytes + width * bytes_per_pixel.
777
778If the calculation overflows this returns SK_MaxSizeT.
779
780#Param rowBytes  incomplete ##
781
782#Return incomplete ##
783
784#Example
785// incomplete
786##
787
788#SeeAlso incomplete
789
790#Method ##
791
792# ------------------------------------------------------------------------------
793
794#Method size_t computeMinByteSize() const
795
796#Line # incomplete ##
797Returns the minimum size (in bytes) of the image buffer that this info needs.
798If the calculation overflows, or if the height is 0, this returns 0.
799
800#Return incomplete ##
801
802#Example
803// incomplete
804##
805
806#SeeAlso incomplete
807
808#Method ##
809
810# ------------------------------------------------------------------------------
811
812#Method static bool ByteSizeOverflowed(size_t byteSize)
813
814#Line # incomplete ##
815Returns true if the result of computeByteSize (or computeMinByteSize) overflowed
816
817#Param byteSize  incomplete ##
818
819#Return incomplete ##
820
821#Example
822// incomplete
823##
824
825#SeeAlso incomplete
826
827#Method ##
828
829# ------------------------------------------------------------------------------
830
831#Method bool validRowBytes(size_t rowBytes) const
832
833#Line # incomplete ##
834#Param rowBytes  incomplete ##
835
836#Return incomplete ##
837
838#Example
839// incomplete
840##
841
842#SeeAlso incomplete
843
844#Method ##
845
846# ------------------------------------------------------------------------------
847
848#Method void reset()
849
850#Line # incomplete ##
851#Example
852// incomplete
853##
854
855#SeeAlso incomplete
856
857#Method ##
858
859# ------------------------------------------------------------------------------
860
861#Method void validate() const
862
863#Line # incomplete ##
864#Example
865// incomplete
866##
867
868#SeeAlso incomplete
869
870#Method ##
871
872#Struct SkImageInfo ##
873
874#Topic Image_Info ##
875