SkColor Reference

Color

Overview

Overview Subtopic

name description

Define

name description

Function

name description

Typedef

name description

Alpha

RGB

RGB Red

RGB Blue

RGB Green

ARGB

RBG

RGB-565

Gray

Types and macros for colors 8-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent. 32 bit ARGB color value, not premultiplied. The color components are always in a known order. This is different from SkPMColor, which has its bytes in a configuration dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor is the type used to specify colors in SkPaint and in gradients.

SkColorSetARGB

static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)

Return a SkColor value from 8 bit component values

Parameters

a incomplete
r incomplete
g incomplete
b incomplete

Return Value

incomplete

Example

See Also

incomplete


    #define SkColorSetARGBInline SkColorSetARGB

Legacy aliases.

See Also

incomplete

    #define SkColorSetARGBMacro  SkColorSetARGB

See Also

incomplete

    #define SkColorSetRGB(r, g, b)  SkColorSetARGB(0xFF, r, g, b)

Return a SkColor value from 8 bit component values, with an implied value of 0xFF for alpha (fully opaque)

Parameters

r incomplete
g incomplete
b incomplete

Example

See Also

incomplete

    #define SkColorGetA(color)      (((color) >> 24) & 0xFF)

return the alpha byte from a SkColor value

Parameters

color incomplete

Example

See Also

incomplete

    #define SkColorGetR(color)      (((color) >> 16) & 0xFF)

return the red byte from a SkColor value

Parameters

color incomplete

Example

See Also

incomplete

    #define SkColorGetG(color)      (((color) >>  8) & 0xFF)

return the green byte from a SkColor value

Parameters

color incomplete

Example

See Also

incomplete

    #define SkColorGetB(color)      (((color) >>  0) & 0xFF)

return the blue byte from a SkColor value

Parameters

color incomplete

Example

See Also

incomplete

SkColorSetA

static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a)

Parameters

c incomplete
a incomplete

Return Value

incomplete

Example

See Also

incomplete


    #define SK AlphaTRANSPARENT static_cast<SkAlpha>(0x00)

common colors transparent SkAlpha value

Example

See Also

incomplete

    #define SK AlphaOPAQUE      static_cast<SkAlpha>(0xFF)

opaque SkAlpha value

Example

See Also

incomplete

    #define SK ColorTRANSPARENT static_cast<SkColor>(0x00000000)

transparent SkColor value

Example

See Also

incomplete

    #define SK ColorBLACK       static_cast<SkColor>(0xFF000000)

black SkColor value

Example

See Also

incomplete

    #define SK ColorDKGRAY      static_cast<SkColor>(0xFF444444)

dark gray SkColor value

Example

See Also

incomplete

    #define SK ColorGRAY        static_cast<SkColor>(0xFF888888)

gray SkColor value

Example

See Also

incomplete

    #define SK ColorLTGRAY      static_cast<SkColor>(0xFFCCCCCC)

light gray SkColor value

Example

See Also

incomplete

    #define SK ColorWHITE       static_cast<SkColor>(0xFFFFFFFF)

white SkColor value

Example

See Also

incomplete

    #define SK ColorRED         static_cast<SkColor>(0xFFFF0000)

red SkColor value

Example

See Also

incomplete

    #define SK ColorGREEN       static_cast<SkColor>(0xFF00FF00)

green SkColor value

Example

See Also

incomplete

    #define SK ColorBLUE        static_cast<SkColor>(0xFF0000FF)

blue SkColor value

Example

See Also

incomplete

    #define SK ColorYELLOW      static_cast<SkColor>(0xFFFFFF00)

yellow SkColor value

Example

See Also

incomplete

    #define SK ColorCYAN        static_cast<SkColor>(0xFF00FFFF)

cyan SkColor value

Example

See Also

incomplete

    #define SK ColorMAGENTA     static_cast<SkColor>(0xFFFF00FF)

magenta SkColor value

Example

See Also

incomplete

HSV

HSV Hue

Hue represents an angle, in degrees, on a color wheel. Hue has a positive value modulo 360, where zero degrees is red.

HSV Saturation

HSV Value

SkRGBToHSV

SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3])

Convert RGB components to HSV. hsv[0] is Hue [0 .. 360) hsv[1] is Saturation [0…1] hsv[2] is Value [0…1]

Parameters

red red component value [0..255]
green green component value [0..255]
blue blue component value [0..255]
hsv 3 element array which holds the resulting HSV components.

Return Value

incomplete

Example

See Also

incomplete


SkColorToHSV

static inline void SkColorToHSV(SkColor color, SkScalar hsv[3])

Convert the argb color to its HSV components. hsv[0] represents Hue, and is assigned a value from zero to less than 360. hsv[1] is Saturation [0…1] hsv[2] is Value [0…1]

Parameters

color the argb color to convert. Note: the alpha component is ignored.
hsv 3 element array which holds the resulting HSV components.

Return Value

incomplete

Example

See Also

incomplete


SkHSVToColor

SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3])

Convert HSV components to an ARGB color. The alpha component is passed through unchanged. hsv[0] represents Hue, an angle from zero to less than 360. hsv[1] represents Saturation, and varies from zero to one. hsv[2] represents Value, and varies from zero to one.

If hsv values are out of range, they are pinned.

Parameters

alpha the alpha component of the returned argb color.
hsv 3 element array which holds the input HSV components.

Return Value

the resulting argb color

Example

See Also

incomplete


static inline SkColor SkHSVToColor(const SkScalar hsv[3])

Convert HSV components to an ARGB color. The alpha component set to 0xFF. hsv[0] represents Hue, an angle from zero to less than 360. hsv[1] represents Saturation, and varies from zero to one. hsv[2] represents Value, and varies from zero to one.

If hsv values are out of range, they are pinned.

Parameters

hsv 3 element array which holds the input HSV components.

Return Value

the resulting argb color

Example

See Also

incomplete


32 bit ARGB color value, premultiplied. The byte order for this value is configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps. This is different from SkColor, which is nonpremultiplied, and is always in the same byte order.

SkPreMultiplyARGB

SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)

Return a SkPMColor value from unpremultiplied 8 bit component values

Parameters

a incomplete
r incomplete
g incomplete
b incomplete

Return Value

incomplete

Example

See Also

incomplete


SkPreMultiplyColor

SK_API SkPMColor SkPreMultiplyColor(SkColor c)

Return a SkPMColor value from a SkColor value. This is done by multiplying the color components by the color’s alpha, and by arranging the bytes in a configuration dependent order, to match the format of kBGRA_8888_SkColorType bitmaps.

Parameters

c incomplete

Return Value

incomplete

Example

See Also

incomplete