1 /* 2 * Copyright 2025 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkPMColor_DEFINED 9 #define SkPMColor_DEFINED 10 11 #include "include/core/SkColor.h" 12 #include "include/private/base/SkAPI.h" 13 14 #include <cstdint> 15 16 /** Returns a SkPMColor value from already premultiplied 8-bit component values. 17 18 @param a amount of alpha, from fully transparent (0) to fully opaque (255) 19 @param r amount of red, from no red (0) to full red (255) 20 @param g amount of green, from no green (0) to full green (255) 21 @param b amount of blue, from no blue (0) to full blue (255) 22 @return premultiplied color 23 */ 24 SK_API SkPMColor SkPMColorSetARGB(SkAlpha a, uint8_t r, uint8_t g, uint8_t b); 25 26 /** Returns alpha component of premultiplied color. */ 27 SK_API SkAlpha SkPMColorGetA(SkPMColor); 28 29 /** Returns red component of premultiplied color. */ 30 SK_API uint8_t SkPMColorGetR(SkPMColor); 31 32 /** Returns green component of premultiplied color. */ 33 SK_API uint8_t SkPMColorGetG(SkPMColor); 34 35 /** Returns blue component of premultiplied color. */ 36 SK_API uint8_t SkPMColorGetB(SkPMColor); 37 38 #endif 39