1SkColor Reference 2=== 3 4 5<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 6typedef uint8_t <a href='SkColor_Reference#SkAlpha'>SkAlpha</a>; 7typedef uint32_t <a href='SkColor_Reference#SkColor'>SkColor</a>; 8 9static constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b); 10#define <a href='SkColor_Reference#SkColorSetRGB'>SkColorSetRGB</a>(r, g, b) <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, r, g, b) 11#define <a href='SkColor_Reference#SkColorGetA'>SkColorGetA</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 24) & 0xFF) 12#define <a href='SkColor_Reference#SkColorGetR'>SkColorGetR</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 16) & 0xFF) 13#define <a href='SkColor_Reference#SkColorGetG'>SkColorGetG</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 8) & 0xFF) 14#define <a href='SkColor_Reference#SkColorGetB'>SkColorGetB</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 0) & 0xFF) 15 16static constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkColorSetA'>SkColorSetA</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c, <a href='undocumented#U8CPU'>U8CPU</a> a); 17constexpr <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> <a href='SkColor_Reference#SK_AlphaTRANSPARENT'>SK_AlphaTRANSPARENT</a> = 0x00; 18constexpr <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> <a href='SkColor_Reference#SK_AlphaOPAQUE'>SK_AlphaOPAQUE</a> = 0xFF; 19constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0x00, 0x00, 0x00, 0x00); 20constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorBLACK'>SK_ColorBLACK</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x00, 0x00, 0x00); 21constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorDKGRAY'>SK_ColorDKGRAY</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x44, 0x44, 0x44); 22constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorGRAY'>SK_ColorGRAY</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x88, 0x88, 0x88); 23constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorLTGRAY'>SK_ColorLTGRAY</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0xCC, 0xCC, 0xCC); 24constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorWHITE'>SK_ColorWHITE</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0xFF, 0xFF, 0xFF); 25constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorRED'>SK_ColorRED</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0xFF, 0x00, 0x00); 26constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorGREEN'>SK_ColorGREEN</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x00, 0xFF, 0x00); 27constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorBLUE'>SK_ColorBLUE</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x00, 0x00, 0xFF); 28constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorYELLOW'>SK_ColorYELLOW</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0xFF, 0xFF, 0x00); 29constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorCYAN'>SK_ColorCYAN</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0x00, 0xFF, 0xFF); 30constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorMAGENTA'>SK_ColorMAGENTA</a> = <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, 0xFF, 0x00, 0xFF); 31 32void <a href='SkColor_Reference#SkRGBToHSV'>SkRGBToHSV</a>(<a href='undocumented#U8CPU'>U8CPU</a> red, <a href='undocumented#U8CPU'>U8CPU</a> green, <a href='undocumented#U8CPU'>U8CPU</a> blue, <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]); 33 34static void <a href='SkColor_Reference#SkColorToHSV'>SkColorToHSV</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#Color'>color</a>, <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]); 35 36<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a>(<a href='undocumented#U8CPU'>U8CPU</a> <a href='SkColor_Reference#Alpha'>alpha</a>, const <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]); 37 38static <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a>(const <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]); 39typedef uint32_t <a href='SkColor_Reference#SkPMColor'>SkPMColor</a>; 40 41<a href='SkColor_Reference#SkPMColor'>SkPMColor</a> <a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b); 42 43<a href='SkColor_Reference#SkPMColor'>SkPMColor</a> <a href='SkColor_Reference#SkPreMultiplyColor'>SkPreMultiplyColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c); 44template <<a href='SkImageInfo_Reference#SkAlphaType'>SkAlphaType</a> kAT> 45struct <a href='SkColor4f_Reference#SkRGBA4f'>SkRGBA4f</a> { 46 // <i><a href='SkColor4f_Reference#SkRGBA4f'>SkRGBA4f</a> interface</i> 47}; 48template <> <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a> <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a>::<a href='SkColor4f_Reference#SkRGBA4f_FromColor'>FromColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a>); 49template <> <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor4f_Reference#SkColor4f'>SkColor4f</a>::<a href='SkColor4f_Reference#SkRGBA4f_toSkColor'>toSkColor</a>() const; 50</pre> 51 52<a href='SkColor_Reference#Color'>Color</a> constants can be helpful to write code, documenting the meaning of values 53the represent transparency and <a href='SkColor_Reference#Color'>color</a> values. The use of <a href='SkColor_Reference#Color'>Color</a> constants is not 54required. 55 56<a name='Functions'></a> 57 58<a name='Alpha'></a> 59 60<a href='SkColor_Reference#Alpha'>Alpha</a> represents the transparency of <a href='SkColor_Reference#Color'>Color</a>. <a href='SkColor_Reference#Color'>Color</a> with <a href='SkColor_Reference#Alpha'>Alpha</a> of zero is fully 61transparent. <a href='SkColor_Reference#Color'>Color</a> with <a href='SkColor_Reference#Alpha'>Alpha</a> of 255 is fully opaque. Some, but not all <a href='undocumented#Pixel'>pixel</a> 62formats contain <a href='SkColor_Reference#Alpha'>Alpha</a>. Pixels with <a href='SkColor_Reference#Alpha'>Alpha</a> may store it as unsigned integers or 63floating <a href='SkPoint_Reference#Point'>point</a> values. Unsigned integer <a href='SkColor_Reference#Alpha'>Alpha</a> ranges from zero, fully 64transparent, to all bits set, fully opaque. Floating <a href='SkPoint_Reference#Point'>point</a> <a href='SkColor_Reference#Alpha'>Alpha</a> ranges from 65zero, fully transparent, to one, fully opaque. 66 67<a name='SkAlpha'></a> 68 69--- 70 71<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 72typedef uint8_t <a href='SkColor_Reference#SkAlpha'>SkAlpha</a>; 73</pre> 74 758-bit type for an <a href='SkColor_Reference#Alpha'>alpha</a> value. 255 is 100% opaque, zero is 100% transparent. 76 77<a name='SkColor'></a> 78 79--- 80 81<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 82typedef uint32_t <a href='SkColor_Reference#SkColor'>SkColor</a>; 83</pre> 84 8532-bit ARGB <a href='SkColor_Reference#Color'>Color</a> value, <a href='undocumented#Unpremultiply'>Unpremultiplied</a>. <a href='SkColor_Reference#Color'>Color</a> components are always in 86a known order. This is different from <a href='SkColor_Reference#SkPMColor'>SkPMColor</a>, which has its bytes in a configuration 87dependent order, to match the format of <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a>. <a href='SkColor_Reference#SkColor'>SkColor</a> 88is the type used to specify colors in <a href='SkPaint_Reference#SkPaint'>SkPaint</a> and in gradients. 89 90<a href='SkColor_Reference#Color'>Color</a> that is <a href='undocumented#Premultiply'>Premultiplied</a> has the same component values as <a href='SkColor_Reference#Color'>Color</a> 91that is <a href='undocumented#Unpremultiply'>Unpremultiplied</a> if <a href='SkColor_Reference#Alpha'>Alpha</a> is 255, fully opaque, although may have the 92component values in a different order. 93 94### See Also 95 96<a href='SkColor_Reference#SkPMColor'>SkPMColor</a> 97 98<a name='SkColorSetARGB'></a> 99 100--- 101 102<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 103static constexpr inline <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b) 104</pre> 105 106Returns <a href='SkColor_Reference#Color'>Color</a> value from 8-bit component values. Asserts if SK_DEBUG is defined 107if <a href='#SkColorSetARGB_a'>a</a>, <a href='#SkColorSetARGB_r'>r</a>, <a href='#SkColorSetARGB_g'>g</a>, or <a href='#SkColorSetARGB_b'>b</a> exceed 255. Since <a href='SkColor_Reference#Color'>Color</a> is <a href='undocumented#Unpremultiply'>Unpremultiplied</a>, <a href='#SkColorSetARGB_a'>a</a> may be smaller 108than the largest of <a href='#SkColorSetARGB_r'>r</a>, <a href='#SkColorSetARGB_g'>g</a>, and <a href='#SkColorSetARGB_b'>b</a>. 109 110### Parameters 111 112<table> <tr> <td><a name='SkColorSetARGB_a'><code><strong>a</strong></code></a></td> 113 <td>amount of <a href='SkColor_Reference#Alpha'>Alpha</a>, from fully transparent (0) to fully opaque (255)</td> 114 </tr> 115 <tr> <td><a name='SkColorSetARGB_r'><code><strong>r</strong></code></a></td> 116 <td>amount of red, from no red (0) to full red (255)</td> 117 </tr> 118 <tr> <td><a name='SkColorSetARGB_g'><code><strong>g</strong></code></a></td> 119 <td>amount of green, from no green (0) to full green (255)</td> 120 </tr> 121 <tr> <td><a name='SkColorSetARGB_b'><code><strong>b</strong></code></a></td> 122 <td>amount of blue, from no blue (0) to full blue (255)</td> 123 </tr> 124</table> 125 126### Return Value 127 128<a href='SkColor_Reference#Color'>color</a> and <a href='SkColor_Reference#Alpha'>alpha</a>, <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 129 130### Example 131 132<div><fiddle-embed name="35888f0869e01a6e03b5b93bba563734"></fiddle-embed></div> 133 134### See Also 135 136<a href='SkColor_Reference#SkColorSetRGB'>SkColorSetRGB</a> <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_setARGB'>setARGB</a> <a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_setColor'>setColor</a> <a href='SkColor_Reference#SkColorSetA'>SkColorSetA</a> 137 138<a name='SkColorSetRGB'></a> 139 140--- 141 142<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 143#define <a href='SkColor_Reference#SkColorSetRGB'>SkColorSetRGB</a>(r, g, b) <a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a>(0xFF, r, g, b) 144r g b 145</pre> 146 147Returns <a href='SkColor_Reference#Color'>Color</a> value from 8-bit component values, with <a href='SkColor_Reference#Alpha'>Alpha</a> set 148fully opaque to 255. 149 150### Parameters 151 152<table> <tr> <td><a name='SkColorSetRGB_r'><code><strong>r</strong></code></a></td> 153 <td>amount of red, from no red (0) to full red (255)</td> 154 </tr> 155 <tr> <td><a name='SkColorSetRGB_g'><code><strong>g</strong></code></a></td> 156 <td>amount of green, from no green (0) to full green (255)</td> 157 </tr> 158 <tr> <td><a name='SkColorSetRGB_b'><code><strong>b</strong></code></a></td> 159 <td>amount of blue, from no blue (0) to full blue (255)</td> 160 </tr> 161</table> 162 163### Return Value 164 165<a href='SkColor_Reference#Color'>color</a> with opaque <a href='SkColor_Reference#Alpha'>alpha</a> 166 167### Example 168 169<div><fiddle-embed name="dad12dd912197cd5edd789ac0801bf8a"></fiddle-embed></div> 170 171### See Also 172 173<a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> 174 175<a name='SkColorGetA'></a> 176 177--- 178 179<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 180#define <a href='SkColor_Reference#SkColorGetA'>SkColorGetA</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 24) & 0xFF) 181<a href='SkColor_Reference#Color'>color</a> 182</pre> 183 184Returns <a href='SkColor_Reference#Alpha'>Alpha</a> byte from <a href='SkColor_Reference#Color'>Color</a> value. 185 186### Parameters 187 188<table> <tr> <td><a name='SkColorGetA_color'><code><strong>color</strong></code></a></td> 189 <td><a href='SkColor_Reference#SkColor'>SkColor</a>, a 32-bit unsigned int, in 0xAARRGGBB format</td> 190 </tr> 191</table> 192 193### Example 194 195<div><fiddle-embed name="896ce0316b489608a95af5439ca2aab1"></fiddle-embed></div> 196 197### See Also 198 199<a href='SkPaint_Reference#SkPaint'>SkPaint</a>::<a href='#SkPaint_getAlpha'>getAlpha</a> 200 201<a name='SkColorGetR'></a> 202 203--- 204 205<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 206#define <a href='SkColor_Reference#SkColorGetR'>SkColorGetR</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 16) & 0xFF) 207<a href='SkColor_Reference#Color'>color</a> 208</pre> 209 210Returns red component of <a href='SkColor_Reference#Color'>Color</a>, from zero to 255. 211 212### Parameters 213 214<table> <tr> <td><a name='SkColorGetR_color'><code><strong>color</strong></code></a></td> 215 <td><a href='SkColor_Reference#SkColor'>SkColor</a>, a 32-bit unsigned int, in 0xAARRGGBB format</td> 216 </tr> 217</table> 218 219### Return Value 220 221red byte 222 223### Example 224 225<div><fiddle-embed name="d6da38577f189eaa6d9df75f6c3ed252"></fiddle-embed></div> 226 227### See Also 228 229<a href='SkColor_Reference#SkColorGetG'>SkColorGetG</a> <a href='SkColor_Reference#SkColorGetB'>SkColorGetB</a> 230 231<a name='SkColorGetG'></a> 232 233--- 234 235<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 236#define <a href='SkColor_Reference#SkColorGetG'>SkColorGetG</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 8) & 0xFF) 237<a href='SkColor_Reference#Color'>color</a> 238</pre> 239 240Returns green component of <a href='SkColor_Reference#Color'>Color</a>, from zero to 255. 241 242### Parameters 243 244<table> <tr> <td><a name='SkColorGetG_color'><code><strong>color</strong></code></a></td> 245 <td><a href='SkColor_Reference#SkColor'>SkColor</a>, a 32-bit unsigned int, in 0xAARRGGBB format</td> 246 </tr> 247</table> 248 249### Return Value 250 251green byte 252 253### Example 254 255<div><fiddle-embed name="535d38b2c019299d915170f7b03d5fea"></fiddle-embed></div> 256 257### See Also 258 259<a href='SkColor_Reference#SkColorGetR'>SkColorGetR</a> <a href='SkColor_Reference#SkColorGetB'>SkColorGetB</a> 260 261<a name='SkColorGetB'></a> 262 263--- 264 265<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 266#define <a href='SkColor_Reference#SkColorGetB'>SkColorGetB</a>(<a href='SkColor_Reference#Color'>color</a>) (((<a href='SkColor_Reference#Color'>color</a>) >> 0) & 0xFF) 267<a href='SkColor_Reference#Color'>color</a> 268</pre> 269 270Returns blue component of <a href='SkColor_Reference#Color'>Color</a>, from zero to 255. 271 272### Parameters 273 274<table> <tr> <td><a name='SkColorGetB_color'><code><strong>color</strong></code></a></td> 275 <td><a href='SkColor_Reference#SkColor'>SkColor</a>, a 32-bit unsigned int, in 0xAARRGGBB format</td> 276 </tr> 277</table> 278 279### Return Value 280 281blue byte 282 283### Example 284 285<div><fiddle-embed name="9ee27675284faea375611dc88123a2c5"></fiddle-embed></div> 286 287### See Also 288 289<a href='SkColor_Reference#SkColorGetR'>SkColorGetR</a> <a href='SkColor_Reference#SkColorGetG'>SkColorGetG</a> 290 291<a name='SkColorSetA'></a> 292 293--- 294 295<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 296static constexpr inline <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkColorSetA'>SkColorSetA</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c, <a href='undocumented#U8CPU'>U8CPU</a> a) 297</pre> 298 299Returns <a href='undocumented#Unpremultiply'>Unpremultiplied</a> <a href='SkColor_Reference#Color'>Color</a> with red, blue, and green set from <a href='#SkColorSetA_c'>c</a>; and <a href='SkColor_Reference#Alpha'>alpha</a> set 300from <a href='#SkColorSetA_a'>a</a>. <a href='SkColor_Reference#Alpha'>Alpha</a> component of <a href='#SkColorSetA_c'>c</a> is ignored and is replaced by <a href='#SkColorSetA_a'>a</a> in result. 301 302### Parameters 303 304<table> <tr> <td><a name='SkColorSetA_c'><code><strong>c</strong></code></a></td> 305 <td>packed RGB, eight bits per component</td> 306 </tr> 307 <tr> <td><a name='SkColorSetA_a'><code><strong>a</strong></code></a></td> 308 <td><a href='SkColor_Reference#Alpha'>Alpha</a>: transparent at zero, fully opaque at 255</td> 309 </tr> 310</table> 311 312### Return Value 313 314<a href='SkColor_Reference#Color'>Color</a> with transparency 315 316### Example 317 318<div><fiddle-embed name="18f6f376f771f5ffa56d5e5b2ebd20fb"></fiddle-embed></div> 319 320### See Also 321 322<a href='SkColor_Reference#SkColorSetARGB'>SkColorSetARGB</a> 323 324<a name='Alpha_Constants'></a> 325 326--- 327 328<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 329constexpr <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> <a href='SkColor_Reference#SK_AlphaTRANSPARENT'>SK_AlphaTRANSPARENT</a> = 0x00; 330constexpr <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> <a href='SkColor_Reference#SK_AlphaOPAQUE'>SK_AlphaOPAQUE</a> = 0xFF; 331</pre> 332 333<a href='SkColor_Reference#Alpha'>Alpha</a> constants are conveniences to represent fully transparent and fully 334opaque colors and masks. Their use is not required. 335 336### Constants 337 338<table style='border-collapse: collapse; width: 62.5em'> 339 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 340<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 341<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 342 <tr style='background-color: #f0f0f0; '> 343 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_AlphaTRANSPARENT'><code>SK_AlphaTRANSPARENT</code></a></td> 344 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x00</td> 345 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 346Represents fully transparent <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> value. <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> ranges from zero, 347fully transparent; to 255, fully opaque. 348</td> 349 </tr> 350 <tr> 351 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_AlphaOPAQUE'><code>SK_AlphaOPAQUE</code></a></td> 352 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF</td> 353 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 354Represents fully opaque <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> value. <a href='SkColor_Reference#SkAlpha'>SkAlpha</a> ranges from zero, 355fully transparent; to 255, fully opaque. 356</td> 357 </tr> 358</table> 359 360### Example 361 362<div><fiddle-embed name="bc9c7ea424d10bbcd1e5a88770d4794e"><div><a href='SkColor_Reference#Color'>Color</a> the parts of the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> red if they mostly contain transparent pixels. 363</div></fiddle-embed></div> 364 365### Example 366 367<div><fiddle-embed name="0424f67ebc2858e8fd04ae3367b115ff"><div><a href='SkColor_Reference#Color'>Color</a> the parts of the <a href='SkBitmap_Reference#Bitmap'>bitmap</a> green if they contain fully opaque pixels. 368</div></fiddle-embed></div> 369 370### See Also 371 372<a href='SkColor_Reference#SkAlpha'>SkAlpha</a> <a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a> <a href='SkColor_Reference#SK_ColorBLACK'>SK_ColorBLACK</a> 373 374<a name='Color_Constants'></a> 375 376--- 377 378<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 379constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a>; 380constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorBLACK'>SK_ColorBLACK</a>; 381constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorDKGRAY'>SK_ColorDKGRAY</a>; 382constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorGRAY'>SK_ColorGRAY</a>; 383constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorLTGRAY'>SK_ColorLTGRAY</a>; 384constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorWHITE'>SK_ColorWHITE</a>; 385constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorRED'>SK_ColorRED</a>; 386constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorGREEN'>SK_ColorGREEN</a>; 387constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorBLUE'>SK_ColorBLUE</a>; 388constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorYELLOW'>SK_ColorYELLOW</a>; 389constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorCYAN'>SK_ColorCYAN</a>; 390constexpr <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SK_ColorMAGENTA'>SK_ColorMAGENTA</a>; 391</pre> 392 393<a href='SkColor_Reference#Color'>Color</a> names are provided as conveniences, but are not otherwise special. 394The values chosen for names may not be the same as values used by 395<a href='undocumented#SVG'>SVG</a>, HTML, CSS, or colors named by a platform. 396 397### Constants 398 399<table style='border-collapse: collapse; width: 62.5em'> 400 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 401<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 402<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 403 <tr style='background-color: #f0f0f0; '> 404 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorTRANSPARENT'><code>SK_ColorTRANSPARENT</code></a></td> 405 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0x00000000</td> 406 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 407Represents fully transparent <a href='SkColor_Reference#SkColor'>SkColor</a>. May be used to initialize a destination 408containing a mask or a non-rectangular <a href='SkImage_Reference#Image'>image</a>. 409</td> 410 </tr> 411 <tr> 412 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorBLACK'><code>SK_ColorBLACK</code></a></td> 413 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF000000</td> 414 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 415Represents fully opaque black. 416</td> 417 </tr> 418 <tr style='background-color: #f0f0f0; '> 419 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorDKGRAY'><code>SK_ColorDKGRAY</code></a></td> 420 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF444444</td> 421 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 422Represents fully opaque dark gray. 423Note that <a href='#SVG_darkgray'>SVG_darkgray</a> is equivalent to 0xFFA9A9A9. 424</td> 425 </tr> 426 <tr> 427 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorGRAY'><code>SK_ColorGRAY</code></a></td> 428 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF888888</td> 429 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 430Represents fully opaque gray. 431Note that <a href='#HTML_Gray'>HTML_Gray</a> is equivalent to 0xFF808080. 432</td> 433 </tr> 434 <tr style='background-color: #f0f0f0; '> 435 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorLTGRAY'><code>SK_ColorLTGRAY</code></a></td> 436 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFCCCCCC</td> 437 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 438Represents fully opaque light gray. <a href='#HTML_Silver'>HTML_Silver</a> is equivalent to 0xFFC0C0C0. 439Note that <a href='#SVG_lightgray'>SVG_lightgray</a> is equivalent to 0xFFD3D3D3. 440</td> 441 </tr> 442 <tr> 443 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorWHITE'><code>SK_ColorWHITE</code></a></td> 444 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFFFFFFF</td> 445 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 446Represents fully opaque white. 447</td> 448 </tr> 449 <tr style='background-color: #f0f0f0; '> 450 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorRED'><code>SK_ColorRED</code></a></td> 451 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFFF0000</td> 452 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 453Represents fully opaque red. 454</td> 455 </tr> 456 <tr> 457 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorGREEN'><code>SK_ColorGREEN</code></a></td> 458 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF00FF00</td> 459 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 460Represents fully opaque green. <a href='#HTML_Lime'>HTML_Lime</a> is equivalent. 461Note that <a href='#HTML_Green'>HTML_Green</a> is equivalent to 0xFF008000. 462</td> 463 </tr> 464 <tr style='background-color: #f0f0f0; '> 465 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorBLUE'><code>SK_ColorBLUE</code></a></td> 466 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF0000FF</td> 467 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 468Represents fully opaque blue. 469</td> 470 </tr> 471 <tr> 472 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorYELLOW'><code>SK_ColorYELLOW</code></a></td> 473 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFFFFF00</td> 474 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 475Represents fully opaque yellow. 476</td> 477 </tr> 478 <tr style='background-color: #f0f0f0; '> 479 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorCYAN'><code>SK_ColorCYAN</code></a></td> 480 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFF00FFFF</td> 481 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 482Represents fully opaque cyan. <a href='#HTML_Aqua'>HTML_Aqua</a> is equivalent. 483</td> 484 </tr> 485 <tr> 486 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SK_ColorMAGENTA'><code>SK_ColorMAGENTA</code></a></td> 487 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0xFFFF00FF</td> 488 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 489Represents fully opaque magenta. <a href='#HTML_Fuchsia'>HTML_Fuchsia</a> is equivalent. 490</td> 491 </tr> 492</table> 493 494### Example 495 496<div><fiddle-embed name="1c2e38321464818847f953ddd45cb5a1"></fiddle-embed></div> 497 498### Example 499 500<div><fiddle-embed name="9ca1e2a5b9b4c92ecf4409d0813867d6"><div><a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a> sets <a href='SkColor_Reference#Color'>Color</a> <a href='SkColor_Reference#Alpha'>Alpha</a> and components to zero. 501</div></fiddle-embed></div> 502 503### Example 504 505<div><fiddle-embed name="6971489f28291f08e429cc6ccc73b09b"><div><a href='SkColor_Reference#SK_ColorBLACK'>SK_ColorBLACK</a> sets <a href='SkColor_Reference#Color'>Color</a> <a href='SkColor_Reference#Alpha'>Alpha</a> to one and components to zero. 506</div></fiddle-embed></div> 507 508### Example 509 510<div><fiddle-embed name="fce650f997e802d4e55edf62b8437a2d"><div><a href='SkColor_Reference#SK_ColorWHITE'>SK_ColorWHITE</a> sets <a href='SkColor_Reference#Color'>Color</a> <a href='SkColor_Reference#Alpha'>Alpha</a> and components to one. 511</div></fiddle-embed></div> 512 513### See Also 514 515<a href='SkColor_Reference#SK_ColorTRANSPARENT'>SK_ColorTRANSPARENT</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_clear'>clear</a> <a href='SkColor_Reference#SK_AlphaOPAQUE'>SK_AlphaOPAQUE</a> 516 517<a name='HSV'></a> 518 519<a name='HSV_Hue'></a> 520 521Hue represents an angle, in degrees, on a <a href='SkColor_Reference#Color'>color</a> wheel. Hue has a positive value 522modulo 360, where zero degrees is red. 523 524<a name='HSV_Saturation'></a> 525 526<a href='undocumented#Saturation'>Saturation</a> represents the intensity of the <a href='SkColor_Reference#Color'>color</a>. <a href='undocumented#Saturation'>Saturation</a> varies from zero, 527with no Hue contribution; to one, with full Hue contribution. 528 529<a name='HSV_Value'></a> 530 531Value represents the lightness of the <a href='SkColor_Reference#Color'>color</a>. Value varies from zero, black; to 532one, full brightness. 533 534<a name='SkRGBToHSV'></a> 535 536--- 537 538<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 539void <a href='SkColor_Reference#SkRGBToHSV'>SkRGBToHSV</a>(<a href='undocumented#U8CPU'>U8CPU</a> red, <a href='undocumented#U8CPU'>U8CPU</a> green, <a href='undocumented#U8CPU'>U8CPU</a> blue, <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]) 540</pre> 541 542Converts RGB to its HSV components. 543<a href='#SkRGBToHSV_hsv'>hsv</a>[0] contains <a href='#Color_HSV_Hue'>HSV_Hue</a>, a value from zero to less than 360. 544<a href='#SkRGBToHSV_hsv'>hsv</a>[1] contains <a href='#Color_HSV_Saturation'>HSV_Saturation</a>, a value from zero to one. 545<a href='#SkRGBToHSV_hsv'>hsv</a>[2] contains <a href='#Color_HSV_Value'>HSV_Value</a>, a value from zero to one. 546 547### Parameters 548 549<table> <tr> <td><a name='SkRGBToHSV_red'><code><strong>red</strong></code></a></td> 550 <td><a href='#SkRGBToHSV_red'>red</a> component value from zero to 255</td> 551 </tr> 552 <tr> <td><a name='SkRGBToHSV_green'><code><strong>green</strong></code></a></td> 553 <td><a href='#SkRGBToHSV_green'>green</a> component value from zero to 255</td> 554 </tr> 555 <tr> <td><a name='SkRGBToHSV_blue'><code><strong>blue</strong></code></a></td> 556 <td><a href='#SkRGBToHSV_blue'>blue</a> component value from zero to 255</td> 557 </tr> 558 <tr> <td><a name='SkRGBToHSV_hsv'><code><strong>hsv</strong></code></a></td> 559 <td>three element array which holds the resulting HSV components 560</td> 561 </tr> 562</table> 563 564### Example 565 566<div><fiddle-embed name="4fb2da4a3d9b14ca4ac24eefb0f5126a"></fiddle-embed></div> 567 568### See Also 569 570<a href='SkColor_Reference#SkColorToHSV'>SkColorToHSV</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a> 571 572<a name='SkColorToHSV'></a> 573 574--- 575 576<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 577static void <a href='SkColor_Reference#SkColorToHSV'>SkColorToHSV</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#Color'>color</a>, <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]) 578</pre> 579 580Converts ARGB to its HSV components. <a href='SkColor_Reference#Alpha'>Alpha</a> in ARGB is ignored. 581<a href='#SkColorToHSV_hsv'>hsv</a>[0] contains <a href='#Color_HSV_Hue'>HSV_Hue</a>, and is assigned a value from zero to less than 360. 582<a href='#SkColorToHSV_hsv'>hsv</a>[1] contains <a href='#Color_HSV_Saturation'>HSV_Saturation</a>, a value from zero to one. 583<a href='#SkColorToHSV_hsv'>hsv</a>[2] contains <a href='#Color_HSV_Value'>HSV_Value</a>, a value from zero to one. 584 585### Parameters 586 587<table> <tr> <td><a name='SkColorToHSV_color'><code><strong>color</strong></code></a></td> 588 <td>ARGB <a href='#SkColorToHSV_color'>color</a> to convert 589</td> 590 </tr> 591 <tr> <td><a name='SkColorToHSV_hsv'><code><strong>hsv</strong></code></a></td> 592 <td>three element array which holds the resulting HSV components 593</td> 594 </tr> 595</table> 596 597### Example 598 599<div><fiddle-embed name="1e0370f12c8aab5b84f9e824074f1e5a"></fiddle-embed></div> 600 601### See Also 602 603<a href='SkColor_Reference#SkRGBToHSV'>SkRGBToHSV</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a> 604 605<a name='SkHSVToColor'></a> 606 607--- 608 609<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 610<a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a>(<a href='undocumented#U8CPU'>U8CPU</a> <a href='SkColor_Reference#Alpha'>alpha</a>, const <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]) 611</pre> 612 613Converts HSV components to an ARGB <a href='SkColor_Reference#Color'>color</a>. <a href='SkColor_Reference#Alpha'>Alpha</a> is passed through unchanged. 614<a href='#SkHSVToColor_hsv'>hsv</a>[0] represents <a href='#Color_HSV_Hue'>HSV_Hue</a>, an angle from zero to less than 360. 615<a href='#SkHSVToColor_hsv'>hsv</a>[1] represents <a href='#Color_HSV_Saturation'>HSV_Saturation</a>, and varies from zero to one. 616<a href='#SkHSVToColor_hsv'>hsv</a>[2] represents <a href='#Color_HSV_Value'>HSV_Value</a>, and varies from zero to one. 617 618Out of range <a href='#SkHSVToColor_hsv'>hsv</a> values are pinned. 619 620### Parameters 621 622<table> <tr> <td><a name='SkHSVToColor_alpha'><code><strong>alpha</strong></code></a></td> 623 <td><a href='SkColor_Reference#Alpha'>Alpha</a> component of the returned ARGB <a href='SkColor_Reference#Color'>color </a> 624</td> 625 </tr> 626 <tr> <td><a name='SkHSVToColor_hsv'><code><strong>hsv</strong></code></a></td> 627 <td>three element array which holds the input HSV components 628</td> 629 </tr> 630</table> 631 632### Return Value 633 634ARGB equivalent to HSV 635 636### Example 637 638<div><fiddle-embed name="311a59931ac340b90f202cd6ac399a0a"></fiddle-embed></div> 639 640### See Also 641 642<a href='SkColor_Reference#SkColorToHSV'>SkColorToHSV</a> <a href='SkColor_Reference#SkRGBToHSV'>SkRGBToHSV</a> 643 644<a name='SkHSVToColor_2'></a> 645 646--- 647 648<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 649static <a href='SkColor_Reference#SkColor'>SkColor</a> <a href='SkColor_Reference#SkHSVToColor'>SkHSVToColor</a>(const <a href='undocumented#SkScalar'>SkScalar</a> hsv[3]) 650</pre> 651 652Converts HSV components to an ARGB <a href='SkColor_Reference#Color'>color</a>. <a href='SkColor_Reference#Alpha'>Alpha</a> is set to 255. 653<a href='#SkHSVToColor_2_hsv'>hsv</a>[0] represents <a href='#Color_HSV_Hue'>HSV_Hue</a>, an angle from zero to less than 360. 654<a href='#SkHSVToColor_2_hsv'>hsv</a>[1] represents <a href='#Color_HSV_Saturation'>HSV_Saturation</a>, and varies from zero to one. 655<a href='#SkHSVToColor_2_hsv'>hsv</a>[2] represents <a href='#Color_HSV_Value'>HSV_Value</a>, and varies from zero to one. 656 657Out of range <a href='#SkHSVToColor_2_hsv'>hsv</a> values are pinned. 658 659### Parameters 660 661<table> <tr> <td><a name='SkHSVToColor_2_hsv'><code><strong>hsv</strong></code></a></td> 662 <td>three element array which holds the input HSV components 663</td> 664 </tr> 665</table> 666 667### Return Value 668 669RGB equivalent to HSV 670 671### Example 672 673<div><fiddle-embed name="d355a17547908cdbc2c38720974b5d11"></fiddle-embed></div> 674 675### See Also 676 677<a href='SkColor_Reference#SkColorToHSV'>SkColorToHSV</a> <a href='SkColor_Reference#SkRGBToHSV'>SkRGBToHSV</a> 678 679<a name='PM_Color'></a> 680 681<a name='SkPMColor'></a> 682 683--- 684 685<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 686typedef uint32_t <a href='SkColor_Reference#SkPMColor'>SkPMColor</a>; 687</pre> 688 68932-bit ARGB <a href='SkColor_Reference#Color'>color</a> value, <a href='undocumented#Premultiply'>Premultiplied</a>. The byte order for this value is 690configuration dependent, matching the format of <a href='SkImageInfo_Reference#kBGRA_8888_SkColorType'>kBGRA_8888_SkColorType</a> <a href='SkBitmap_Reference#Bitmap'>bitmaps</a>. 691This is different from <a href='SkColor_Reference#SkColor'>SkColor</a>, which is <a href='undocumented#Unpremultiply'>Unpremultiplied</a>, and is always in the 692same byte order. 693 694<a name='SkPreMultiplyARGB'></a> 695 696--- 697 698<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 699<a href='SkColor_Reference#SkPMColor'>SkPMColor</a> <a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a>(<a href='undocumented#U8CPU'>U8CPU</a> a, <a href='undocumented#U8CPU'>U8CPU</a> r, <a href='undocumented#U8CPU'>U8CPU</a> g, <a href='undocumented#U8CPU'>U8CPU</a> b) 700</pre> 701 702Returns <a href='#SkPreMultiplyARGB_a'>a</a> <a href='SkColor_Reference#SkPMColor'>SkPMColor</a> value from <a href='undocumented#Unpremultiply'>Unpremultiplied</a> 8-bit component values. 703 704### Parameters 705 706<table> <tr> <td><a name='SkPreMultiplyARGB_a'><code><strong>a</strong></code></a></td> 707 <td>amount of <a href='SkColor_Reference#Alpha'>Alpha</a>, from fully transparent (0) to fully opaque (255)</td> 708 </tr> 709 <tr> <td><a name='SkPreMultiplyARGB_r'><code><strong>r</strong></code></a></td> 710 <td>amount of red, from no red (0) to full red (255)</td> 711 </tr> 712 <tr> <td><a name='SkPreMultiplyARGB_g'><code><strong>g</strong></code></a></td> 713 <td>amount of green, from no green (0) to full green (255)</td> 714 </tr> 715 <tr> <td><a name='SkPreMultiplyARGB_b'><code><strong>b</strong></code></a></td> 716 <td>amount of blue, from no blue (0) to full blue (255)</td> 717 </tr> 718</table> 719 720### Return Value 721 722<a href='undocumented#Premultiply'>Premultiplied</a> <a href='SkColor_Reference#Color'>Color</a> 723 724### Example 725 726<div><fiddle-embed name="756345484fd48ca0ea7b6cec350f73b8"></fiddle-embed></div> 727 728### See Also 729 730<a href='SkColor_Reference#SkPreMultiplyColor'>SkPreMultiplyColor</a> 731 732<a name='SkPreMultiplyColor'></a> 733 734--- 735 736<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 737<a href='SkColor_Reference#SkPMColor'>SkPMColor</a> <a href='SkColor_Reference#SkPreMultiplyColor'>SkPreMultiplyColor</a>(<a href='SkColor_Reference#SkColor'>SkColor</a> c) 738</pre> 739 740Returns <a href='#Color_PM_Color'>PM_Color</a> closest to <a href='SkColor_Reference#Color'>Color</a> <a href='#SkPreMultiplyColor_c'>c</a>. Multiplies <a href='#SkPreMultiplyColor_c'>c</a> RGB components by the <a href='#SkPreMultiplyColor_c'>c</a> <a href='SkColor_Reference#Alpha'>Alpha</a>, 741and arranges the bytes to match the format of <a href='SkImageInfo_Reference#kN32_SkColorType'>kN32_SkColorType</a>. 742 743### Parameters 744 745<table> <tr> <td><a name='SkPreMultiplyColor_c'><code><strong>c</strong></code></a></td> 746 <td><a href='undocumented#Unpremultiply'>Unpremultiplied</a> ARGB <a href='SkColor_Reference#Color'>Color</a></td> 747 </tr> 748</table> 749 750### Return Value 751 752<a href='undocumented#Premultiply'>Premultiplied</a> <a href='SkColor_Reference#Color'>Color</a> 753 754### Example 755 756<div><fiddle-embed name="0bcc0f86a2aefc899f3500503dce6968"></fiddle-embed></div> 757 758### See Also 759 760<a href='SkColor_Reference#SkPreMultiplyARGB'>SkPreMultiplyARGB</a> 761 762