1 SkBlendMode Reference 2 === 3 4 5 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 6 enum class <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> { 7 kClear, 8 kSrc, 9 kDst, 10 kSrcOver, 11 kDstOver, 12 kSrcIn, 13 kDstIn, 14 kSrcOut, 15 kDstOut, 16 kSrcATop, 17 kDstATop, 18 kXor, 19 kPlus, 20 kModulate, 21 kScreen, 22 kLastCoeffMode = kScreen, 23 kOverlay, 24 kDarken, 25 kLighten, 26 kColorDodge, 27 kColorBurn, 28 kHardLight, 29 kSoftLight, 30 kDifference, 31 kExclusion, 32 kMultiply, 33 kLastSeparableMode = kMultiply, 34 kHue, 35 kSaturation, 36 kColor, 37 kLuminosity, 38 kLastMode = kLuminosity, 39 }; 40 41 const char* <a href='SkBlendMode_Reference#SkBlendMode_Name'>SkBlendMode_Name</a>(<a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> blendMode); 42 </pre> 43 44 <a name='SkBlendMode'></a> 45 46 --- 47 48 ### Constants 49 50 <table style='border-collapse: collapse; width: 62.5em'> 51 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 52 <th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 53 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Details</th> 54 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 55 <tr style='background-color: #f0f0f0; '> 56 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kClear'><code>SkBlendMode::kClear</code></a></td> 57 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 58 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Clear'>Clear</a> </td> 59 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 60 Replaces destination with <a href='SkColor_Reference#Alpha'>Alpha</a> and <a href='SkColor_Reference#Color'>Color</a> components set to zero; 61 a fully transparent <a href='undocumented#Pixel'>pixel</a>. 62 </td> 63 </tr> 64 <tr> 65 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSrc'><code>SkBlendMode::kSrc</code></a></td> 66 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 67 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Src'>Src</a> </td> 68 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 69 Replaces destination with source. Destination <a href='SkColor_Reference#Alpha'>alpha</a> and <a href='SkColor_Reference#Color'>color</a> component values 70 are ignored. 71 </td> 72 </tr> 73 <tr style='background-color: #f0f0f0; '> 74 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDst'><code>SkBlendMode::kDst</code></a></td> 75 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 76 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Dst'>Dst</a> </td> 77 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 78 Preserves destination, ignoring source. Drawing with <a href='SkPaint_Reference#Paint'>Paint</a> set to <a href='#SkBlendMode_kDst'>kDst</a> has 79 no effect. 80 </td> 81 </tr> 82 <tr> 83 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSrcOver'><code>SkBlendMode::kSrcOver</code></a></td> 84 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 85 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Src_Over'>Src Over</a> </td> 86 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 87 Replaces destination with source blended with destination. If source is opaque, 88 replaces destination with source. Used as the default <a href='#Blend_Mode'>Blend_Mode</a> for <a href='SkPaint_Reference#SkPaint'>SkPaint</a>. 89 </td> 90 </tr> 91 <tr style='background-color: #f0f0f0; '> 92 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDstOver'><code>SkBlendMode::kDstOver</code></a></td> 93 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>4</td> 94 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Dst_Over'>Dst Over</a> </td> 95 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 96 Replaces destination with destination blended with source. If destination is opaque, 97 has no effect. 98 </td> 99 </tr> 100 <tr> 101 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSrcIn'><code>SkBlendMode::kSrcIn</code></a></td> 102 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 103 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Src_In'>Src In</a> </td> 104 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 105 Replaces destination with source using destination opacity. 106 </td> 107 </tr> 108 <tr style='background-color: #f0f0f0; '> 109 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDstIn'><code>SkBlendMode::kDstIn</code></a></td> 110 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>6</td> 111 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Dst_In'>Dst In</a> </td> 112 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 113 Scales destination opacity by source opacity. 114 </td> 115 </tr> 116 <tr> 117 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSrcOut'><code>SkBlendMode::kSrcOut</code></a></td> 118 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>7</td> 119 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Src_Out'>Src Out</a> </td> 120 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 121 Replaces destination with source using the inverse of destination opacity, 122 drawing source fully where destination opacity is zero. 123 </td> 124 </tr> 125 <tr style='background-color: #f0f0f0; '> 126 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDstOut'><code>SkBlendMode::kDstOut</code></a></td> 127 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>8</td> 128 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Dst_Out'>Dst Out</a> </td> 129 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 130 Replaces destination opacity with inverse of source opacity. If source is 131 transparent, has no effect. 132 </td> 133 </tr> 134 <tr> 135 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSrcATop'><code>SkBlendMode::kSrcATop</code></a></td> 136 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>9</td> 137 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Src_Atop'>Src Atop</a> </td> 138 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 139 Blends destination with source using read destination opacity. 140 </td> 141 </tr> 142 <tr style='background-color: #f0f0f0; '> 143 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDstATop'><code>SkBlendMode::kDstATop</code></a></td> 144 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>10</td> 145 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Dst_Atop'>Dst Atop</a> </td> 146 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 147 Blends destination with source using source opacity. 148 </td> 149 </tr> 150 <tr> 151 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kXor'><code>SkBlendMode::kXor</code></a></td> 152 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>11</td> 153 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Xor'>Xor</a> </td> 154 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 155 Blends destination by exchanging transparency of the source and destination. 156 </td> 157 </tr> 158 <tr style='background-color: #f0f0f0; '> 159 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kPlus'><code>SkBlendMode::kPlus</code></a></td> 160 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>12</td> 161 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Plus'>Plus</a> </td> 162 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 163 Replaces destination with source and destination added together. 164 </td> 165 </tr> 166 <tr> 167 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kModulate'><code>SkBlendMode::kModulate</code></a></td> 168 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>13</td> 169 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Modulate'>Modulate</a> </td> 170 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 171 Replaces destination with source and destination multiplied together. 172 </td> 173 </tr> 174 <tr style='background-color: #f0f0f0; '> 175 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kScreen'><code>SkBlendMode::kScreen</code></a></td> 176 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>14</td> 177 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Screen'>Screen</a> </td> 178 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 179 Replaces destination with inverted source and destination multiplied together. 180 </td> 181 </tr> 182 <tr> 183 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kLastCoeffMode'><code>SkBlendMode::kLastCoeffMode</code></a></td> 184 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>14</td> 185 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 186 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 187 last Porter_Duff blend mode</td> 188 </tr> 189 <tr style='background-color: #f0f0f0; '> 190 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kOverlay'><code>SkBlendMode::kOverlay</code></a></td> 191 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>15</td> 192 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Overlay'>Overlay</a> </td> 193 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 194 Replaces destination with multiply or screen, depending on destination. 195 </td> 196 </tr> 197 <tr> 198 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDarken'><code>SkBlendMode::kDarken</code></a></td> 199 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>16</td> 200 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Darken'>Darken</a> </td> 201 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 202 Replaces destination with darker of source and destination. 203 </td> 204 </tr> 205 <tr style='background-color: #f0f0f0; '> 206 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kLighten'><code>SkBlendMode::kLighten</code></a></td> 207 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>17</td> 208 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Lighten'>Lighten</a> </td> 209 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 210 Replaces destination with lighter of source and destination. 211 </td> 212 </tr> 213 <tr> 214 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kColorDodge'><code>SkBlendMode::kColorDodge</code></a></td> 215 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>18</td> 216 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Color_Dodge'>Color Dodge</a> </td> 217 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 218 Makes destination brighter to reflect source. 219 </td> 220 </tr> 221 <tr style='background-color: #f0f0f0; '> 222 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kColorBurn'><code>SkBlendMode::kColorBurn</code></a></td> 223 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>19</td> 224 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Color_Burn'>Color Burn</a> </td> 225 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 226 Makes destination darker to reflect source. 227 </td> 228 </tr> 229 <tr> 230 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kHardLight'><code>SkBlendMode::kHardLight</code></a></td> 231 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>20</td> 232 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Hard_Light'>Hard Light</a> </td> 233 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 234 Makes destination lighter or darker, depending on source. 235 </td> 236 </tr> 237 <tr style='background-color: #f0f0f0; '> 238 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSoftLight'><code>SkBlendMode::kSoftLight</code></a></td> 239 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>21</td> 240 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Soft_Light'>Soft Light</a> </td> 241 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 242 Makes destination lighter or darker, depending on source. 243 </td> 244 </tr> 245 <tr> 246 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kDifference'><code>SkBlendMode::kDifference</code></a></td> 247 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>22</td> 248 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Difference'>Difference</a> </td> 249 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 250 Subtracts darker from lighter with higher contrast. 251 </td> 252 </tr> 253 <tr style='background-color: #f0f0f0; '> 254 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kExclusion'><code>SkBlendMode::kExclusion</code></a></td> 255 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>23</td> 256 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Exclusion'>Exclusion</a> </td> 257 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 258 Subtracts darker from lighter with lower contrast. 259 </td> 260 </tr> 261 <tr> 262 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kMultiply'><code>SkBlendMode::kMultiply</code></a></td> 263 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>24</td> 264 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Multiply'>Multiply</a> </td> 265 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 266 Multiplies source with destination, darkening <a href='SkImage_Reference#Image'>image</a>. 267 </td> 268 </tr> 269 <tr style='background-color: #f0f0f0; '> 270 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kLastSeparableMode'><code>SkBlendMode::kLastSeparableMode</code></a></td> 271 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>24</td> 272 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 273 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 274 Last blend mode operating separately on components. 275 </td> 276 </tr> 277 <tr> 278 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kHue'><code>SkBlendMode::kHue</code></a></td> 279 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>25</td> 280 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Hue'>Hue</a> </td> 281 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 282 Replaces hue of destination with hue of source, leaving saturation and luminosity 283 unchanged. 284 </td> 285 </tr> 286 <tr style='background-color: #f0f0f0; '> 287 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kSaturation'><code>SkBlendMode::kSaturation</code></a></td> 288 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>26</td> 289 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Saturation'>Saturation</a> </td> 290 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 291 Replaces saturation of destination saturation hue of source, leaving hue and 292 luminosity unchanged. 293 </td> 294 </tr> 295 <tr> 296 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kColor'><code>SkBlendMode::kColor</code></a></td> 297 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>27</td> 298 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Color'>Color</a> </td> 299 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 300 Replaces hue and saturation of destination with hue and saturation of source, 301 leaving luminosity unchanged. 302 </td> 303 </tr> 304 <tr style='background-color: #f0f0f0; '> 305 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kLuminosity'><code>SkBlendMode::kLuminosity</code></a></td> 306 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>28</td> 307 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a href='#Luminosity'>Luminosity</a> </td> 308 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 309 Replaces luminosity of destination with luminosity of source, leaving hue and 310 saturation unchanged. 311 </td> 312 </tr> 313 <tr> 314 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkBlendMode_kLastMode'><code>SkBlendMode::kLastMode</code></a></td> 315 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>28</td> 316 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '></td> 317 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 318 Used by tests to iterate through all valid values. 319 </td> 320 </tr> 321 </table> 322 323 ### See Also 324 325 <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawColor'>drawColor</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawVertices'>drawVertices</a> <a href='SkPaint_Reference#SkPaint'>SkPaint</a> <a href='undocumented#SkShader'>SkShader</a>::<a href='#SkShader_MakeCompose'>MakeCompose</a> <a href='undocumented#SkXfermodeImageFilter'>SkXfermodeImageFilter</a> 326 327 <a name='Clear'></a> 328 329 --- 330 331 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kClear'>kClear</a> sets destination to: <code>[0, 0]</code>. 332 Use <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kClear'>kClear</a> to initialize a buffer to fully transparent pixels when 333 creating a mask with irregular edges. 334 335 ### Example 336 337 <div><fiddle-embed name="a9b56a26ca469bab9ab10e16f62fb2e2"><div><a href='SkColor_Reference#SK_ColorYELLOW'>SK_ColorYELLOW</a> is ignored because <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kClear'>kClear</a> ignores the source <a href='undocumented#Pixel'>pixel</a> 338 value and the destination <a href='undocumented#Pixel'>pixel</a> value, always setting the destination to zero. 339 </div></fiddle-embed></div> 340 341 ### See Also 342 343 <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_clear'>clear</a> 344 345 <a name='Src'></a> 346 347 --- 348 349 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component; 350 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrc'>kSrc</a> sets destination to: <code>[Sa, Sc]</code>. 351 Use <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrc'>kSrc</a> to copy one buffer to another. All pixels are copied, 352 regardless of source and destination <a href='SkColor_Reference#Alpha'>Alpha</a> values. As a parameter to 353 <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawAtlas'>drawAtlas</a>, selects <a href='undocumented#Sprite'>sprites</a> and ignores colors. 354 355 ### Example 356 357 <div><fiddle-embed name="0fc85dd916cc1a5896d36c80b9847391"><div><a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrc'>kSrc</a> does not blend transparent pixels with existing background; 358 it punches a transparent hole in the existing <a href='SkImage_Reference#Image'>image</a>. 359 </div></fiddle-embed></div> 360 361 ### See Also 362 363 <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_draw'>draw</a> <a href='SkSurface_Reference#SkSurface'>SkSurface</a>::<a href='#SkSurface_readPixels'>readPixels</a> 364 365 <a name='Dst'></a> 366 367 --- 368 369 Given: <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 370 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDst'>kDst</a> preserves destination set to: <code>[Da, Dc]</code>. 371 Setting <a href='SkPaint_Reference#Paint'>Paint</a> <a href='#Blend_Mode'>Blend_Mode</a> to <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDst'>kDst</a> causes drawing with 372 <a href='SkPaint_Reference#Paint'>Paint</a> to have no effect. As a parameter to <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawAtlas'>drawAtlas</a>, 373 selects colors and ignores <a href='undocumented#Sprite'>sprites</a>. 374 375 ### Example 376 377 <div><fiddle-embed name="35915a2273be1076f00f2e47998ce808"></fiddle-embed></div> 378 379 <a name='Src_Over'></a> 380 381 --- 382 383 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 384 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 385 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> replaces destination with: <code>[Sa + Da * (1 - Sa), Sc + Dc * (1 - Sa)]</code>, 386 drawing source over destination. <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> is the default for <a href='SkPaint_Reference#Paint'>Paint</a>. 387 388 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> cannot make destination more transparent; the result will 389 be at least as opaque as the less transparent of source and original destination. 390 391 ### Example 392 393 <div><fiddle-embed name="2ea9c149964a06cdb4929158cb4f15f8"></fiddle-embed></div> 394 395 <a name='Dst_Over'></a> 396 397 --- 398 399 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 400 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 401 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstOver'>kDstOver</a> replaces destination with: <code>[Da + Sa * (1 - Da), Dc + Sc * (1 - Da)]</code>, 402 drawing destination over source. Has no effect destination if is opaque. 403 404 ### Example 405 406 <div><fiddle-embed name="10dbb4d97902956ef5f5f8562f65119e"></fiddle-embed></div> 407 408 <a name='Src_In'></a> 409 410 --- 411 412 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 413 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>; 414 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcIn'>kSrcIn</a> replaces destination with: <code>[Sa * Da, Sc * Da]</code>, 415 drawing source with destination opacity. 416 417 ### Example 418 419 <div><fiddle-embed name="b0833c18fe8b0eeaab9bd6d2160d272f"></fiddle-embed></div> 420 421 <a name='Dst_In'></a> 422 423 --- 424 425 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, 426 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 427 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstIn'>kDstIn</a> replaces destination with: <code>[Da * Sa, Dc * Sa]</code>, 428 scaling destination <a href='SkColor_Reference#Alpha'>Alpha</a> by source <a href='SkColor_Reference#Alpha'>Alpha</a>. Resulting 429 destination is visible where source is visible. 430 431 ### Example 432 433 <div><fiddle-embed name="a5eeba05ccf6097a5d110a9d64f97c25"></fiddle-embed></div> 434 435 <a name='Src_Out'></a> 436 437 --- 438 439 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 440 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>; 441 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOut'>kSrcOut</a> replaces destination with: <code>[Sa * (1 - Da), Sc * (1 - Da)]</code>, 442 drawing source fully where destination <a href='SkColor_Reference#Alpha'>Alpha</a> is zero. Is destination 443 is opaque, has no effect. 444 445 ### Example 446 447 <div><fiddle-embed name="ccc1e74226e0c9eacbc21f1eed017b84"></fiddle-embed></div> 448 449 <a name='Dst_Out'></a> 450 451 --- 452 453 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, 454 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 455 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstOut'>kDstOut</a> replaces destination with: <code>[Da * (1 - Sa), Dc * (1 - Sa)]</code>, 456 scaling destination <a href='SkColor_Reference#Alpha'>Alpha</a> by source transparency. Resulting 457 destination is visible where source is transparent. If source is transparent, 458 has no effect. 459 460 ### Example 461 462 <div><fiddle-embed name="b9a894c9accfc5d94081bbd77d5d790a"></fiddle-embed></div> 463 464 <a name='Src_Atop'></a> 465 466 --- 467 468 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 469 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 470 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcATop'>kSrcATop</a> replaces destination with: <code>[Da, Sc * Da + Dc * (1 - Sa)]</code>, 471 replacing opaque destination with opaque source. If source or destination 472 is transparent, has no effect. 473 474 ### Example 475 476 <div><fiddle-embed name="a13148977bfc985934a92752c83a2041"></fiddle-embed></div> 477 478 <a name='Dst_Atop'></a> 479 480 --- 481 482 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 483 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 484 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstATop'>kDstATop</a> replaces destination with: <code>[Sa, Dc * Sa + Sc * (1 - Da)]</code>, 485 making destination transparent where source is transparent. 486 487 ### Example 488 489 <div><fiddle-embed name="1955856d45773a4fd914fcc1f813222f"></fiddle-embed></div> 490 491 <a name='Xor'></a> 492 493 --- 494 495 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 496 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 497 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kXor'>kXor</a> replaces destination with: 498 <code>[Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa)]</code>, 499 exchanging the transparency of the source and destination. 500 501 ### Example 502 503 <div><fiddle-embed name="29db2c7493d9098b8a086ddbe30dd6d6"></fiddle-embed></div> 504 505 <a name='Plus'></a> 506 507 --- 508 509 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 510 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 511 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kPlus'>kPlus</a> replaces destination with: <code>[Sa + Da, Sc + Dc]</code>, 512 summing the <a href='SkColor_Reference#Alpha'>Alpha</a> and <a href='SkColor_Reference#Color'>Color</a> components. 513 514 ### Example 515 516 <div><fiddle-embed name="05383441e510d54008402e128fc8ad2b"></fiddle-embed></div> 517 518 <a name='Modulate'></a> 519 520 --- 521 522 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 523 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 524 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a> replaces destination with: <code>[Sa * Da, Sc * Dc]</code>, 525 scaling <a href='SkColor_Reference#Alpha'>Alpha</a> and <a href='SkColor_Reference#Color'>Color</a> components by the lesser of the values. 526 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a> differs from <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> in two ways. 527 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a> like <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcATop'>kSrcATop</a> alters the destination inside 528 the destination area, as if the destination <a href='SkColor_Reference#Alpha'>Alpha</a> defined the boundaries of a 529 soft clip. <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> like <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a> can alter the 530 destination where the destination is transparent. 531 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a> computes the product of the source and destination using 532 <a href='undocumented#Premultiply'>Premultiplied</a> component values. <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> the product of the source 533 and destination using <a href='undocumented#Unpremultiply'>Unpremultiplied</a> component values. 534 535 ### Example 536 537 <div><fiddle-embed name="3fdac2b2f48bd227d2e74234c260bc8e"><div>If source and destination are opaque, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a> and 538 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> produce the same results. 539 </div></fiddle-embed></div> 540 541 <a name='Screen'></a> 542 543 --- 544 545 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 546 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 547 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kScreen'>kScreen</a> replaces destination with: <code>[Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]</code>. 548 549 ### Example 550 551 <div><fiddle-embed name="b7b42965927788d853f449f08ddf46de"></fiddle-embed></div> 552 553 <a name='Overlay'></a> 554 555 --- 556 557 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 558 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 559 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kOverlay'>kOverlay</a> replaces destination with: 560 <code>[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) + 561 (2 * Dc <= Da ? 2 * Sc * Dc : Sa * Da - 2 * (Da - Dc) * (Sa - Sc))]</code>. 562 563 ### Example 564 565 <div><fiddle-embed name="03bf042201de02d6d131938ccd3172eb"></fiddle-embed></div> 566 567 <a name='Darken'></a> 568 569 --- 570 571 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 572 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 573 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDarken'>kDarken</a> replaces destination with: 574 <code>[Sa + Da - Sa * Da, Sc + Dc - <a href='undocumented#max()'>max</a>(Sc * Da, Dc * Sa)]</code>. 575 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDarken'>kDarken</a> does not make an <a href='SkImage_Reference#Image'>image</a> darker; it replaces the destination 576 component with source if source is darker. 577 578 ### Example 579 580 <div><fiddle-embed name="23c974d2759f523ca2f4a78ae86855c3"></fiddle-embed></div> 581 582 <a name='Lighten'></a> 583 584 --- 585 586 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 587 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 588 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kLighten'>kLighten</a> replaces destination with: 589 <code>[Sa + Da - Sa * Da, Sc + Dc - <a href='undocumented#min()'>min</a>(Sc * Da, Dc * Sa)]</code>. 590 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDarken'>kDarken</a> does not make an <a href='SkImage_Reference#Image'>image</a> lighter; it replaces the destination 591 component with source if source is lighter. 592 593 ### Example 594 595 <div><fiddle-embed name="95cb08b8c8db3af3b2c9ad56ae7d6bc1"></fiddle-embed></div> 596 597 <a name='Color_Dodge'></a> 598 599 --- 600 601 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 602 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 603 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColorDodge'>kColorDodge</a> replaces destination with: 604 <code>[Sa + Da - Sa * Da, Dc == 0 ? Sc * (1 - Da) : Sc == Sa ? Sc + Da * (1 - Sa) : 605 Sa * <a href='undocumented#min()'>min</a>(Da, Dc * Sa / (Sa - Sc)) + Sc * (1 - Da) + Da * (1 - Sa)]</code>, 606 making destination brighter to reflect source. 607 608 ### Example 609 610 <div><fiddle-embed name="280ad6267a7d2d77b6d2c4531c6fc0bf"></fiddle-embed></div> 611 612 <a name='Color_Burn'></a> 613 614 --- 615 616 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 617 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 618 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColorBurn'>kColorBurn</a> replaces destination with: 619 <code>[Sa + Da - Sa * Da, Dc == Da ? Dc + Sc * (1 - Da) : Sc == 0 ? Da * (1 - Sa) : 620 Sa * (Da - <a href='undocumented#min()'>min</a>(Da, (Da - Dc) * Sa / Sc)) + Sc * (1 - Da) + Da * (1 - Sa)]</code>, 621 making destination darker to reflect source. 622 623 ### Example 624 625 <div><fiddle-embed name="3eeef529375d8083ae0d615789d55e89"></fiddle-embed></div> 626 627 <a name='Hard_Light'></a> 628 629 --- 630 631 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 632 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 633 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kHardLight'>kHardLight</a> replaces destination with: 634 <code>[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) + 635 2 * Sc <= Sa ? 2 * Sc * Dc : Sa * Da - 2 * (Da - Dc) * (Sa - Sc)]</code>, 636 making destination lighter or darker, depending on source. 637 638 ### Example 639 640 <div><fiddle-embed name="ac2fe555e2196e15863ea4ce74db3d54"></fiddle-embed></div> 641 642 <a name='Soft_Light'></a> 643 644 --- 645 646 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 647 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 648 where <code>m = Da > 0 ? Dc / Da : 0</code>; 649 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSoftLight'>kSoftLight</a> replaces destination with: <code>[Sa + Da - Sa * Da, Sc / Da + Dc / Sa + 650 (2 * Sc <= Sa ? Dc * (Sa + (2 * Sc - Sa) * (1 - m)) : Dc * Sa + Da * (2 * Sc - Sa) * 651 (4 * Dc <= Da ? (16 * m * m + 4 * m) * (m - 1) + 7 * m : <a href='undocumented#sqrt()'>sqrt</a>(m) - m))]</code>, 652 making destination lighter or darker, depending on source. 653 654 ### Example 655 656 <div><fiddle-embed name="ac93f30dff13f8a8bb31398de370863b"></fiddle-embed></div> 657 658 <a name='Difference'></a> 659 660 --- 661 662 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 663 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 664 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDifference'>kDifference</a> replaces destination with: 665 <code>[Sa + Da - Sa * Da, Sc + Dc - 2 * <a href='undocumented#min()'>min</a>(Sc * Da, Dc * Sa)]</code>, 666 replacing destination with lighter less darker. 667 668 ### Example 669 670 <div><fiddle-embed name="52d2c8d1b9b428de4477b4caa1543a3d"></fiddle-embed></div> 671 672 <a name='Exclusion'></a> 673 674 --- 675 676 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 677 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 678 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kExclusion'>kExclusion</a> replaces destination with: 679 <code>[Sa + Da - Sa * Da, Sc + Dc - 2 * Sc * Dc]</code>, 680 replacing destination with lighter less darker, ignoring <a href='SkColor_Reference#Alpha'>Alpha</a>. 681 682 ### Example 683 684 <div><fiddle-embed name="a544ee1c67c7c557a9e54d5e99f94bb6"></fiddle-embed></div> 685 686 <a name='Multiply'></a> 687 688 --- 689 690 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Sc</code> as source <a href='SkColor_Reference#Color'>Color</a> component, 691 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>Dc</code> as destination <a href='SkColor_Reference#Color'>Color</a> component; 692 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> replaces destination with: 693 <code>[Sa + Da - Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa) + Sc * Dc]</code>, 694 the product of <a href='undocumented#Unpremultiply'>Unpremultiplied</a> source and destination. 695 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a> makes the <a href='SkImage_Reference#Image'>image</a> darker. 696 697 ### Example 698 699 <div><fiddle-embed name="eb29c896f008dfbef09e16b85114fc3a"></fiddle-embed></div> 700 701 <a name='Hue'></a> 702 703 --- 704 705 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>S</code> as source <a href='SkColor_Reference#Color'>Color</a>, 706 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>D</code> as destination <a href='SkColor_Reference#Color'>Color</a>; 707 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kHue'>kHue</a> replaces destination with: 708 <code>[Sa + Da - Sa * Da, <a href='undocumented#SetLuminosity'>SetLuminosity</a>(<a href='undocumented#SetSaturation'>SetSaturation</a>(S, <a href='undocumented#Saturation'>Saturation</a>(D)), <a href='undocumented#Luminosity'>Luminosity</a>(D))]</code>, 709 source hue, leaving destination luminosity and saturation unchanged. 710 711 ### Example 712 713 <div><fiddle-embed name="41e45570d682397d3b8ff2f51bd9c574"></fiddle-embed></div> 714 715 <a name='Saturation'></a> 716 717 --- 718 719 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>S</code> as source <a href='SkColor_Reference#Color'>Color</a>, 720 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>D</code> as destination <a href='SkColor_Reference#Color'>Color</a>; 721 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kHue'>kHue</a> replaces destination with: 722 <code>[Sa + Da - Sa * Da, <a href='undocumented#SetLuminosity'>SetLuminosity</a>(<a href='undocumented#SetSaturation'>SetSaturation</a>(D, <a href='undocumented#Saturation'>Saturation</a>(S)), <a href='undocumented#Luminosity'>Luminosity</a>(D))]</code>, 723 source hue, leaving destination luminosity and saturation unchanged. 724 725 ### Example 726 727 <div><fiddle-embed name="a48698975d236573cef512f94a7e360b"></fiddle-embed></div> 728 729 <a name='Color'></a> 730 731 --- 732 733 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>S</code> as source <a href='SkColor_Reference#Color'>Color</a>, 734 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>D</code> as destination <a href='SkColor_Reference#Color'>Color</a>; 735 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColor'>kColor</a> replaces destination with: 736 <code>[Sa + Da - Sa * Da, <a href='undocumented#SetLuminosity'>SetLuminosity</a>(S, <a href='undocumented#Luminosity'>Luminosity</a>(D))]</code>, 737 source hue and saturation, leaving destination luminosity unchanged. 738 739 ### Example 740 741 <div><fiddle-embed name="5d7c6e23a34ca9bf3ba8cda4cdc94cc4"></fiddle-embed></div> 742 743 <a name='Luminosity'></a> 744 745 --- 746 747 Given: <code>Sa</code> as source <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>S</code> as source <a href='SkColor_Reference#Color'>Color</a>, 748 <code>Da</code> as destination <a href='SkColor_Reference#Alpha'>Alpha</a>, <code>D</code> as destination <a href='SkColor_Reference#Color'>Color</a>; 749 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kLuminosity'>kLuminosity</a> replaces destination with: 750 <code>[Sa + Da - Sa * Da, <a href='undocumented#SetLuminosity'>SetLuminosity</a>(D, <a href='undocumented#Luminosity'>Luminosity</a>(S))]</code>, 751 source luminosity, leaving destination hue and saturation unchanged. 752 753 ### Example 754 755 <div><fiddle-embed name="7d42fe34ae20dd9e12c39dc3950e9989"></fiddle-embed></div> 756 757 <a name='SkBlendMode_Name'></a> 758 759 --- 760 761 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 762 const char* <a href='SkBlendMode_Reference#SkBlendMode_Name'>SkBlendMode_Name</a>(<a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> blendMode) 763 </pre> 764 765 Returns name of <a href='#SkBlendMode_Name_blendMode'>blendMode</a> as null-terminated C <a href='undocumented#String'>string</a>. 766 767 ### Parameters 768 769 <table> <tr> <td><a name='SkBlendMode_Name_blendMode'><code><strong>blendMode</strong></code></a></td> 770 <td>one of:</td> 771 </tr> 772 </table> 773 774 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kClear'>kClear</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrc'>kSrc</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDst'>kDst</a>, 775 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOver'>kSrcOver</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstOver'>kDstOver</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcIn'>kSrcIn</a>, 776 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstIn'>kDstIn</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcOut'>kSrcOut</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstOut'>kDstOut</a>, 777 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSrcATop'>kSrcATop</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDstATop'>kDstATop</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kXor'>kXor</a>, 778 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kPlus'>kPlus</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kModulate'>kModulate</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kScreen'>kScreen</a>, 779 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kOverlay'>kOverlay</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDarken'>kDarken</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kLighten'>kLighten</a>, 780 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColorDodge'>kColorDodge</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColorBurn'>kColorBurn</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kHardLight'>kHardLight</a>, 781 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSoftLight'>kSoftLight</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kDifference'>kDifference</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kExclusion'>kExclusion</a>, 782 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kMultiply'>kMultiply</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kHue'>kHue</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kSaturation'>kSaturation</a>, 783 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kColor'>kColor</a>, <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a>::<a href='#SkBlendMode_kLuminosity'>kLuminosity</a> 784 785 ### Return Value 786 787 C <a href='undocumented#String'>string</a> 788 789 ### Example 790 791 <div><fiddle-embed name="3996f4994bf4e90b4cd86524c1f9f1a6"> 792 793 #### Example Output 794 795 ~~~~ 796 default blend: SkBlendMode::kSrcOver 797 ~~~~ 798 799 </fiddle-embed></div> 800 801 ### See Also 802 803 <a href='SkBlendMode_Reference#SkBlendMode'>SkBlendMode</a> 804 805