RadialColorReplacementFilter

class RadialColorReplacementFilter(val colors: List<Color>, val center: Pair<Int, Int>? = null) : RGBImageFilter(source)

Replaces all colors with one of colors depending on the angle relative to center.

Parameters

colors

the colors that should be used, in clockwise order starting north-west

center

the center relative to which colors should be calculated; not required if only one color is given

Constructors

Link copied to clipboard
constructor(colors: List<Color>, center: Pair<Int, Int>? = null)

Types

Link copied to clipboard
object Companion

Holds constants.

Properties

Link copied to clipboard
private val center: Pair<Int, Int>? = null
Link copied to clipboard
private val colors: List<Color>

Functions

Link copied to clipboard
private fun asFraction(number: Int): Double

Represents a number in the range [0, 256) as a fraction of that range.

Link copied to clipboard
open override fun filterRGB(x: Int, y: Int, rgb: Int): Int

Returns the color to be displayed at (x, y), considering the coordinates relative to the center and the relative alpha of the encountered color.

Link copied to clipboard
private fun positionToColor(offset: Pair<Int, Int>): Color

Returns the appropriate color from colors for an offset relative to the center.

Link copied to clipboard
private fun shiftAlpha(toShift: Color, shiftBy: Color): @NotNull Color

Returns toShift which has its alpha multiplied by that of shiftBy.