Each component is stored as a 32-bit single precision floating point float value. All values are allowed, but only the range from zero to one is meaningful.
Components are independent of the others if defined with kUnpremul_SkAlphaType; fA Alpha is may be greater or smaller than fG green, fB blue, or fR red. SkColor4f is shorthand for Unpremultiplied SkRGBA4f.
Components are connected if defined with kPremul_SkAlphaType; fA Alpha is equal to or larger than fG green, fB blue, and fR red. The values stored in fG, fB, and fR combine the color component with the Alpha component.
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.
Compares SkRGBA4f with other, and returns true if all components are equivalent.
true if SkRGBA4f equals other
colorRed == colorNamedRed
operator!=(const SkRGBA4f& other) const
Compares SkRGBA4f with other, and returns true if all components are not equivalent.
true if SkRGBA4f is not equal to other
colorGray != colorNamedGray
operator==(const SkRGBA4f& other) const
Multiplies each component by scale. Does not pin the result.
scaled color
SkBlendMode::kMultiply
Multiplies each component by scale component. Does not pin the result.
scaled color
SkBlendMode::kMultiply
Returns SkRGBA4f components as a read-only array.
components as read-only array
red=0.266667 green=0.533333 blue=0.8 alpha=0.533333 [0]=0.266667 [1]=0.533333 [2]=0.8 [3]=0.533333
SkColor4f
Returns SkRGBA4f components as a writable array.
components as writable array
red=0.266667 green=0.533333 blue=0.8 alpha=0.533333 [0]=0.266667 [1]=0.533333 [2]=0.8 [3]=1
SkColor4f
Returns SkRGBA4f component by index, zero through three. index out of range triggers an assert in debug builds.
component by index
vec
Returns writable component reference by index, zero through three. index out of range triggers an assert in debug builds.
writable component reference by index
vec
Returns true if Alpha component is one. Color has no transparency regardless of whether color is Premultiplied or Unpremultiplied. Triggers a debugging assert if Alpha not valid.
true if Alpha is one
vec SkColorGetA
Returns closest SkRGBA4f to SkColor. Only allowed if SkRGBA4f is unpremultiplied.
SkColor as SkRGBA4f
red=0.301961 green=0.396078 blue=0.6 alpha=0.168627 red=77 green=101 blue=153 alpha=43
toSkColor
Converts to closest SkColor.
closest Color
red=18 green=33 blue=82 alpha=43 red=0.0705882 green=0.129412 blue=0.321569 alpha=0.168627
FromColor
Converts from Premultiplied integer components to Unpremultiplied float components.
Unpremultiplied color
FromColor
Returns SkColor4f with all components premultiplied by Alpha.
Premultiplied color
unpremul
Returns SkRGBA4f with all components independent of Alpha.
Unpremultiplied color
premul
Produces bytes in RGBA order. Component values are not affected by color Alpha.
color
Returns from color kRGBA_8888_SkColorType order. Component values are not affected by color Alpha.
color
Returns color with Alpha set to one.
color