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