core-ktx / androidx.graphics / kotlin.Int

Extensions for kotlin.Int

alpha

val Int.alpha: Int

Return the alpha component of a color int. This is equivalent to calling:

blue

val Int.blue: Int

Return the blue component of a color int. This is equivalent to calling:

component1

operator fun Int.component1(): Int

Return the alpha component of a color int. This is equivalent to calling:

component2

operator fun Int.component2(): Int

Return the red component of a color int. This is equivalent to calling:

component3

operator fun Int.component3(): Int

Return the green component of a color int. This is equivalent to calling:

component4

operator fun Int.component4(): Int

Return the blue component of a color int. This is equivalent to calling:

green

val Int.green: Int

Return the green component of a color int. This is equivalent to calling:

luminance

val Int.luminance: Float

Returns the relative luminance of a color int, assuming sRGB encoding. Based on the formula for relative luminance defined in WCAG 2.0, W3C Recommendation 11 December 2008.

red

val Int.red: Int

Return the red component of a color int. This is equivalent to calling:

toColor

fun Int.toColor(): Color

Creates a new Color instance from a color int. The resulting color is in the sRGB color space.

toColorLong

fun Int.toColorLong(): Long

Converts the specified ARGB color int to an RGBA color long in the sRGB color space.