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