SkColor4f Reference

Color4f

Struct SkColor4f

Member

SkColor4f members may be read and written directly without using a member function.

Each component is independent of the others; fA Alpha is not Premultiplied with fG green, fB blue, or fR red.

Values smaller than zero or larger than one are allowed. Values out of range may be used with Blend Mode so that the final component is in range.

Overview

Operator

SkColor4f operators inline class member functions with arithmetic equivalents.

Member Function

SkColor4f member functions read and modify the structure properties.

Members

operator==

Compares Color4f with other, and returns true if all components are equivalent.

Parameters

Return Value

true if Color4f equals other

Example

Example Output

colorRed == colorNamedRed

See Also

operator!=(const SkColor4f& other) const


operator!=

Compares Color4f with other, and returns true if all components are not equivalent.

Parameters

Return Value

true if Color4f is not equal to other

Example

Example Output

colorGray != colorNamedGray

See Also

operator==(const SkColor4f& other) const


vec

Returns Color4f components as a read-only array.

Return Value

components as read-only array

Example

Example Output

red=0.0578054 green=0.246201 blue=0.603827 alpha=0.533333
[0]=0.0578054 [1]=0.246201 [2]=0.603827 [3]=0.533333

See Also

SkColor4f


Returns Color4f components as a writable array.

Return Value

components as writable array

Example

Example Output

red=0.0578054 green=0.246201 blue=0.603827 alpha=0.533333
[0]=0.0578054 [1]=0.246201 [2]=0.603827 [3]=1

See Also

SkColor4f


Pin

Constructs and returns Color4f with each component pinned from zero to one.

Parameters

Return Value

Color4f with valid components

Example

See Also

pin FromColor


FromColor

Converts to closest Color4f.

Parameters

Return Value

Color4f equivalent

Example

Example Output

red=0.0742136 green=0.130136 blue=0.318547 alpha=0.168627
red=77 green=101 blue=153 alpha=43

See Also

toSkColor


toSkColor

Converts to closest SkColor.

Return Value

closest Color

Example

Example Output

red=75 green=101 blue=153 alpha=43
red=0.0703601 green=0.130136 blue=0.318547 alpha=0.168627

See Also

FromColor


pin

Returns Color4f with all components in the range from zero to one.

Return Value

Color4f with valid components

Example

See Also

Pin


premul

Internal use only.

Return Value

Premultiplied color


Struct SkPM4f

Internal use only.