aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkBlendMode_Reference.bmh
blob: 3e4aa4c168e0162d3b3e2bf24c59a88600a43fbe (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
#Topic Blend_Mode
#Alias BlendMode_Reference ##

#Subtopic Overview
#Populate
##

#Subtopic Member_Function
#Populate
##

#Subtopic Constant
#Populate
##

Describes how destination pixel is replaced with a combination of itself and
source pixel. Blend_Mode may use source, destination, or both. Blend_Mode may
operate on each Color component independently, or may allow all source pixel
components to contribute to one destination pixel component. 

Blend_Mode does not use adjacent pixels to determine the outcome.

Blend_Mode uses source and read destination Alpha to determine written
destination Alpha; both source and destination Alpha may also affect written
destination Color components.

Regardless of how Alpha is encoded in source and destination pixel, nearly all
Color_Types treat it as ranging from zero to one. And, nearly all Blend_Mode
algorithms limit the output so that all results are also zero to one.

Two exceptions are SkBlendMode::kPlus and kRGBA_F16_SkColorType. 

SkBlendMode::kPlus permits computing Alpha and Color component values larger
than one. For Color_Types other than kRGBA_F16_SkColorType, resulting Alpha
and component values are clamped to one.

kRGBA_F16_SkColorType permits values outside the zero to one range. It is up
to the client to ensure that the result is within the range of zero to one,
and therefore well-defined.

#Subtopic Porter_Duff

#A Compositing Digital Images # https://graphics.pixar.com/library/Compositing/paper.pdf ##
describes Porter_Duff modes SkBlendMode::kClear through SkBlendMode::kXor.

Drawing a bitmap with transparency using Porter_Duff compositing is free to clear
the destination.

#Illustration 1

Draw geometry with transparency using Porter_Duff compositing does not combine
transparent source pixels, leaving the destination outside the geometry untouched.

#Illustration 2

##

#Subtopic Lighten_Darken

Modes SkBlendMode::kPlus and SkBlendMode::kScreen use
simple arithmetic to lighten or darken the destination. Modes 
SkBlendMode::kOverlay through SkBlendMode::kMultiply use more complicated
algorithms to lighten or darken; sometimes one mode does both, as described by
#A Blend Modes # https://en.wikipedia.org/wiki/Blend_modes ##
.

#Illustration

##

#Subtopic Modulate_Blend
SkBlendMode::kModulate is a mashup of SkBlendMode::kSrcATop and SkBlendMode::kMultiply.
It multiplies all components, including Alpha; unlike SkBlendMode::kMultiply, if either
source or destination is transparent, result is transparent. SkBlendMode::kModulate
uses Premultiplied values to compute the product; SkBlendMode::kMultiply uses Unpremultiplied
values to compute the product.

#Illustration

##

#Subtopic Color_Blends

Modes SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor, and
SkBlendMode::kLuminosity convert source and destination pixels using all
components color information, using 
###$
$A non-separable blend modes $ https://www.w3.org/TR/compositing-1/#blendingnonseparable $$
$$$#
.

#Illustration

##

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

#PhraseDef list_of_blend_modes
SkBlendMode::kClear, SkBlendMode::kSrc, SkBlendMode::kDst, SkBlendMode::kSrcOver,
SkBlendMode::kDstOver, SkBlendMode::kSrcIn, SkBlendMode::kDstIn,
SkBlendMode::kSrcOut, SkBlendMode::kDstOut, SkBlendMode::kSrcATop,
SkBlendMode::kDstATop, SkBlendMode::kXor, SkBlendMode::kPlus,
SkBlendMode::kModulate, SkBlendMode::kScreen, SkBlendMode::kOverlay,
SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,
SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,
SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply,
SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,
SkBlendMode::kLuminosity
##

#EnumClass SkBlendMode
#Line # algorithm combining source and destination pixels ##

#Code
    enum class SkBlendMode {
        kClear,
        kSrc,
        kDst,
        kSrcOver,
        kDstOver,
        kSrcIn,
        kDstIn,
        kSrcOut,
        kDstOut,
        kSrcATop,
        kDstATop,
        kXor,
        kPlus,
        kModulate,
        kScreen,
        kLastCoeffMode = kScreen,
        kOverlay,
        kDarken,
        kLighten,
        kColorDodge,
        kColorBurn,
        kHardLight,
        kSoftLight,
        kDifference,
        kExclusion,
        kMultiply,
        kLastSeparableMode = kMultiply,
        kHue,
        kSaturation,
        kColor,
        kLuminosity,
        kLastMode = kLuminosity,
    };
##

#Const kClear 0
#Line # replaces destination with zero: fully transparent ##
#Details Clear
Replaces destination with Alpha and Color components set to zero;
a fully transparent pixel.
##

#Const kSrc 1
#Line # replaces destination ##
#Details Src
Replaces destination with source. Destination alpha and color component values
are ignored.
##

#Const kDst 2
#Line # preserves destination ##
#Details Dst
Preserves destination, ignoring source. Drawing with Paint set to kDst has
no effect.
##

#Const kSrcOver 3
#Line # source over destination ##
#Details Src_Over
Replaces destination with source blended with destination. If source is opaque,
replaces destination with source. Used as the default Blend_Mode for SkPaint.
##

#Const kDstOver 4
#Line # destination over source ##
#Details Dst_Over
Replaces destination with destination blended with source. If destination is opaque,
has no effect.
##

#Const kSrcIn 5
#Line # source trimmed inside destination ##
#Details Src_In
Replaces destination with source using destination opacity.
##

#Const kDstIn 6
#Line # destination trimmed by source ##
#Details Dst_In
Scales destination opacity by source opacity. 
##

#Const kSrcOut 7
#Line # source trimmed outside destination ##
#Details Src_Out
Replaces destination with source using the inverse of destination opacity,
drawing source fully where destination opacity is zero.
##

#Const kDstOut 8
#Line # destination trimmed outside source ##
#Details Dst_Out
Replaces destination opacity with inverse of source opacity. If source is
transparent, has no effect.
##

#Const kSrcATop 9
#Line # source inside destination blended with destination ##
#Details Src_Atop
Blends destination with source using read destination opacity.
##

#Const kDstATop 10
#Line # destination inside source blended with source ##
#Details Dst_Atop
Blends destination with source using source opacity.
##

#Const kXor 11
#Line # each of source and destination trimmed outside the other ##
#Details Xor
Blends destination by exchanging transparency of the source and destination.
##

#Const kPlus 12
#Line # sum of colors ##
#Details Plus
Replaces destination with source and destination added together.
##

#Const kModulate 13
#Line # product of Premultiplied colors; darkens destination ##
#Details Modulate
Replaces destination with source and destination multiplied together.
##

#Const kScreen 14
#Line # multiply inverse of pixels, inverting result; brightens destination ##
#Details Screen
Replaces destination with inverted source and destination multiplied together.
##

#Const kLastCoeffMode 14
#Line # last Porter_Duff blend mode ##
##

#Const kOverlay 15
#Line # multiply or screen, depending on destination ##
#Details Overlay
Replaces destination with multiply or screen, depending on destination.
##

#Const kDarken 16
#Line # darker of source and destination ##
#Details Darken
Replaces destination with darker of source and destination.
##

#Const kLighten 17
#Line # lighter of source and destination ##
#Details Lighten
Replaces destination with lighter of source and destination.
##

#Const kColorDodge 18
#Line # brighten destination to reflect source ##
#Details Color_Dodge
Makes destination brighter to reflect source.
##

#Const kColorBurn 19
#Line # darken destination to reflect source ##
#Details Color_Burn
Makes destination darker to reflect source.
##

#Const kHardLight 20
#Line # multiply or screen, depending on source ##
#Details Hard_Light
Makes destination lighter or darker, depending on source.
##

#Const kSoftLight 21
#Line # lighten or darken, depending on source ##
#Details Soft_Light
Makes destination lighter or darker, depending on source.
##

#Const kDifference 22
#Line # subtract darker from lighter with higher contrast ##
#Details Difference
Subtracts darker from lighter with higher contrast.
##

#Const kExclusion 23
#Line # subtract darker from lighter with lower contrast ##
#Details Exclusion
Subtracts darker from lighter with lower contrast.
##

#Const kMultiply 24
#Line # multiply source with destination, darkening image ##
#Details Multiply
Multiplies source with destination, darkening image.
##

#Const kLastSeparableMode 24
#Line # last blend mode operating separately on components ##
Last blend mode operating separately on components.
##

#Const kHue 25
#Line # hue of source with saturation and luminosity of destination ##
#Details Hue
Replaces hue of destination with hue of source, leaving saturation and luminosity
unchanged.
##

#Const kSaturation 26
#Line # saturation of source with hue and luminosity of destination ##
#Details Saturation
Replaces saturation of destination saturation hue of source, leaving hue and
luminosity unchanged.
##

#Const kColor 27
#Line # hue and saturation of source with luminosity of destination ##
#Details Color
Replaces hue and saturation of destination with hue and saturation of source,
leaving luminosity unchanged.
##

#Const kLuminosity 28
#Line # luminosity of source with hue and saturation of destination ##
#Details Luminosity
Replaces luminosity of destination with luminosity of source, leaving hue and
saturation unchanged.
##

#Const kLastMode 28
#Line # last valid value ##
Used by tests to iterate through all valid values.
##

#NoExample
##

#SeeAlso SkCanvas::drawColor SkCanvas::drawVertices SkPaint SkShader::MakeCompose SkXfermodeImageFilter

#EnumClass SkBlendMode ##

#Subtopic Clear
#Line # makes destination pixels transparent ##
SkBlendMode::kClear sets destination to:
#Formula
[0, 0]
##
. Use SkBlendMode::kClear to initialize a buffer to fully transparent pixels when
creating a mask with irregular edges.

#Example
#Description
SK_ColorYELLOW is ignored because SkBlendMode::kClear ignores the source pixel
value and the destination pixel value, always setting the destination to zero.
##
    canvas->saveLayer(nullptr, nullptr);
    canvas->drawColor(SK_ColorYELLOW, SkBlendMode::kClear);
    SkPaint paint;
    for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
        SkColor colors[] = { color, SkColorSetA(color, 0) }; 
        paint.setShader(SkGradientShader::MakeRadial({ 64, 64}, 100,
                colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
        canvas->drawCircle(64, 64, 100, paint);
        canvas->translate(64, 64);
    }
    canvas->restore();
##
#SeeAlso SkCanvas::clear
##

#Subtopic Src
#Line # replaces destination, ignoring Alpha ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component
##
; SkBlendMode::kSrc sets destination to:
#Formula
[Sa, Sc]
##
. Use SkBlendMode::kSrc to copy one buffer to another. All pixels are copied,
regardless of source and destination Alpha values. As a parameter to
SkCanvas::drawAtlas, selects sprites and ignores colors.
#Example
#Image 3
#Description
SkBlendMode::kSrc does not blend transparent pixels with existing background;
it punches a transparent hole in the existing image.
##
    canvas->drawImage(image, 0, 0);
    canvas->clipRect({50, 50, 200, 200});
    SkPaint srcBlend;
    srcBlend.setBlendMode(SkBlendMode::kSrc);
    canvas->saveLayer(nullptr, &srcBlend);
    canvas->drawColor(0);
    SkPaint transRed;
    transRed.setColor(SkColorSetA(SK_ColorRED, 127));
    canvas->drawCircle(125, 125, 75, transRed);
    canvas->restore();
##
#SeeAlso SkSurface::draw SkSurface::readPixels
##

#Subtopic Dst
#Line # preserves destination, ignoring source ##
Given:
#Formula
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDst preserves destination set to:
#Formula
[Da, Dc]
##
. Setting Paint Blend_Mode to SkBlendMode::kDst causes drawing with
Paint to have no effect. As a parameter to SkCanvas::drawAtlas,
selects colors and ignores sprites.
#Example
#Image 3
  SkRSXform xforms[] = { { .5f, 0, 0, 0 }, {0, .5f, 125, 128 } };
  SkRect tex[] = { { 0, 0, 250, 250 }, { 0, 0, 250, 250 } };
  SkColor colors[] = { 0x7f55aa00, 0x7f3333bf };
  canvas->drawAtlas(image.get(), xforms, tex, colors, 2, SkBlendMode::kSrc, nullptr, nullptr);
  canvas->translate(128, 0);
  canvas->drawAtlas(image.get(), xforms, tex, colors, 2, SkBlendMode::kDst, nullptr, nullptr);
##
##

#Subtopic Src_Over
#Line # blends source with destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kSrcOver replaces destination with:
#Formula
[Sa + Da * (1 - Sa), Sc + Dc * (1 - Sa)]
##
, drawing source over destination. SkBlendMode::kSrcOver is the default for Paint.

SkBlendMode::kSrcOver cannot make destination more transparent; the result will
be at least as opaque as the less transparent of source and original destination.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcOver);
##
##

#Subtopic Dst_Over
#Line # blends destination with source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDstOver replaces destination with:
#Formula
[Da + Sa * (1 - Da), Dc + Sc * (1 - Da)]
##
, drawing destination over source. Has no effect destination if is opaque.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kDstOver);
##
##

#Subtopic Src_In
#Line # source trimmed inside destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component, Da as destination Alpha
##
; SkBlendMode::kSrcIn replaces destination with:
#Formula
[Sa * Da, Sc * Da]
##
, drawing source with destination opacity.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcIn);
##
##

#Subtopic Dst_In
#Line # destination trimmed by source ##
Given:
#Formula
Sa as source Alpha, Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDstIn replaces destination with:
#Formula
[Da * Sa, Dc * Sa]
##
, scaling destination Alpha by source Alpha. Resulting
destination is visible where source is visible.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kDstIn);
##
##

#Subtopic Src_Out
#Line # source trimmed outside destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component, Da as destination Alpha
##
; SkBlendMode::kSrcOut replaces destination with:
#Formula
[Sa * (1 - Da), Sc * (1 - Da)]
##
, drawing source fully where destination Alpha is zero. Is destination
is opaque, has no effect.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcOut);
##
##

#Subtopic Dst_Out
#Line # destination trimmed outside source ##
Given:
#Formula
Sa as source Alpha, Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDstOut replaces destination with:
#Formula
[Da * (1 - Sa), Dc * (1 - Sa)]
##
, scaling destination Alpha by source transparency. Resulting
destination is visible where source is transparent. If source is transparent,
has no effect.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kDstOut);
##
##

#Subtopic Src_Atop
#Line # source inside destination over destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kSrcATop replaces destination with:
#Formula
[Da, Sc * Da + Dc * (1 - Sa)]
##
, replacing opaque destination with opaque source. If source or destination
is transparent, has no effect.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstIn);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcATop);
##
##

#Subtopic Dst_Atop
#Line # destination inside source over source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDstATop replaces destination with:
#Formula
[Sa, Dc * Sa + Sc * (1 - Da)]
##
, making destination transparent where source is transparent.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcATop);
##
##

#Subtopic Xor
#Line # each of source and destination trimmed outside the other ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kXor replaces destination with:
#Formula
[Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa)]
##
, exchanging the transparency of the source and destination.
#Example
   SkPaint paint;
   paint.setBlendMode(SkBlendMode::kXor);
   for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
       SkColor colors[] = { color, SkColorSetA(color, 192), SkColorSetA(color, 128),
                            SkColorSetA(color, 0) }; 
       paint.setShader(SkGradientShader::MakeRadial({ 64, 64}, 100,
               colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
       canvas->drawCircle(64, 64, 100, paint);
       canvas->translate(64, 64);
   }
##
##

#Subtopic Plus
#Line # sum of colors ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kPlus replaces destination with:
#Formula
[Sa + Da, Sc + Dc]
##
, summing the Alpha and Color components.
#Example
   canvas->drawColor(SK_ColorBLACK);
   SkPaint paint;
   paint.setBlendMode(SkBlendMode::kPlus);
   for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
       SkColor colors[] = { color, SkColorSetA(color, 192), SkColorSetA(color, 128),
                            SkColorSetA(color, 0) }; 
       paint.setShader(SkGradientShader::MakeRadial({ 64, 64}, 100,
               colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
       canvas->drawCircle(64, 64, 100, paint);
       canvas->translate(64, 64);
   }
##
##

#Subtopic Modulate
#Line # product of Premultiplied colors; darkens destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kModulate replaces destination with:
#Formula
[Sa * Da, Sc * Dc]
##
, scaling Alpha and Color components by the lesser of the values.
SkBlendMode::kModulate differs from SkBlendMode::kMultiply in two ways.
SkBlendMode::kModulate like SkBlendMode::kSrcATop alters the destination inside
the destination area, as if the destination Alpha defined the boundaries of a
soft clip. SkBlendMode::kMultiply like SkBlendMode::kSrcOver can alter the
destination where the destination is transparent.
SkBlendMode::kModulate computes the product of the source and destination using
Premultiplied component values. SkBlendMode::kMultiply the product of the source
and destination using Unpremultiplied component values.
#Example
#Description
    If source and destination are opaque, SkBlendMode::kModulate and
    SkBlendMode::kMultiply produce the same results.
##
    auto drawSquare = [=](int dx, int dy, SkBlendMode mode, const char* label) -> void {
        const SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
        const SkPoint horz[] = { { 0, 0 }, { 128, 0 } };
        SkPaint paint;
        paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
                SkShader::kClamp_TileMode));
        paint.setBlendMode(mode);
        canvas->translate(dx, dy);
        canvas->drawRect({0, 0, 128, 128}, paint);
        paint.setBlendMode(SkBlendMode::kXor);
        canvas->drawString(label, 40, 100, paint);
    };
    drawSquare(0, 0, SkBlendMode::kSrc, "destination");
    drawSquare(128, 0, SkBlendMode::kSrc, "");
    drawSquare(0, 128, SkBlendMode::kSrc, "");
    canvas->translate(-128, -128);
    canvas->rotate(90, 0, 128);
    drawSquare(0, 0, SkBlendMode::kSrc, "source");
    drawSquare(0, -128, SkBlendMode::kModulate, "modulate");
    drawSquare(-128, 0, SkBlendMode::kMultiply, "multiply");
##
##

#Subtopic Screen
#Line # multiply inverse of pixels, inverting result; brightens destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kScreen replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
##
. 
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kScreen);
##
##

#Subtopic Overlay
#Line # multiply or screen, depending on destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kOverlay replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) +
    (2 * Dc <= Da ? 2 * Sc * Dc : Sa * Da - 2 * (Da - Dc) * (Sa - Sc))]
##
.
#Example
    SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kOverlay);
##
##

#Subtopic Darken
#Line # darker of source and destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDarken replaces destination with:
#Formula
[Sa + Da - Sa * Da,  Sc + Dc - max(Sc * Da, Dc * Sa)]
##
. SkBlendMode::kDarken does not make an image darker; it replaces the destination
component with source if source is darker. 
#Example
#Image 3
    canvas->drawImage(image, 0, 0);
    SkColor colors[] = { SK_ColorWHITE, SK_ColorBLACK };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    paint.setBlendMode(SkBlendMode::kDarken);
    canvas->drawPaint(paint);
##
##

#Subtopic Lighten
#Line # lighter of source and destination ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kLighten replaces destination with:
#Formula
[Sa + Da - Sa * Da,  Sc + Dc - min(Sc * Da, Dc * Sa)]
##
. SkBlendMode::kDarken does not make an image lighter; it replaces the destination
component with source if source is lighter. 
#Example
#Image 3
    canvas->drawImage(image, 0, 0);
    SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
    SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
            SkShader::kClamp_TileMode));
    paint.setBlendMode(SkBlendMode::kLighten);
    canvas->drawPaint(paint);
##
##

#Subtopic Color_Dodge
#Line # brighten destination to reflect source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kColorDodge replaces destination with:
#Formula
[Sa + Da - Sa * Da, Dc == 0 ? Sc * (1 - Da) : Sc == Sa ? Sc + Da * (1 - Sa) :
            Sa * min(Da, Dc * Sa / (Sa - Sc)) + Sc * (1 - Da) + Da * (1 - Sa)]
##
, making destination brighter to reflect source.
#Example
#Image 3
    canvas->drawImage(image, 0, 0);
    canvas->clipRect({128, 0, 256, 256});
    canvas->drawColor(SkColorSetARGB(0x80, 0x90, 0x90, 0x90), SkBlendMode::kColorDodge);
##
##

#Subtopic Color_Burn
#Line # darken destination to reflect source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kColorBurn replaces destination with:
#Formula
[Sa + Da - Sa * Da, Dc == Da ? Dc + Sc * (1 - Da) : Sc == 0 ? Da * (1 - Sa) :
            Sa * (Da - min(Da, (Da - Dc) * Sa / Sc)) + Sc * (1 - Da) + Da * (1 - Sa)]
##
, making destination darker to reflect source.
#Example
#Image 3
    canvas->drawImage(image, 0, 0);
    canvas->clipRect({128, 0, 256, 256});
    canvas->drawColor(SkColorSetARGB(0x80, 0x90, 0x90, 0x90), SkBlendMode::kColorBurn);
##
##

#Subtopic Hard_Light
#Line # multiply or screen, depending on source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kHardLight replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) +
        2 * Sc <= Sa ? 2 * Sc * Dc : Sa * Da - 2 * (Da - Dc) * (Sa - Sc)]
##
, making destination lighter or darker, depending on source.
#Example
#Image 3
   canvas->drawImage(image, 0, 0);
   const SkColor colors[] = { 0xFFFFFFFF, 0x00000000 };
   SkPaint paint;
   paint.setBlendMode(SkBlendMode::kHardLight);
   paint.setShader(SkGradientShader::MakeRadial({ 128, 128}, 100, colors,
        nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
   canvas->clipRect({0, 128, 256, 256});
   canvas->drawPaint(paint);
##
##

#Subtopic Soft_Light
#Line # lighten or darken, depending on source ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
where m = Da > 0 ? Dc / Da : 0
##
; SkBlendMode::kSoftLight replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc / Da + Dc / Sa +
    (2 * Sc <= Sa ? Dc * (Sa + (2 * Sc - Sa) * (1 - m)) : Dc * Sa + Da * (2 * Sc - Sa) *
    (4 * Dc <= Da ? (16 * m * m  + 4 * m) * (m - 1) + 7 * m : sqrt(m) - m))]\
##
, making destination lighter or darker, depending on source.
#Example
#Image 3
   const SkColor colors[] = { 0xFFFFFFFF, 0x3FFFFFFF };
   SkPaint paint;
   paint.setBlendMode(SkBlendMode::kSoftLight);
   paint.setShader(SkGradientShader::MakeRadial({ 128, 128}, 100, colors,
        nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
   canvas->drawImage(image, 0, 0);
   canvas->drawCircle(128, 128, 100, paint);
##
##

#Subtopic Difference
#Line # subtract darker from lighter with higher contrast ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kDifference replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc + Dc - 2 * min(Sc * Da, Dc * Sa)]
##
, replacing destination with lighter less darker.
#Example
#Image 5
    canvas->drawImage(image, 0, 0);
    canvas->drawImage(image, 128, 0);
    canvas->drawImage(image, 0, 128);
    canvas->drawImage(image, 128, 128);
    SkPaint paint;
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(0x80bb9977, SkBlendMode::kDifference);
##
##

#Subtopic Exclusion
#Line # subtract darker from lighter with lower contrast ##
Given:
#Formula
Sa as source Alpha, Sc as source Color,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kExclusion replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc + Dc - 2 * Sc * Dc]
##
, replacing destination with lighter less darker, ignoring Alpha.
#Example
#Image 5
    canvas->drawImage(image, 0, 0);
    canvas->drawImage(image, 128, 0);
    canvas->drawImage(image, 0, 128);
    canvas->drawImage(image, 128, 128);
    SkPaint paint;
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(0x80bb9977, SkBlendMode::kExclusion);
##
##

#Subtopic Multiply
#Line # multiply source with destination, darkening image ##
Given:
#Formula
Sa as source Alpha, Sc as source Color component,
Da as destination Alpha, Dc as destination Color component
##
; SkBlendMode::kMultiply replaces destination with:
#Formula
[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) + Sc * Dc]
##
, the product of Unpremultiplied source and destination.
SkBlendMode::kMultiply makes the image darker.
#Example
#Image 5
    canvas->drawImage(image, 0, 0);
    canvas->drawImage(image, 128, 0);
    canvas->drawImage(image, 0, 128);
    canvas->drawImage(image, 128, 128);
    SkPaint paint;
    paint.setBlendMode(SkBlendMode::kDstATop);
    SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
    SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
    paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
            SkShader::kClamp_TileMode));
    canvas->drawPaint(paint);
    canvas->clipRect( { 30, 30, 226, 226 } );
    canvas->drawColor(0x80bb9977, SkBlendMode::kMultiply);
##
##

#Subtopic Hue
#Line # hue of source with saturation and luminosity of destination ##
Given:
#Formula
Sa as source Alpha, S as source Color,
Da as destination Alpha, D as destination Color
##
; SkBlendMode::kHue replaces destination with:
#Formula
[Sa + Da - Sa * Da, SetLuminosity(SetSaturation(S, Saturation(D)), Luminosity(D))]
##
, source hue, leaving destination luminosity and saturation unchanged.
#Example
#Image 3
canvas->drawImage(image, 0, 0);
canvas->drawColor(0xFF00FF00, SkBlendMode::kHue);
##
##

#Subtopic Saturation
#Line # saturation of source with hue and luminosity of destination ##
Given:
#Formula
Sa as source Alpha, S as source Color,
Da as destination Alpha, D as destination Color
##
; SkBlendMode::kHue replaces destination with:
#Formula
[Sa + Da - Sa * Da, SetLuminosity(SetSaturation(D, Saturation(S)), Luminosity(D))]
##
, source hue, leaving destination luminosity and saturation unchanged.
#Example
#Image 3
canvas->drawImage(image, 0, 0);
canvas->drawColor(0xFF00FF00, SkBlendMode::kSaturation);
##
##

#Subtopic Color
#Line # hue and saturation of source with luminosity of destination ##
Given:
#Formula
Sa as source Alpha, S as source Color,
Da as destination Alpha, D as destination Color
##
; SkBlendMode::kColor replaces destination with:
#Formula
[Sa + Da - Sa * Da, SetLuminosity(S, Luminosity(D))]
##
, source hue and saturation, leaving destination luminosity unchanged.
#Example
#Image 3
canvas->drawImage(image, 0, 0);
canvas->drawColor(0xFF00FF00, SkBlendMode::kColor);
##
##

#Subtopic Luminosity
#Line # luminosity of source with hue and saturation of destination ##
Given:
#Formula
Sa as source Alpha, S as source Color,
Da as destination Alpha, D as destination Color
##
; SkBlendMode::kLuminosity replaces destination with:
#Formula
[Sa + Da - Sa * Da, SetLuminosity(D, Luminosity(S))]
##
, source luminosity, leaving destination hue and saturation unchanged.
#Example
#Image 3
canvas->drawImage(image, 0, 0);
canvas->drawColor(0xFF00FF00, SkBlendMode::kLuminosity);
##
##

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

#Method SK_API const char* SkBlendMode_Name(SkBlendMode blendMode)
#In Utility
#Line # returns mode as C string ##

Returns name of blendMode as null-terminated C string.

#Param blendMode  one of: #list_of_blend_modes#
##

#Return C string ##

#Example
SkDebugf("default blend: SkBlendMode::k%s\n", SkBlendMode_Name(SkPaint().getBlendMode()));
#StdOut
default blend: SkBlendMode::kSrcOver
##
##

#SeeAlso SkBlendMode

#Method ##

#Topic Blend_Mode ##