Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 1 | #Topic Color |
| 2 | #Alias Color_Reference |
| 3 | |
| 4 | #Subtopic Overview |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 5 | #Populate |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 6 | ## |
| 7 | |
| 8 | #Subtopic Define |
| 9 | #Populate |
| 10 | ## |
| 11 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 12 | Color constants can be helpful to write code, documenting the meaning of values |
| 13 | the represent transparency and color values. The use of Color constants is not |
| 14 | required. |
| 15 | |
| 16 | #Subtopic Constant |
| 17 | #Populate |
| 18 | ## |
| 19 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 20 | #Subtopic Function |
| 21 | #Populate |
| 22 | ## |
| 23 | |
| 24 | #Subtopic Typedef |
| 25 | #Populate |
| 26 | ## |
| 27 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 28 | |
| 29 | #Subtopic RGB |
| 30 | #Substitute RGB |
| 31 | #Subtopic Red |
| 32 | #Alias Red |
| 33 | #Subtopic ## |
| 34 | #Subtopic Blue |
| 35 | #Alias Blue |
| 36 | #Subtopic ## |
| 37 | #Subtopic Green |
| 38 | #Alias Green |
| 39 | #Subtopic ## |
| 40 | #Subtopic ## |
| 41 | |
| 42 | #Subtopic ARGB |
| 43 | #Substitute ARGB |
| 44 | #Subtopic ## |
| 45 | |
| 46 | #Subtopic RBG |
| 47 | #Substitute RBG |
| 48 | #Subtopic ## |
| 49 | |
| 50 | #Subtopic RGB-565 |
| 51 | #Substitute RGB-565 |
| 52 | #Alias Color_RGB-565 # quit changing - to _ ! |
| 53 | #Subtopic ## |
| 54 | |
| 55 | #Subtopic Gray |
| 56 | ## |
| 57 | |
| 58 | # ------------------------------------------------------------------------------ |
| 59 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 60 | #Subtopic Alpha |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 61 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 62 | Alpha represents the transparency of Color. Color with Alpha of zero is fully |
| 63 | transparent. Color with Alpha of 255 is fully opaque. Some, but not all pixel |
| 64 | formats contain Alpha. Pixels with Alpha may store it as unsigned integers or |
| 65 | floating point values. Unsigned integer Alpha ranges from zero, fully |
| 66 | transparent, to all bits set, fully opaque. Floating point Alpha ranges from |
| 67 | zero, fully transparent, to one, fully opaque. |
| 68 | |
| 69 | #Alias Alpha |
| 70 | |
| 71 | #Typedef uint8_t SkAlpha |
| 72 | #Line # defines Alpha as eight bits ## |
| 73 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 74 | 8-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent. |
| 75 | |
| 76 | #Typedef ## |
| 77 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 78 | #Subtopic ## |
| 79 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 80 | # ------------------------------------------------------------------------------ |
| 81 | |
| 82 | #Typedef uint32_t SkColor |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 83 | #Line # defines Color as 32 bits ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 84 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 85 | 32-bit ARGB Color value, Unpremultiplied. Color components are always in |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 86 | a known order. This is different from SkPMColor, which has its bytes in a configuration |
| 87 | dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor |
| 88 | is the type used to specify colors in SkPaint and in gradients. |
| 89 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 90 | Color that is Premultiplied has the same component values as Color |
| 91 | that is Unpremultiplied if Alpha is 255, fully opaque, although may have the |
| 92 | component values in a different order. |
| 93 | |
| 94 | #SeeAlso SkPMColor |
| 95 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 96 | #Typedef ## |
| 97 | |
| 98 | # ------------------------------------------------------------------------------ |
| 99 | |
| 100 | #Method static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) |
| 101 | #In Function |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 102 | #Line # returns Color_Alpha and Color_RGB combined ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 103 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 104 | Returns Color value from 8-bit component values. Asserts if SK_DEBUG is defined |
| 105 | if a, r, g, or b exceed 255. Since Color is Unpremultiplied, a may be smaller |
| 106 | than the largest of r, g, and b. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 107 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 108 | #Param a amount of Alpha, from fully transparent (0) to fully opaque (255) ## |
| 109 | #Param r amount of RGB_Red, from no red (0) to full red (255) ## |
| 110 | #Param g amount of RGB_Green, from no green (0) to full green (255) ## |
| 111 | #Param b amount of RGB_Blue, from no blue (0) to full blue (255) ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 112 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 113 | #Return color and alpha, Unpremultiplied ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 114 | |
| 115 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 116 | canvas->drawColor(SK_ColorRED); |
| 117 | canvas->clipRect(SkRect::MakeWH(150, 150)); |
| 118 | canvas->drawColor(SkColorSetARGB(0x80, 0x00, 0xFF, 0x00)); |
| 119 | canvas->clipRect(SkRect::MakeWH(75, 75)); |
| 120 | canvas->drawColor(SkColorSetARGB(0x80, 0x00, 0x00, 0xFF)); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 121 | ## |
| 122 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 123 | #SeeAlso SkColorSetRGB SkPaint::setARGB SkPaint::setColor |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 124 | |
| 125 | #Method ## |
| 126 | |
| 127 | # ------------------------------------------------------------------------------ |
| 128 | |
| 129 | #Define SkColorSetARGBInline |
| 130 | |
| 131 | #Code |
| 132 | ###$ |
| 133 | #define SkColorSetARGBInline SkColorSetARGB |
| 134 | $$$# |
| 135 | ## |
| 136 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 137 | #Deprecated soon |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 138 | |
| 139 | #Define ## |
| 140 | |
| 141 | # ------------------------------------------------------------------------------ |
| 142 | |
| 143 | #Define SkColorSetARGBMacro |
| 144 | |
| 145 | #Code |
| 146 | ###$ |
| 147 | #define SkColorSetARGBMacro SkColorSetARGB |
| 148 | $$$# |
| 149 | ## |
| 150 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 151 | #Deprecated soon |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 152 | |
| 153 | #Define ## |
| 154 | |
| 155 | # ------------------------------------------------------------------------------ |
| 156 | |
| 157 | #Define SkColorSetRGB |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 158 | #Line # returns opaque Color ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 159 | |
| 160 | #Code |
| 161 | ###$ |
| 162 | #define SkColorSetRGB(r, g, b) SkColorSetARGB(0xFF, r, g, b) |
| 163 | $$$# |
| 164 | ## |
| 165 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 166 | Returns Color value from 8-bit component values, with Alpha set |
| 167 | fully opaque to 255. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 168 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 169 | #Param r amount of RGB_Red, from no red (0) to full red (255) ## |
| 170 | #Param g amount of RGB_Green, from no green (0) to full green (255) ## |
| 171 | #Param b amount of RGB_Blue, from no blue (0) to full blue (255) ## |
| 172 | |
| 173 | #Return color with opaque alpha ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 174 | |
| 175 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 176 | canvas->drawColor(SK_ColorRED); |
| 177 | canvas->clipRect(SkRect::MakeWH(150, 150)); |
| 178 | canvas->drawColor(SkColorSetRGB(0x00, 0xFF, 0x00)); |
| 179 | canvas->clipRect(SkRect::MakeWH(75, 75)); |
| 180 | canvas->drawColor(SkColorSetRGB(0x00, 0x00, 0xFF)); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 181 | ## |
| 182 | |
| 183 | #SeeAlso incomplete |
| 184 | |
| 185 | #Define ## |
| 186 | |
| 187 | # ------------------------------------------------------------------------------ |
| 188 | |
| 189 | #Define SkColorGetA |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 190 | #Line # returns Alpha component ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 191 | |
| 192 | #Code |
| 193 | ###$ |
| 194 | #define SkColorGetA(color) (((color) >> 24) & 0xFF) |
| 195 | $$$# |
| 196 | ## |
| 197 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 198 | Returns Alpha byte from Color value. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 199 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 200 | #Param color SkColor, a 32-bit unsigned int, in 0xAARRGGBB format ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 201 | |
| 202 | #Example |
| 203 | // incomplete |
| 204 | ## |
| 205 | |
| 206 | #SeeAlso incomplete |
| 207 | |
| 208 | #Define ## |
| 209 | |
| 210 | # ------------------------------------------------------------------------------ |
| 211 | |
| 212 | #Define SkColorGetR |
| 213 | #Line # incomplete ## |
| 214 | |
| 215 | #Code |
| 216 | ###$ |
| 217 | #define SkColorGetR(color) (((color) >> 16) & 0xFF) |
| 218 | $$$# |
| 219 | ## |
| 220 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 221 | Returns red component of Color, from zero to 255. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 222 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 223 | #Param color SkColor, a 32-bit unsigned int, in 0xAARRGGBB format ## |
| 224 | #Return red byte ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 225 | |
| 226 | #Example |
| 227 | // incomplete |
| 228 | ## |
| 229 | |
| 230 | #SeeAlso incomplete |
| 231 | |
| 232 | #Define ## |
| 233 | |
| 234 | # ------------------------------------------------------------------------------ |
| 235 | |
| 236 | #Define SkColorGetG |
| 237 | #Line # incomplete ## |
| 238 | |
| 239 | #Code |
| 240 | ###$ |
| 241 | #define SkColorGetG(color) (((color) >> 8) & 0xFF) |
| 242 | $$$# |
| 243 | ## |
| 244 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 245 | Returns green component of Color, from zero to 255. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 246 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 247 | #Param color SkColor, a 32-bit unsigned int, in 0xAARRGGBB format ## |
| 248 | #Return green byte ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 249 | |
| 250 | #Example |
| 251 | // incomplete |
| 252 | ## |
| 253 | |
| 254 | #SeeAlso incomplete |
| 255 | |
| 256 | #Define ## |
| 257 | |
| 258 | # ------------------------------------------------------------------------------ |
| 259 | |
| 260 | #Define SkColorGetB |
| 261 | #Line # incomplete ## |
| 262 | |
| 263 | #Code |
| 264 | ###$ |
| 265 | #define SkColorGetB(color) (((color) >> 0) & 0xFF) |
| 266 | $$$# |
| 267 | ## |
| 268 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 269 | Returns blue component of Color, from zero to 255. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 270 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 271 | #Param color SkColor, a 32-bit unsigned int, in 0xAARRGGBB format ## |
| 272 | #Return blue byte ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 273 | |
| 274 | #Example |
| 275 | // incomplete |
| 276 | ## |
| 277 | |
| 278 | #SeeAlso incomplete |
| 279 | |
| 280 | #Define ## |
| 281 | |
| 282 | # ------------------------------------------------------------------------------ |
| 283 | |
| 284 | #Method static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a) |
| 285 | #In Function |
| 286 | #Line # incomplete ## |
| 287 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 288 | Returns Color with red, blue, and green set from c; and alpha set from a. |
| 289 | |
| 290 | #Param c Unpremultiplied Color_ARGB ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 291 | #Param a incomplete ## |
| 292 | |
| 293 | #Return incomplete ## |
| 294 | |
| 295 | #Example |
| 296 | // incomplete |
| 297 | ## |
| 298 | |
| 299 | #SeeAlso incomplete |
| 300 | |
| 301 | #Method ## |
| 302 | |
| 303 | # ------------------------------------------------------------------------------ |
| 304 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 305 | #Subtopic Alpha_Constants |
| 306 | #In Constant |
| 307 | #Line # constants for Alpha ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 308 | |
| 309 | #Code |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 310 | constexpr SkAlpha SK_AlphaTRANSPARENT = 0x00; |
| 311 | constexpr SkAlpha SK_AlphaOPAQUE = 0xFF; |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 312 | ## |
| 313 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 314 | Alpha constants are conveniences to represent fully transparent and fully |
| 315 | opaque colors and masks. Their use is not required. |
| 316 | |
| 317 | #Const SK_AlphaTRANSPARENT 0x00 |
| 318 | #Line # fully transparent SkAlpha ## |
| 319 | #Details Transparent |
| 320 | Represents fully transparent SkAlpha value. SkAlpha ranges from zero, |
| 321 | fully transparent; to 255, fully opaque. |
| 322 | ## |
| 323 | #Const SK_AlphaOPAQUE 0xFF |
| 324 | #Line # fully opaque SkAlpha ## |
| 325 | #Details Opaque |
| 326 | Represents fully opaque SkAlpha value. SkAlpha ranges from zero, |
| 327 | fully transparent; to 255, fully opaque. |
| 328 | ## |
| 329 | |
| 330 | #Subtopic Transparent |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 331 | |
| 332 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 333 | #Image 1 |
| 334 | #Height 128 |
| 335 | #Description |
| 336 | Color the parts of the bitmap red if they mostly contain transparent pixels. |
| 337 | ## |
| 338 | std::vector<int32_t> srcPixels; |
| 339 | srcPixels.resize(source.height() * source.rowBytes()); |
| 340 | SkPixmap pixmap(SkImageInfo::MakeN32Premul(source.width(), source.height()), |
| 341 | &srcPixels.front(), source.rowBytes()); |
| 342 | source.readPixels(pixmap, 0, 0); |
| 343 | for (int y = 0; y < 16; ++y) { |
| 344 | for (int x = 0; x < 16; ++x) { |
| 345 | int32_t* blockStart = &srcPixels.front() + y * source.width() * 16 + x * 16; |
| 346 | size_t transparentCount = 0; |
| 347 | for (int fillY = 0; fillY < source.height() / 16; ++fillY) { |
| 348 | for (int fillX = 0; fillX < source.width() / 16; ++fillX) { |
| 349 | const SkColor color = SkUnPreMultiply::PMColorToColor(blockStart[fillX]); |
| 350 | transparentCount += SkColorGetA(color) == SK_AlphaTRANSPARENT; |
| 351 | } |
| 352 | blockStart += source.width(); |
| 353 | } |
| 354 | if (transparentCount > 200) { |
| 355 | blockStart = &srcPixels.front() + y * source.width() * 16 + x * 16; |
| 356 | for (int fillY = 0; fillY < source.height() / 16; ++fillY) { |
| 357 | for (int fillX = 0; fillX < source.width() / 16; ++fillX) { |
| 358 | blockStart[fillX] = SK_ColorRED; |
| 359 | } |
| 360 | blockStart += source.width(); |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | SkBitmap bitmap; |
| 366 | bitmap.installPixels(pixmap); |
| 367 | canvas->drawBitmap(bitmap, 0, 0); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 368 | ## |
| 369 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 370 | #SeeAlso SkAlpha SK_ColorTRANSPARENT SK_AlphaOPAQUE |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 371 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 372 | #Subtopic Transparent ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 373 | |
| 374 | # ------------------------------------------------------------------------------ |
| 375 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 376 | #Subtopic Opaque |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 377 | |
| 378 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 379 | #Image 1 |
| 380 | #Height 128 |
| 381 | std::vector<int32_t> srcPixels; |
| 382 | srcPixels.resize(source.height() * source.rowBytes()); |
| 383 | SkPixmap pixmap(SkImageInfo::MakeN32Premul(source.width(), source.height()), |
| 384 | &srcPixels.front(), source.rowBytes()); |
| 385 | source.readPixels(pixmap, 0, 0); |
| 386 | for (int y = 0; y < source.height(); ++y) { |
| 387 | for (int x = 0; x < source.width(); ++x) { |
| 388 | SkPMColor pixel = srcPixels[y * source.width() + x]; |
| 389 | const SkColor color = SkUnPreMultiply::PMColorToColor(pixel); |
| 390 | if (SkColorGetA(color) == SK_AlphaOPAQUE) { |
| 391 | srcPixels[y * source.width() + x] = SK_ColorGREEN; |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | SkBitmap bitmap; |
| 396 | bitmap.installPixels(pixmap); |
| 397 | canvas->drawBitmap(bitmap, 0, 0); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 398 | ## |
| 399 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 400 | #SeeAlso SkAlpha SK_AlphaTRANSPARENT |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 401 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 402 | #Subtopic Opaque ## |
| 403 | #Subtopic Alpha_Constants ## |
| 404 | |
| 405 | #Subtopic Color_Constants |
| 406 | #In Constant |
| 407 | #Line # constants for Color ## |
| 408 | |
| 409 | # ------------------------------------------------------------------------------ |
| 410 | #Code |
| 411 | constexpr SkColor SK_ColorTRANSPARENT = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); |
| 412 | constexpr SkColor SK_ColorBLACK = SkColorSetARGB(0xFF, 0x00, 0x00, 0x00); |
| 413 | constexpr SkColor SK_ColorDKGRAY = SkColorSetARGB(0xFF, 0x44, 0x44, 0x44); |
| 414 | constexpr SkColor SK_ColorGRAY = SkColorSetARGB(0xFF, 0x88, 0x88, 0x88); |
| 415 | constexpr SkColor SK_ColorLTGRAY = SkColorSetARGB(0xFF, 0xCC, 0xCC, 0xCC); |
| 416 | constexpr SkColor SK_ColorWHITE = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); |
| 417 | constexpr SkColor SK_ColorRED = SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00); |
| 418 | constexpr SkColor SK_ColorGREEN = SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00); |
| 419 | constexpr SkColor SK_ColorBLUE = SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF); |
| 420 | constexpr SkColor SK_ColorYELLOW = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0x00); |
| 421 | constexpr SkColor SK_ColorCYAN = SkColorSetARGB(0xFF, 0x00, 0xFF, 0xFF); |
| 422 | constexpr SkColor SK_ColorMAGENTA = SkColorSetARGB(0xFF, 0xFF, 0x00, 0xFF); |
| 423 | ## |
| 424 | |
| 425 | Color names are provided as conveniences, but are not otherwise special. |
| 426 | The values chosen for names may not be the same as values used by |
| 427 | SVG, HTML, CSS, or colors named by a platform. |
| 428 | |
| 429 | #Example |
| 430 | ###$ |
| 431 | $Function |
| 432 | #define SKIA_COLOR_PAIR(name) "SK_Color" #name, SK_Color##name |
| 433 | $$ |
| 434 | void draw(SkCanvas* canvas) { |
| 435 | struct ColorCompare { |
| 436 | const char* fSVGName; |
| 437 | SkColor fSVGColor; |
| 438 | const char* fSkiaName; |
| 439 | SkColor fSkiaColor; |
| 440 | } colorCompare[] = { // see https://www.w3.org/TR/SVG/types.html#ColorKeywords |
| 441 | {"black", SkColorSetRGB( 0, 0, 0), SKIA_COLOR_PAIR(BLACK) }, |
| 442 | {"darkgray", SkColorSetRGB(169, 169, 169), SKIA_COLOR_PAIR(DKGRAY) }, |
| 443 | {"gray", SkColorSetRGB(128, 128, 128), SKIA_COLOR_PAIR(GRAY) }, |
| 444 | {"lightgray", SkColorSetRGB(211, 211, 211), SKIA_COLOR_PAIR(LTGRAY) }, |
| 445 | {"white", SkColorSetRGB(255, 255, 255), SKIA_COLOR_PAIR(WHITE) }, |
| 446 | {"red", SkColorSetRGB(255, 0, 0), SKIA_COLOR_PAIR(RED) }, |
| 447 | {"green", SkColorSetRGB( 0, 128, 0), SKIA_COLOR_PAIR(GREEN) }, |
| 448 | {"blue", SkColorSetRGB( 0, 0, 255), SKIA_COLOR_PAIR(BLUE) }, |
| 449 | {"yellow", SkColorSetRGB(255, 255, 0), SKIA_COLOR_PAIR(YELLOW) }, |
| 450 | {"aqua", SkColorSetRGB( 0, 255, 255), SKIA_COLOR_PAIR(CYAN) }, |
| 451 | {"fuchsia", SkColorSetRGB(255, 0, 255), SKIA_COLOR_PAIR(MAGENTA) }, |
| 452 | }; |
| 453 | SkPaint paint; |
| 454 | paint.setAntiAlias(true); |
| 455 | paint.setTextSize(14); |
| 456 | for (auto compare : colorCompare) { |
| 457 | paint.setStyle(SkPaint::kFill_Style); |
| 458 | paint.setColor(compare.fSVGColor); |
| 459 | canvas->drawRect({5, 5, 15, 15}, paint); |
| 460 | paint.setColor(SK_ColorBLACK); |
| 461 | canvas->drawString(compare.fSVGName, 20, 16, paint); |
| 462 | paint.setColor(compare.fSkiaColor); |
| 463 | canvas->drawRect({105, 5, 115, 15}, paint); |
| 464 | paint.setColor(SK_ColorBLACK); |
| 465 | canvas->drawString(compare.fSkiaName, 120, 16, paint); |
| 466 | paint.setStyle(SkPaint::kStroke_Style); |
| 467 | canvas->drawRect({5, 5, 15, 15}, paint); |
| 468 | canvas->drawRect({105, 5, 115, 15}, paint); |
| 469 | canvas->translate(0, 20); |
| 470 | } |
| 471 | } |
| 472 | $$$# |
| 473 | ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 474 | |
| 475 | # ------------------------------------------------------------------------------ |
| 476 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 477 | #Const SK_ColorTRANSPARENT 0x00000000 |
| 478 | #Line # transparent Color ## |
| 479 | #Details Transparent |
| 480 | Represents fully transparent SkColor. May be used to initialize a destination |
| 481 | containing a mask or a non-rectangular image. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 482 | ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 483 | #Const SK_ColorBLACK 0xFF000000 |
| 484 | #Line # black Color ## |
| 485 | #Details Black |
| 486 | Represents fully opaque black. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 487 | ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 488 | #Const SK_ColorDKGRAY 0xFF444444 |
| 489 | #Line # dark gray Color ## |
| 490 | Represents fully opaque dark gray. |
| 491 | Note that SVG_darkgray is equivalent to 0xFFA9A9A9. |
| 492 | ## |
| 493 | #Const SK_ColorGRAY 0xFF888888 |
| 494 | #Line # gray Color ## |
| 495 | Represents fully opaque gray. |
| 496 | Note that HTML_Gray is equivalent to 0xFF808080. |
| 497 | ## |
| 498 | #Const SK_ColorLTGRAY 0xFFCCCCCC |
| 499 | #Line # light gray Color ## |
| 500 | Represents fully opaque light gray. HTML_Silver is equivalent to 0xFFC0C0C0. |
| 501 | Note that SVG_lightgray is equivalent to 0xFFD3D3D3. |
| 502 | ## |
| 503 | #Const SK_ColorWHITE 0xFFFFFFFF |
| 504 | #Line # white Color ## |
| 505 | Represents fully opaque white. |
| 506 | ## |
| 507 | #Const SK_ColorRED 0xFFFF0000 |
| 508 | #Line # red Color ## |
| 509 | Represents fully opaque red. |
| 510 | ## |
| 511 | #Const SK_ColorGREEN 0xFF00FF00 |
| 512 | #Line # green Color ## |
| 513 | Represents fully opaque green. HTML_Lime is equivalent. |
| 514 | Note that HTML_Green is equivalent to 0xFF008000. |
| 515 | ## |
| 516 | #Const SK_ColorBLUE 0xFF0000FF |
| 517 | #Line # blue Color ## |
| 518 | Represents fully opaque blue. |
| 519 | ## |
| 520 | #Const SK_ColorYELLOW 0xFFFFFF00 |
| 521 | #Line # yellow Color ## |
| 522 | Represents fully opaque yellow. |
| 523 | ## |
| 524 | #Const SK_ColorCYAN 0xFF00FFFF |
| 525 | #Line # cyan Color ## |
| 526 | Represents fully opaque cyan. HTML_Aqua is equivalent. |
| 527 | ## |
| 528 | #Const SK_ColorMAGENTA 0xFFFF00FF |
| 529 | #Line # magenta Color ## |
| 530 | Represents fully opaque magenta. HTML_Fuchsia is equivalent. |
| 531 | ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 532 | |
| 533 | # ------------------------------------------------------------------------------ |
| 534 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 535 | #Subtopic Transparent |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 536 | |
| 537 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 538 | std::vector<uint32_t> srcPixels; |
| 539 | constexpr int width = 256; |
| 540 | constexpr int height = 256; |
| 541 | srcPixels.resize(width * height); |
| 542 | SkImageInfo imageInfo = SkImageInfo::MakeN32Premul(width, height); |
| 543 | SkPixmap pixmap(imageInfo, &srcPixels.front(), imageInfo.minRowBytes()); |
| 544 | pixmap.erase(SK_ColorTRANSPARENT); |
| 545 | pixmap.erase(SK_ColorRED, { 24, 24, 192, 192 } ); |
| 546 | pixmap.erase(SK_ColorTRANSPARENT, { 48, 48, 168, 168 } ); |
| 547 | SkBitmap bitmap; |
| 548 | bitmap.installPixels(pixmap); |
| 549 | canvas->drawBitmap(bitmap, 0, 0); |
| 550 | canvas->drawBitmap(bitmap, 48, 48); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 551 | ## |
| 552 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 553 | #SeeAlso SK_AlphaTRANSPARENT SkCanvas::clear |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 554 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 555 | ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 556 | |
| 557 | # ------------------------------------------------------------------------------ |
| 558 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 559 | #Subtopic Black |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 560 | |
| 561 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 562 | std::vector<uint32_t> srcPixels; |
| 563 | constexpr int width = 256; |
| 564 | constexpr int height = 256; |
| 565 | srcPixels.resize(width * height); |
| 566 | SkImageInfo imageInfo = SkImageInfo::MakeN32Premul(width, height); |
| 567 | SkPixmap pixmap(imageInfo, &srcPixels.front(), imageInfo.minRowBytes()); |
| 568 | pixmap.erase(SK_ColorTRANSPARENT); |
| 569 | pixmap.erase(SK_ColorRED, { 24, 24, 192, 192 } ); |
| 570 | pixmap.erase(SK_ColorBLACK, { 48, 48, 168, 168 } ); |
| 571 | SkBitmap bitmap; |
| 572 | bitmap.installPixels(pixmap); |
| 573 | canvas->drawBitmap(bitmap, 0, 0); |
| 574 | canvas->drawBitmap(bitmap, 48, 48); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 575 | ## |
| 576 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 577 | #SeeAlso SK_ColorTRANSPARENT |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 578 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 579 | ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 580 | |
| 581 | # ------------------------------------------------------------------------------ |
| 582 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 583 | #Subtopic White |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 584 | |
| 585 | #Example |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 586 | std::vector<uint32_t> srcPixels; |
| 587 | constexpr int width = 256; |
| 588 | constexpr int height = 256; |
| 589 | srcPixels.resize(width * height); |
| 590 | SkImageInfo imageInfo = SkImageInfo::MakeN32Premul(width, height); |
| 591 | SkPixmap pixmap(imageInfo, &srcPixels.front(), imageInfo.minRowBytes()); |
| 592 | pixmap.erase(SK_ColorTRANSPARENT); |
| 593 | pixmap.erase(SK_ColorRED, { 24, 24, 192, 192 } ); |
| 594 | pixmap.erase(SK_ColorWHITE, { 48, 48, 168, 168 } ); |
| 595 | SkBitmap bitmap; |
| 596 | bitmap.installPixels(pixmap); |
| 597 | canvas->drawBitmap(bitmap, 0, 0); |
| 598 | canvas->drawBitmap(bitmap, 48, 48); |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 599 | ## |
| 600 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 601 | #SeeAlso SK_ColorTRANSPARENT |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 602 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 603 | ## |
| 604 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 605 | #Subtopic Color_Constants ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 606 | |
| 607 | # ------------------------------------------------------------------------------ |
| 608 | |
| 609 | #Subtopic HSV |
| 610 | |
| 611 | #Subtopic Hue |
| 612 | Hue represents an angle, in degrees, on a color wheel. Hue has a positive value |
| 613 | modulo 360, where zero degrees is red. |
| 614 | ## |
| 615 | |
| 616 | #Subtopic Saturation |
| 617 | ## |
| 618 | |
| 619 | #Subtopic Value |
| 620 | ## |
| 621 | |
| 622 | #Method SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]) |
| 623 | #In Function |
| 624 | #Line # incomplete ## |
| 625 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 626 | Converts RGB components to HSV. |
| 627 | hsv[0] contains Hue, a value from zero to less than 360. |
| 628 | hsv[1] contains Saturation, a value from zero to one. |
| 629 | hsv[2] contains Value, a value from zero to one. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 630 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 631 | #Param red red component value from zero to 255 ## |
| 632 | #Param green green component value from zero to 255 ## |
| 633 | #Param blue blue component value from zero to 255 ## |
| 634 | #Param hsv three element array which holds the resulting HSV components |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 635 | ## |
| 636 | |
| 637 | #Return incomplete ## |
| 638 | |
| 639 | #Example |
| 640 | // incomplete |
| 641 | ## |
| 642 | |
| 643 | #SeeAlso incomplete |
| 644 | |
| 645 | #Method ## |
| 646 | |
| 647 | # ------------------------------------------------------------------------------ |
| 648 | |
| 649 | #Method static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) |
| 650 | #In Function |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 651 | #Line # converts RGB to HSV ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 652 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 653 | Converts ARGB to its HSV components. Alpha in ARGB is ignored. |
| 654 | hsv[0] contains Hue, and is assigned a value from zero to less than 360. |
| 655 | hsv[1] contains Saturation, a value from zero to one. |
| 656 | hsv[2] contains Value, a value from zero to one. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 657 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 658 | #Param color ARGB color to convert |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 659 | ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 660 | #Param hsv three element array which holds the resulting HSV components |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 661 | ## |
| 662 | |
| 663 | #Return incomplete ## |
| 664 | |
| 665 | #Example |
| 666 | // incomplete |
| 667 | ## |
| 668 | |
| 669 | #SeeAlso incomplete |
| 670 | |
| 671 | #Method ## |
| 672 | |
| 673 | # ------------------------------------------------------------------------------ |
| 674 | |
| 675 | #Method SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]) |
| 676 | #In Function |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 677 | #Line # converts HSV with Alpha to RGB ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 678 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 679 | Converts HSV components to an ARGB color. The alpha component is passed through unchanged. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 680 | hsv[0] represents Hue, an angle from zero to less than 360. |
| 681 | hsv[1] represents Saturation, and varies from zero to one. |
| 682 | hsv[2] represents Value, and varies from zero to one. |
| 683 | |
| 684 | If hsv values are out of range, they are pinned. |
| 685 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 686 | #Param alpha Alpha component of the returned ARGB color |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 687 | ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 688 | #Param hsv three element array which holds the input HSV components |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 689 | ## |
| 690 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 691 | #Return ARGB equivalent to HSV |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 692 | ## |
| 693 | |
| 694 | #Example |
| 695 | // incomplete |
| 696 | ## |
| 697 | |
| 698 | #SeeAlso incomplete |
| 699 | |
| 700 | #Method ## |
| 701 | |
| 702 | # ------------------------------------------------------------------------------ |
| 703 | |
| 704 | #Method static inline SkColor SkHSVToColor(const SkScalar hsv[3]) |
| 705 | #In Function |
| 706 | #Line # incomplete ## |
| 707 | |
| 708 | Convert HSV components to an ARGB color. The alpha component set to 0xFF. |
| 709 | hsv[0] represents Hue, an angle from zero to less than 360. |
| 710 | hsv[1] represents Saturation, and varies from zero to one. |
| 711 | hsv[2] represents Value, and varies from zero to one. |
| 712 | |
| 713 | If hsv values are out of range, they are pinned. |
| 714 | |
| 715 | #Param hsv 3 element array which holds the input HSV components. |
| 716 | ## |
| 717 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 718 | #Return the resulting ARGB color |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 719 | ## |
| 720 | |
| 721 | #Example |
| 722 | // incomplete |
| 723 | ## |
| 724 | |
| 725 | #SeeAlso incomplete |
| 726 | |
| 727 | #Method ## |
| 728 | |
| 729 | #Subtopic HSV ## |
| 730 | |
| 731 | # ------------------------------------------------------------------------------ |
| 732 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 733 | #Subtopic PMColor |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 734 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 735 | #Typedef uint32_t SkPMColor |
| 736 | #Line # defines Premultiplied Color as 32 bits ## |
| 737 | |
| 738 | 32-bit ARGB color value, Premultiplied. The byte order for this value is |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 739 | configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 740 | This is different from SkColor, which is Unpremultiplied, and is always in the |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 741 | same byte order. |
| 742 | |
| 743 | #Typedef ## |
| 744 | |
| 745 | # ------------------------------------------------------------------------------ |
| 746 | |
| 747 | #Method SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) |
| 748 | #In Function |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 749 | #Line # converts Unpremultiplied ARGB to Premultiplied PMColor ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 750 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 751 | Return a SkPMColor value from Unpremultiplied 8-bit component values |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 752 | |
| 753 | #Param a incomplete ## |
| 754 | #Param r incomplete ## |
| 755 | #Param g incomplete ## |
| 756 | #Param b incomplete ## |
| 757 | |
| 758 | #Return incomplete ## |
| 759 | |
| 760 | #Example |
| 761 | // incomplete |
| 762 | ## |
| 763 | |
| 764 | #SeeAlso incomplete |
| 765 | |
| 766 | #Method ## |
| 767 | |
| 768 | # ------------------------------------------------------------------------------ |
| 769 | |
| 770 | #Method SK_API SkPMColor SkPreMultiplyColor(SkColor c) |
| 771 | #In Function |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 772 | #Line # converts Unpremultiplied Color to Premultiplied PMColor ## |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 773 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 774 | Returns PMColor closest to Color c. Multiplies c RGB components by the c Alpha, |
| 775 | and arranges the bytes to match the format of kN32_SkColorType. |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 776 | |
| 777 | #Param c incomplete ## |
| 778 | |
| 779 | #Return incomplete ## |
| 780 | |
| 781 | #Example |
| 782 | // incomplete |
| 783 | ## |
| 784 | |
| 785 | #SeeAlso incomplete |
| 786 | |
| 787 | #Method ## |
| 788 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame^] | 789 | #Subtopic PMColor ## |
| 790 | |
Cary Clark | 2d4bf5f | 2018-04-16 08:37:38 -0400 | [diff] [blame] | 791 | #Topic Color ## |