aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkImageInfo_Reference.bmh
blob: e2dbc4ae1ac3bd93f99c151f996cd7bd03dd9767 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
#Topic Image_Info
#Alias Image_Info_Reference

Image_Info specifies the dimensions and encoding of the pixels in a Bitmap.
The dimensions are integral width and height. The encoding is how pixel
bits describe Color_Alpha, transparency; Color components red, blue,
and green; and Color_Space, the range and linearity of colors.

Image_Info describes an uncompressed raster pixels. In contrast, Image
additionally describes compressed pixels like PNG, and Surface describes
destinations on the GPU. Image and Surface may be specified by Image_Info,
but Image and Surface may not contain Image_Info.

#Subtopic Overview
    #Subtopic Subtopic
    #Populate
    ##
##

#Subtopic Constant
#Populate
##

# ------------------------------------------------------------------------------
#Subtopic Alpha_Type
#Line # encoding for pixel transparency ##
#Alias Alpha_Type
#Alias Alpha_Types

#Enum SkAlphaType
#Line # encoding for pixel transparency ##

#Code
    enum SkAlphaType {
        kUnknown_SkAlphaType,
        kOpaque_SkAlphaType,
        kPremul_SkAlphaType,
        kUnpremul_SkAlphaType,
        kLastEnum_SkAlphaType = kUnpremul_SkAlphaType,
    };
##

Describes how to interpret the alpha component of a pixel. A pixel may
be opaque, or Color_Alpha, describing multiple levels of transparency.

In simple blending, Color_Alpha weights the draw color and the destination
color to create a new color. If alpha describes a weight from zero to one:

#Formula
    new color = draw color * alpha + destination color * (1 - alpha)
##

In practice alpha is encoded in two or more bits, where 1.0 equals all bits set.

Color_RGB may have Color_Alpha included in each component value; the stored
value is the original Color_RGB multiplied by Color_Alpha. Premultiplied color
components improve performance.

#Const kUnknown_SkAlphaType 0
Alpha_Type is uninitialized.
##
#Const kOpaque_SkAlphaType 1
Pixels are opaque. The Color_Type must have no explicit alpha
component, or all alpha components must be set to their maximum value.
##
#Const kPremul_SkAlphaType 2
Pixels have alpha premultiplied into color components.
Surface pixels must be premultiplied.
##
#Const kUnpremul_SkAlphaType 3
Pixel color component values are independent of alpha value.
Images generated from encoded data like PNG do not premultiply pixel color
components. kUnpremul_SkAlphaType is supported for Image pixels, but not for
Surface pixels.
##

#NoExample
##

#SeeAlso SkColorType SkColorSpace

#Enum SkAlphaType ##

#Subtopic Opaque

Use Opaque as a hint to optimize drawing when alpha component
of all pixel is set to its maximum value of 1.0; all alpha component bits are set.
If Image_Info is set to Opaque but all alpha values are not 1.0, results are
undefined.

#Example
#Height 64
#Description
SkPreMultiplyARGB parameter a is set to 255, its maximum value, and is interpreted
as Color_Alpha of 1.0. kOpaque_SkAlphaType may be set to improve performance.
If SkPreMultiplyARGB parameter a is set to a value smaller than 255, 
kPremul_SkAlphaType must be used instead to avoid undefined results.
The four displayed values are the original component values, though not necessarily
in the same order.
##
    SkPMColor color = SkPreMultiplyARGB(255, 50, 100, 150);
    SkString s;
    s.printf("%u %u %u %u", SkColorGetA(color), SkColorGetR(color),
                            SkColorGetG(color), SkColorGetB(color));
    SkPaint paint;
    paint.setAntiAlias(true);
    canvas->drawString(s, 10, 62, paint);
    canvas->scale(50, 50);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kOpaque_SkAlphaType);
    if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 0, 0);
    }
##

#Subtopic Opaque ##

#Subtopic Premul

Use Premul when stored color components are the original color multiplied by the
alpha component. The alpha component range of 0.0 to 1.0 is achieved by dividing
the integer bit value by the maximum bit value.

#Formula
stored color = original color * alpha / max alpha
##

The color component must be equal to or smaller than the alpha component,
or the results are undefined.

#Example
#Description
SkPreMultiplyARGB parameter a is set to 150, less than its maximum value, and is
interpreted as Color_Alpha of about 0.6. kPremul_SkAlphaType must be set, since
SkPreMultiplyARGB parameter a is set to a value smaller than 255, 
to avoid undefined results.
The four displayed values reflect that the alpha component has been multiplied
by the original color.
##
#Height 64
    SkPMColor color = SkPreMultiplyARGB(150, 50, 100, 150);
    SkString s;
    s.printf("%u %u %u %u", SkColorGetA(color), SkColorGetR(color),
                            SkColorGetG(color), SkColorGetB(color));
    SkPaint paint;
    paint.setAntiAlias(true);
    canvas->drawString(s, 10, 62, paint);
    canvas->scale(50, 50);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kPremul_SkAlphaType);
    if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 0, 0);
    }
##

#Subtopic Premul ##

#Subtopic Unpremul

Use Unpremul if stored color components are not divided by the alpha component.
Some drawing destinations may not support Unpremul.

#Bug 7079
#Example
#Description
SkColorSetARGB parameter a is set to 150, less than its maximum value, and is
interpreted as Color_Alpha of about 0.6. color is not premultiplied;
color components may have values greater than color alpha.
The four displayed values are the original component values, though not necessarily
in the same order.
##
    SkColor color = SkColorSetARGB(150, 50, 100, 255);
    SkString s;
    s.printf("%u %u %u %u", SkColorGetA(color), SkColorGetR(color),
                            SkColorGetG(color), SkColorGetB(color));
    SkPaint paint;
    paint.setAntiAlias(true);
    canvas->drawString(s, 10, 62, paint);
    canvas->scale(50, 50);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(1, 1, kN32_SkColorType, kUnpremul_SkAlphaType);
    if (bitmap.installPixels(imageInfo, (void*) &color, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 0, 0);
    }
##

#Subtopic Unpremul ##

#Subtopic Alpha_Type ##

# ------------------------------------------------------------------------------
#Subtopic Color_Type
#Line # encoding for pixel color ##
#Alias Color_Type
#Alias Color_Types

#PhraseDef list_of_color_types
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
kGray_8_SkColorType, kRGBA_F16_SkColorType
##

#Subtopic Native
#Alias Native_Color_Type
#Substitute native SkColorType
##

#Enum SkColorType
#Line # encoding for pixel color ##

#Code
    enum SkColorType {
        kUnknown_SkColorType,
        kAlpha_8_SkColorType,
        kRGB_565_SkColorType,
        kARGB_4444_SkColorType,
        kRGBA_8888_SkColorType,
        kRGB_888x_SkColorType,
        kBGRA_8888_SkColorType,
        kRGBA_1010102_SkColorType,
        kRGB_101010x_SkColorType,
        kGray_8_SkColorType,
        kRGBA_F16_SkColorType,
        kLastEnum_SkColorType = kRGBA_F16_SkColorType,
        kN32_SkColorType = kBGRA_8888_SkColorType,
        kN32_SkColorType = kRGBA_8888_SkColorType,
    };
##

Describes how pixel bits encode color. A pixel may be an alpha mask, a
gray level, Color_RGB, or Color_ARGB. 

kN32_SkColorType selects the native 32-bit Color_ARGB format. On Little_Endian
processors, pixels containing 8-bit Color_ARGB components pack into 32-bit
kBGRA_8888_SkColorType. On Big_Endian processors, pixels pack into 32-bit
kRGBA_8888_SkColorType.

#Const kUnknown_SkColorType 0

##
#Const kAlpha_8_SkColorType 1
    Encodes Color_Alpha as Alpha_8 pixel in an 8-bit byte.
##
#Const kRGB_565_SkColorType 2
    Encodes Color_RGB as BGR_565 pixel in a 16-bit word.
##
#Const kARGB_4444_SkColorType 3
    Encodes Color_ARGB as ABGR_4444 pixel in a 16-bit word.
##
#Const kRGBA_8888_SkColorType 4
    Encodes Color_ARGB as RGBA_8888 pixel in a 32-bit word.
##
#Const kRGB_888x_SkColorType 5
    Encodes Color_RGB as RGB_888x pixel in a 32-bit word.
##
#Const kBGRA_8888_SkColorType 6
    Encodes Color_ARGB as BGRA_8888 pixel in a 32-bit word.
##
#Const kRGBA_1010102_SkColorType 7
    Encodes Color_ARGB as RGBA_1010102 pixel in a 32-bit word.
##
#Const kRGB_101010x_SkColorType 8
    Encodes Color_RGB as RGB_101010x pixel in a 32-bit word.
##
#Const kGray_8_SkColorType 9
    Encodes Color_Gray as Gray_8 in an 8-bit byte.
##
#Const kRGBA_F16_SkColorType 10
    Encodes Color_ARGB as RGBA_F16 in a 64-bit word.
##

#ToDo  can be 4 or 6; how to document? ##
#Const kN32_SkColorType 4
    Encodes Color_ARGB as either RGBA_8888 or BGRA_8888, whichever
    is native to the platform.
##

#NoExample
##

#SeeAlso SkAlphaType SkColorSpace

#Enum SkColorType ##

#Subtopic Alpha_8

Alpha_8 is an 8-bit byte pixel encoding that represents transparency. A value of zero is
completely transparent; a value of 255 is completely opaque. Bitmap with Alpha_8
pixels does not visibly draw, because its pixels have no color information.
The paired SkAlphaType is ignored.

#Example
#Description
Alpha_8 pixels can modify another draw. orangePaint fills the bounds of bitmap,
with its transparency set to alpha8 pixel value.
##
#Height 64
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kAlpha_8_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    SkPaint orangePaint;
    orangePaint.setARGB(0xFF, 0xFF, 0xA5, 0x00);
    canvas->drawBitmap(bitmap, 0, 0, &orangePaint);
    uint8_t alpha8[] = { 0xFF, 0xBB, 0x77, 0x33 };
    SkPixmap alphaPixmap(imageInfo, &alpha8, imageInfo.minRowBytes());
    if (bitmap.writePixels(alphaPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2, &orangePaint);
    }
##
##

#Subtopic BGR_565

BGR_565 is a 16-bit word pixel encoding that contains five bits of blue,
six bits of green, and five bits of red. BGR_565 is fully opaque as if its
Color_Alpha was set to one, and should always be paired with kOpaque_SkAlphaType.

#Illustration

#Example
#Height 96
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGB_565_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack565 = [](unsigned r, unsigned g, unsigned b) -> uint16_t {
        return (b << 0) | (g << 5) | (r << 11);
    };
    uint16_t red565[] =  { pack565(0x1F, 0x00, 0x00), pack565(0x17, 0x00, 0x00), 
                           pack565(0x0F, 0x00, 0x00), pack565(0x07, 0x00, 0x00) };
    uint16_t blue565[] = { pack565(0x00, 0x00, 0x1F), pack565(0x00, 0x00, 0x17),
                           pack565(0x00, 0x00, 0x0F), pack565(0x00, 0x00, 0x07) };
    SkPixmap redPixmap(imageInfo, &red565, imageInfo.minRowBytes());
    if (bitmap.writePixels(redPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blue565, imageInfo.minRowBytes());
    if (bitmap.writePixels(bluePixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic ABGR_4444

ABGR_4444 is a 16-bit word pixel encoding that contains four bits of alpha,
four bits of blue, four bits of green, and four bits of red. 

#Illustration

If paired with kPremul_SkAlphaType: blue, green, and red components are
premultiplied by the alpha value. If blue, green, or red is greater than alpha,
the drawn result is undefined.

If paired with kUnpremul_SkAlphaType: alpha, blue, green, and red components
may have any value. There may be a performance penalty with unpremultipled
pixels.

If paired with kOpaque_SkAlphaType: all alpha component values are at the maximum;
blue, green, and red components are fully opaque. If any alpha component is
less than 15, the drawn result is undefined.

#Bug 7648

#Example
#Height 96
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, kPremul_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack4444 = [](unsigned a, unsigned r, unsigned g, unsigned b) -> uint16_t {
        return (a << 0) | (b << 4) | (g << 8) | (r << 12);
    };
    uint16_t red4444[] =  { pack4444(0xF, 0xF, 0x0, 0x0), pack4444(0xF, 0xb, 0x0, 0x0), 
                            pack4444(0xF, 0x7, 0x0, 0x0), pack4444(0xF, 0x3, 0x0, 0x0) };
    uint16_t blue4444[] = { pack4444(0xF, 0x0, 0x0, 0xF), pack4444(0xF, 0x0, 0x0, 0xb),
                            pack4444(0xF, 0x0, 0x0, 0x7), pack4444(0xF, 0x0, 0x0, 0x3) };
    SkPixmap redPixmap(imageInfo, &red4444, imageInfo.minRowBytes());
    if (bitmap.writePixels(redPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blue4444, imageInfo.minRowBytes());
    if (bitmap.writePixels(bluePixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic RGBA_8888

RGBA_8888 is a 32-bit word pixel encoding that contains eight bits of red,
eight bits of green, eight bits of blue, and eight bits of alpha. 

#Illustration

If paired with kPremul_SkAlphaType: red, green, and blue components are
premultiplied by the alpha value. If red, green, or blue is greater than alpha,
the drawn result is undefined.

If paired with kUnpremul_SkAlphaType: alpha, red, green, and blue components
may have any value. There may be a performance penalty with unpremultipled
pixels.

If paired with kOpaque_SkAlphaType: all alpha component values are at the maximum; 
red, green, and blue components are fully opaque. If any alpha component is
less than 255, the drawn result is undefined.

On Big_Endian platforms, RGBA_8888 is the native Color_Type, and will have
the best performance. Use kN32_SkColorType to choose the best Color_Type for
the platform at compile time.

#Example
#Height 96
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack8888 = [](unsigned a, unsigned r, unsigned g, unsigned b) -> uint32_t {
        return (r << 0) | (g << 8) | (b << 16) | (a << 24);
    };
    uint32_t red8888[] = { pack8888(0xFF, 0xFF, 0x0, 0x0), pack8888(0xFF, 0xbb, 0x0, 0x0), 
                           pack8888(0xFF, 0x77, 0x0, 0x0), pack8888(0xFF, 0x33, 0x0, 0x0) };
    uint32_t blue8888[] = { pack8888(0xFF, 0x0, 0x0, 0x0FF), pack8888(0xFF, 0x0, 0x0, 0x0bb),
                            pack8888(0xFF, 0x0, 0x0, 0x077), pack8888(0xFF, 0x0, 0x0, 0x033) };
    SkPixmap redPixmap(imageInfo, &red8888, imageInfo.minRowBytes());
    if (bitmap.writePixels(redPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blue8888, imageInfo.minRowBytes());
    if (bitmap.writePixels(bluePixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic RGB_888x

RGB_888x is a 32-bit word pixel encoding that contains eight bits of red,
eight bits of green, eight bits of blue, and eight unused bits. RGB_888x is fully 
opaque as if its Color_Alpha was set to one, and should always be paired with
kOpaque_SkAlphaType.

#Illustration

#Example
#Bug 7645
#Height 96
#Platform cpu
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGB_888x_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack888 = [](unsigned r, unsigned g, unsigned b) -> uint32_t {
        return (r << 0) | (g << 8) | (b << 16);
    };
    uint32_t red888[] =  { pack888(0xFF, 0x00, 0x00), pack888(0xbb, 0x00, 0x00), 
        pack888(0x77, 0x00, 0x00), pack888(0x33, 0x00, 0x00) };
    uint32_t blue888[] = { pack888(0x00, 0x00, 0xFF), pack888(0x00, 0x00, 0xbb),
        pack888(0x00, 0x00, 0x77), pack888(0x00, 0x00, 0x33) };
    if (bitmap.installPixels(imageInfo, (void*) red888, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    if (bitmap.installPixels(imageInfo, (void*) blue888, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic BGRA_8888

BGRA_8888 is a 32-bit word pixel encoding that contains eight bits of blue,
eight bits of green, eight bits of red, and eight bits of alpha. 

#Illustration

If paired with kPremul_SkAlphaType: blue, green, and red components are
premultiplied by the alpha value. If blue, green, or red is greater than alpha,
the drawn result is undefined.

If paired with kUnpremul_SkAlphaType: blue, green, red, and alpha components
may have any value. There may be a performance penalty with unpremultipled
pixels.

If paired with kOpaque_SkAlphaType: all alpha component values are at the maximum; 
blue, green, and red components are fully opaque. If any alpha component is
less than 255, the drawn result is undefined.

On Little_Endian platforms, BGRA_8888 is the native Color_Type, and will have
the best performance. Use kN32_SkColorType to choose the best Color_Type for
the platform at compile time.

#Example
#Height 96
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack8888 = [](unsigned a, unsigned r, unsigned g, unsigned b) -> uint32_t {
        return (b << 0) | (g << 8) | (r << 16) | (a << 24);
    };
    uint32_t red8888[] = { pack8888(0xFF, 0xFF, 0x0, 0x0), pack8888(0xFF, 0xbb, 0x0, 0x0), 
                           pack8888(0xFF, 0x99, 0x0, 0x0), pack8888(0xFF, 0x55, 0x0, 0x0) };
    uint32_t blue8888[] = { pack8888(0xFF, 0x0, 0x0, 0x0FF), pack8888(0xFF, 0x0, 0x0, 0x0bb),
                            pack8888(0xFF, 0x0, 0x0, 0x099), pack8888(0xFF, 0x0, 0x0, 0x055) };
    SkPixmap redPixmap(imageInfo, &red8888, imageInfo.minRowBytes());
    if (bitmap.writePixels(redPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blue8888, imageInfo.minRowBytes());
    if (bitmap.writePixels(bluePixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic RGBA_1010102

RGBA_1010102 is a 32-bit word pixel encoding that contains ten bits of red,
ten bits of green, ten bits of blue, and two bits of alpha. Possible alpha
values are zero: fully transparent; one: 33% opaque; two: 67% opaque;
three: fully opaque. 

#Illustration

If paired with kPremul_SkAlphaType: red, green, and blue components are
premultiplied by the alpha value. If red, green, or blue is greater than the
alpha replicated to ten bits, the drawn result is undefined.

If paired with kUnpremul_SkAlphaType: alpha, red, green, and blue components
may have any value. There may be a performance penalty with unpremultipled
pixels.

If paired with kOpaque_SkAlphaType: all alpha component values are at the maximum; 
red, green, and blue components are fully opaque. If any alpha component is
less than 3, the drawn result is undefined.

#Example
#Bug 7645
#Height 96
#Platform cpu
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGBA_1010102_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack1010102 = [](unsigned r, unsigned g, unsigned b, unsigned a) -> uint32_t {
        return (r << 0) | (g << 10) | (b << 20) | (a << 30);
    };
    uint32_t redBits[] =  { pack1010102(0x3FF, 0x000, 0x000, 0x3), 
                            pack1010102(0x2ff, 0x000, 0x000, 0x3), 
                            pack1010102(0x1ff, 0x000, 0x000, 0x3), 
                            pack1010102(0x0ff, 0x000, 0x000, 0x3) };
    uint32_t blueBits[] = { pack1010102(0x000, 0x000, 0x3FF, 0x3), 
                            pack1010102(0x000, 0x000, 0x2ff, 0x3),
                            pack1010102(0x000, 0x000, 0x1ff, 0x3), 
                            pack1010102(0x000, 0x000, 0x0ff, 0x3) };
    if (bitmap.installPixels(imageInfo, (void*) redBits, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blueBits, imageInfo.minRowBytes());
    if (bitmap.installPixels(imageInfo, (void*) blueBits, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic RGB_101010x

#Illustration

#Example
#Bug 7645
#Height 96
#Platform cpu
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGB_101010x_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto pack101010x = [](unsigned r, unsigned g, unsigned b) -> uint32_t {
        return (r << 0) | (g << 10) | (b << 20);
    };
    uint32_t redBits[] =  { pack101010x(0x3FF, 0x000, 0x000), pack101010x(0x2ff, 0x000, 0x000), 
    pack101010x(0x1ff, 0x000, 0x000), pack101010x(0x0ff, 0x000, 0x000) };
    uint32_t blueBits[] = { pack101010x(0x000, 0x000, 0x3FF), pack101010x(0x000, 0x000, 0x2ff),
    pack101010x(0x000, 0x000, 0x1ff), pack101010x(0x000, 0x000, 0x0ff) };
    if (bitmap.installPixels(imageInfo, (void*) redBits, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, &blueBits, imageInfo.minRowBytes());
    if (bitmap.installPixels(imageInfo, (void*) blueBits, imageInfo.minRowBytes())) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
##
##

#Subtopic Gray_8

#Example
#Height 64
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kGray_8_SkColorType, kOpaque_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    uint8_t gray8[] = { 0xFF, 0xBB, 0x77, 0x33 };
    SkPixmap grayPixmap(imageInfo, &gray8, imageInfo.minRowBytes());
    if (bitmap.writePixels(grayPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
##
##

#Subtopic RGBA_F16

#Illustration

#ToDo
FloatToHalf should be replaced with SkFloatToHalf if/when that's made public
##

#Example
#Height 96
#Function
union FloatUIntUnion {
    uint32_t fUInt;
    float    fFloat;
};

uint16_t FloatToHalf(float f) {
    static const FloatUIntUnion magic = { 15 << 23 };
    static const uint32_t round_mask = ~0xfffu;
    FloatUIntUnion floatUnion;
    floatUnion.fFloat = f;
    uint32_t sign = floatUnion.fUInt & 0x80000000u;
    floatUnion.fUInt ^= sign;
    floatUnion.fUInt &= round_mask;
    floatUnion.fFloat *= magic.fFloat;
    floatUnion.fUInt -= round_mask;
    return (floatUnion.fUInt >> 13) | (sign >> 16);
}
##

void draw(SkCanvas* canvas) {    
    canvas->scale(16, 16);
    SkBitmap bitmap;
    SkImageInfo imageInfo = SkImageInfo::Make(2, 2, kRGBA_F16_SkColorType, kPremul_SkAlphaType);
    bitmap.allocPixels(imageInfo);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorGREEN);
    canvas->drawBitmap(bitmap, 0, 0);
    auto H = [](float c) -> uint16_t {
        return FloatToHalf(c);
    };
                             //     R        G        B        A
    uint16_t red_f16[][4] =  { { H(1.0f), H(0.0f), H(0.0f), H(1.0f) },
                               { H(.75f), H(0.0f), H(0.0f), H(1.0f) }, 
                               { H(.50f), H(0.0f), H(0.0f), H(1.0f) },
                               { H(.25f), H(0.0f), H(0.0f), H(1.0f) } };
    uint16_t blue_f16[][4] = { { H(0.0f), H(0.0f), H(1.0f), H(1.0f) },
                               { H(0.0f), H(0.0f), H(.75f), H(1.0f) }, 
                               { H(0.0f), H(0.0f), H(.50f), H(1.0f) },
                               { H(0.0f), H(0.0f), H(.25f), H(1.0f) } };
    SkPixmap redPixmap(imageInfo, red_f16, imageInfo.minRowBytes());
    if (bitmap.writePixels(redPixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 2, 2);
    }
    SkPixmap bluePixmap(imageInfo, blue_f16, imageInfo.minRowBytes());
    if (bitmap.writePixels(bluePixmap, 0, 0)) {
        canvas->drawBitmap(bitmap, 4, 4);
    }
}
##
##

#Subtopic Color_Type ##

# ------------------------------------------------------------------------------
#Subtopic YUV_ColorSpace
#Alias YUV_ColorSpace
#Enum SkYUVColorSpace
#Line # incomplete ##

#Code
    enum SkYUVColorSpace {
        kJPEG_SkYUVColorSpace,
        kRec601_SkYUVColorSpace,
        kRec709_SkYUVColorSpace,
        kLastEnum_SkYUVColorSpace = kRec709_SkYUVColorSpace,
    };
##

Describes the color space a YUV pixel.

#Const kJPEG_SkYUVColorSpace 0
Standard JPEG color space.
##
#Const kRec601_SkYUVColorSpace 1
SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color
range. See http://en.wikipedia.org/wiki/Rec._601 for details.
##
#Const kRec709_SkYUVColorSpace 2
HDTV standard Rec. 709 color space. Uses "studio swing" [16, 235] color
range. See http://en.wikipedia.org/wiki/Rec._709 for details.
##

#Example
// incomplete
##

#SeeAlso incomplete

#Enum SkYUVColorSpace ##
#Subtopic YUV_ColorSpace ##

# ------------------------------------------------------------------------------
#EnumClass SkDestinationSurfaceColorMode
#Line # incomplete ##

#Code
    enum class SkDestinationSurfaceColorMode {
        kLegacy,
        kGammaAndColorSpaceAware,
    };
##

#Const kLegacy 0
##
#Const kGammaAndColorSpaceAware 1
##

#Example
// incomplete
##

#SeeAlso incomplete

#EnumClass SkDestinationSurfaceColorMode ##

# ------------------------------------------------------------------------------

#Struct SkImageInfo

Describes pixel dimensions and encoding. Bitmap, Image, PixMap, and Surface 
can be created from Image_Info. Image_Info can be retrieved from Bitmap and
Pixmap, but not from Image and Surface. For example, Image and Surface
implementations may defer pixel depth, so may not completely specify Image_Info.

Image_Info contains dimensions, the pixel integral width and height. It encodes
how pixel bits describe Color_Alpha, transparency; Color components red, blue,
and green; and Color_Space, the range and linearity of colors.

#Subtopic Member_Function
#Populate
##

#Subtopic Related_Function
#Populate
##

# ------------------------------------------------------------------------------
#Subtopic Constructor
#Populate
##

#Method SkImageInfo()

#In Constructor
#Line # creates with zero dimensions, kUnknown_SkColorType, kUnknown_SkAlphaType ##
Creates an empty Image_Info with kUnknown_SkColorType,  kUnknown_SkAlphaType,
a width and height of zero, and no Color_Space.

#Return empty Image_Info ##

#Example
#Height 32
#Description
An empty Image_Info may be passed to SkCanvas::accessTopLayerPixels as storage
for the Canvas actual Image_Info.
##
  SkImageInfo imageInfo;
  size_t rowBytes;
  SkIPoint origin;
  uint32_t* access = (uint32_t*) canvas->accessTopLayerPixels(&imageInfo, &rowBytes, &origin);
  const char* alphaType[] = { "Unknown", "Opaque", "Premul", "Unpremul" };
  SkString string;
  string.printf("k%s_SkAlphaType", alphaType[(int) imageInfo.alphaType()]);
  SkPaint paint;
  canvas->drawString(string, 20, 20, paint);
##

#SeeAlso Make MakeN32 MakeS32 MakeA8

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
                            sk_sp<SkColorSpace> cs = nullptr)
#In Constructor
#Line # creates Image_Info from dimensions, Color_Type, Alpha_Type, Color_Space ##
Creates Image_Info from integral dimensions width and height, Color_Type ct,
Alpha_Type at, and optionally Color_Space cs.

If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
defaults to sRGB, mapping into Surface Color_Space.

Parameters are not validated to see if their values are legal, or that the
combination is supported.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##
#Param ct  one of: #list_of_color_types#
##
#Param at  one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
                   kUnpremul_SkAlphaType
##
#Param cs  range of colors; may be nullptr ##

#Return created Image_Info ##

#Example
#Height 48
    uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },
                            { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },
                            { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },
                            { 0x90, 0x81, 0xC5, 0x71, 0x33 },
                            { 0x75, 0x55, 0x44, 0x40, 0x30 }};
    SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);
    SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);
    SkBitmap bitmap;
    bitmap.installPixels(pixmap);
    canvas->scale(8, 8);
    canvas->drawBitmap(bitmap, 0, 0);
##

#SeeAlso MakeN32 MakeN32Premul MakeS32 MakeA8

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeN32(int width, int height, SkAlphaType at,
                               sk_sp<SkColorSpace> cs = nullptr)
#In Constructor
#Line # creates Image_Info with Native_Color_Type ##
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
Alpha_Type at, and optionally Color_Space cs. kN32_SkColorType will equal either
kBGRA_8888_SkColorType or kRGBA_8888_SkColorType, whichever is optimal.

If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
defaults to sRGB, mapping into Surface Color_Space.

Parameters are not validated to see if their values are legal, or that the
combination is supported.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##
#Param at  one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
                   kUnpremul_SkAlphaType
##
#Param cs  range of colors; may be nullptr ##

#Return created Image_Info ##

#Example
#Height 128
    SkBitmap bitmap;
    bitmap.allocPixels(SkImageInfo::MakeN32(16, 16, kPremul_SkAlphaType));
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorWHITE);
    SkPaint paint;
    offscreen.drawString("g", 0, 10, paint);
    canvas->scale(8, 8);
    canvas->drawBitmap(bitmap, 0, 0);
##

#SeeAlso Make MakeN32Premul MakeS32 MakeA8

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeS32(int width, int height, SkAlphaType at)

#In Constructor
#Line # creates Image_Info with Native_Color_Type, sRGB Color_Space ##
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
Alpha_Type at, with sRGB Color_Space.

Parameters are not validated to see if their values are legal, or that the
combination is supported.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##
#Param at  one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
                   kUnpremul_SkAlphaType
##

#Return created Image_Info ##

#Example
#Set sRGB
#Height 128
#Description
Top gradient is drawn to offscreen without Color_Space. It is darker than middle
gradient, drawn to offscreen with sRGB Color_Space. Bottom gradient shares bits
with middle, but does not specify the Color_Space in noColorSpaceBitmap. A source
without Color_Space is treated as sRGB; the bottom gradient is identical to the
middle gradient.
##
    const int width = 256;
    const int height = 32;
    SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
    SkColor  gradColors[] = { 0xFFAA0055, 0xFF11CC88 };
    SkPoint  gradPoints[] = { { 0, 0 }, { width, 0 } };
    SkPaint gradPaint;
    gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
                    SK_ARRAY_COUNT(gradColors), SkShader::kClamp_TileMode));
    SkBitmap bitmap;
    bitmap.allocPixels(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));
    SkCanvas offscreen(bitmap);
    offscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
    canvas->drawBitmap(bitmap, 0, 0);
    bitmap.allocPixels(SkImageInfo::MakeS32(width, height, kPremul_SkAlphaType));
    SkCanvas sRGBOffscreen(bitmap);
    sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
    canvas->drawBitmap(bitmap, 0, 48);
    SkBitmap noColorSpaceBitmap;
    noColorSpaceBitmap.setInfo(SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType));
    noColorSpaceBitmap.setPixels(bitmap.getAddr(0, 0));
    canvas->drawBitmap(noColorSpaceBitmap, 0, 96);
##

#SeeAlso Make MakeN32 MakeN32Premul MakeA8

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr)

#In Constructor
#Line # creates Image_Info with Native_Color_Type, kPremul_SkAlphaType ##
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
kPremul_SkAlphaType, with optional Color_Space.

If Color_Space cs is nullptr and Image_Info is part of drawing source: Color_Space
defaults to sRGB, mapping into Surface Color_Space.

Parameters are not validated to see if their values are legal, or that the
combination is supported.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##
#Param cs  range of colors; may be nullptr ##

#Return created Image_Info ##

#Example
    SkBitmap bitmap;
    bitmap.allocPixels(SkImageInfo::MakeN32Premul(18, 18));
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorWHITE);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(15);
    offscreen.drawString("\xF0\x9F\x98\xB8", 1, 15, paint);
    canvas->scale(6, 6);
    canvas->drawBitmap(bitmap, 0, 0);
##

#SeeAlso MakeN32 MakeS32 MakeA8 Make

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeN32Premul(const SkISize& size)

#In Constructor
Creates Image_Info from integral dimensions width and height, kN32_SkColorType,
kPremul_SkAlphaType, with Color_Space set to nullptr.

If Image_Info is part of drawing source: Color_Space defaults to sRGB, mapping
into Surface Color_Space.

Parameters are not validated to see if their values are legal, or that the
combination is supported.

#Param size  width and height, each must be zero or greater ##

#Return created Image_Info ##

#Example
    SkBitmap bitmap;
    bitmap.allocPixels(SkImageInfo::MakeN32Premul({18, 18}));
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorWHITE);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(15);
    offscreen.drawString("\xF0\x9F\x98\xB9", 1, 15, paint);
    canvas->scale(6, 6);
    canvas->drawBitmap(bitmap, 0, 0);
##

#SeeAlso MakeN32 MakeS32 MakeA8 Make 

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeA8(int width, int height)

#In Constructor
#Line # creates Image_Info with kAlpha_8_SkColorType, kPremul_SkAlphaType ##
Creates Image_Info from integral dimensions width and height, kAlpha_8_SkColorType,
kPremul_SkAlphaType, with Color_Space set to nullptr.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##

#Return created Image_Info ##

#Example
// incomplete
##

#SeeAlso MakeN32 MakeS32 Make

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeUnknown(int width, int height)

#In Constructor
#Line # creates Image_Info with kUnknown_SkColorType, kUnknown_SkAlphaType ##
Creates Image_Info from integral dimensions width and height, kUnknown_SkColorType,
kUnknown_SkAlphaType, with Color_Space set to nullptr.

Returned Image_Info as part of source does not draw, and as part of destination
can not be drawn to.

#Param width  pixel column count; must be zero or greater ##
#Param height  pixel row count; must be zero or greater ##

#Return created Image_Info ##

#Example
#Height 32
#Width 384
SkImageInfo info;  // default constructor
SkString string;
string.printf("SkImageInfo() %c= SkImageInfo::MakeUnknown(0, 0)",
              info == SkImageInfo::MakeUnknown(0, 0) ? '=' : '!');
SkPaint paint;
canvas->drawString(string, 0, 12, paint);
##

#SeeAlso SkImageInfo() MakeN32 MakeS32 Make

#Method ##

# ------------------------------------------------------------------------------

#Method static SkImageInfo MakeUnknown()

#In Constructor
Creates Image_Info from integral dimensions width and height set to zero,
kUnknown_SkColorType, kUnknown_SkAlphaType, with Color_Space set to nullptr.

Returned Image_Info as part of source does not draw, and as part of destination
can not be drawn to.

#Return created Image_Info ##

#Example
#Height 32
#Width 384
SkImageInfo info;  // default constructor
SkString string;
string.printf("SkImageInfo() %c= SkImageInfo::MakeUnknown()",
              info == SkImageInfo::MakeUnknown() ? '=' : '!');
SkPaint paint;
canvas->drawString(string, 0, 12, paint);
##

#SeeAlso SkImageInfo() MakeN32 MakeS32 Make

#Method ##


# ------------------------------------------------------------------------------
#Subtopic Property
#Populate
#Line # metrics and attributes ##
##

#Method int width() const
#In Property
#Line # returns pixel column count ##
Returns pixel count in each row.

#Return pixel width ##

#Example
#Image 4
#Height 96
   canvas->translate(10, 10);
   canvas->drawBitmap(source, 0, 0);
   SkImageInfo imageInfo = source.info();
   canvas->translate(0, imageInfo.height());
   SkPaint paint;
   paint.setTextAlign(SkPaint::kCenter_Align);
   canvas->drawLine(0, 10, imageInfo.width(), 10, paint);
   canvas->drawString("width", imageInfo.width() / 2, 25, paint);
##

#SeeAlso height SkBitmap::width SkPixelRef::width SkImage::width SkSurface::width

#Method ##

# ------------------------------------------------------------------------------

#Method int height() const
#In Property
#Line # returns pixel row count ##
Returns pixel row count.

#Return pixel height ##

#Example
#Image 4
#Height 96
   canvas->translate(10, 20);
   canvas->drawBitmap(source, 0, 0);
   SkImageInfo imageInfo = source.info();
   SkPaint paint;
   paint.setTextAlign(SkPaint::kCenter_Align);
   paint.setVerticalText(true);
   canvas->drawLine(imageInfo.width() + 10, 0, imageInfo.width() + 10, imageInfo.height(), paint);
   canvas->drawString("height", imageInfo.width() + 25, imageInfo.height() / 2, paint);
##

#SeeAlso width SkBitmap::height SkPixelRef::height SkImage::height SkSurface::height

#Method ##

# ------------------------------------------------------------------------------

#Method SkColorType colorType() const
#In Property
#Line # incomplete ##
Returns Color_Type, one of: #list_of_color_types#.

#Return Color_Type ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkAlphaType alphaType() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkColorSpace* colorSpace() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method sk_sp<SkColorSpace> refColorSpace() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method bool isEmpty() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method bool isOpaque() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkISize dimensions() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkIRect bounds() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method bool gammaCloseToSRGB() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkImageInfo makeWH(int newWidth, int newHeight) const
#In Constructor
#Line # creates Image_Info with changed dimensions ##
Creates Image_Info with the same Color_Type and Alpha_Type as this info,
but with the specified width and height.

#Param newWidth  incomplete ##
#Param newHeight  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
#In Constructor
#Line # creates Image_Info with changed Alpha_Type ##
#Param newAlphaType  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkImageInfo makeColorType(SkColorType newColorType) const
#In Constructor
#Line # creates Image_Info with changed Color_Type ##
#Param newColorType  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const
#In Constructor
#Line # creates Image_Info with changed Color_Space ##
#Param cs  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method int bytesPerPixel() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method int shiftPerPixel() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method uint64_t minRowBytes64() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method size_t minRowBytes() const
#In Property
#Line # incomplete ##
#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method size_t computeOffset(int x, int y, size_t rowBytes) const
#In Utility
#Line # incomplete ##
#Param x  incomplete ##
#Param y  incomplete ##
#Param rowBytes  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------
#Subtopic Operator
#Populate
##

#Method bool operator==(const SkImageInfo& other)_const

#Line # incomplete ##
#Param other  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method bool operator!=(const SkImageInfo& other)_const

#Line # incomplete ##
#Param other  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method void unflatten(SkReadBuffer& buffer)
#In Utility
#Line # incomplete ##
#Param buffer  incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method void flatten(SkWriteBuffer& buffer) const
#In Utility
#Line # incomplete ##
#Param buffer  incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method size_t computeByteSize(size_t rowBytes) const
#In Utility
#Line # incomplete ##
Returns the size (in bytes) of the image buffer that this info needs, given the specified
rowBytes. The rowBytes must be >= this->minRowBytes().
if (height == 0) {
return 0;
} else {
return (height - 1) * rowBytes + width * bytes_per_pixel.

If the calculation overflows this returns SK_MaxSizeT.

#Param rowBytes  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method size_t computeMinByteSize() const
#In Utility
#Line # incomplete ##
Returns the minimum size (in bytes) of the image buffer that this info needs.
If the calculation overflows, or if the height is 0, this returns 0.

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method static bool ByteSizeOverflowed(size_t byteSize)
#In Utility
#Line # incomplete ##
Returns true if the result of computeByteSize (or computeMinByteSize) overflowed

#Param byteSize  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method bool validRowBytes(size_t rowBytes) const
#In Utility
#Line # incomplete ##
#Param rowBytes  incomplete ##

#Return incomplete ##

#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------

#Method void reset()
#In Constructor
#Line # incomplete ##
#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

# ------------------------------------------------------------------------------
#Subtopic Utility
#Populate
#Line # rarely called management functions ##
##

#Method void validate() const
#In Utility
#Line # incomplete ##
#Example
// incomplete
##

#SeeAlso incomplete

#Method ##

#Struct SkImageInfo ##

#Topic Image_Info ##