ColorMatrixFilter

class ColorMatrixFilter(colorMatrix: Matrix4, blendRatio: Double = 1.0) : ShaderFilter

A Filter applying a complex color transformation to the view.

colorMatrix is a 4x4 Matrix used to multiply each color as floating points by this matrix. blendRatio is the ratio that will be used to interpolate the original color with the transformed color.

ColorMatrixFilter provides a few pre-baked matrices:

Constructors

Link copied to clipboard
constructor(colorMatrix: Matrix4, blendRatio: Double = 1.0)

Types

Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard

Ratio for blending the original color with the transformed color.

Link copied to clipboard

The 4x4 MMatrix3D that will be used for transforming each pixel components r, g, b, a

Link copied to clipboard
open override var filtering: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun computeBorder(texWidth: Int, texHeight: Int): MarginInt

The number of pixels the passed texture should be bigger at each direction: left, right, top, left.

Link copied to clipboard
fun Filter.getBorder(texWidth: Int, texHeight: Int): MarginInt
Link copied to clipboard
open override fun render(ctx: RenderContext, matrix: Matrix, texture: Texture, texWidth: Int, texHeight: Int, renderColorMul: RGBA, blendMode: BlendMode, filterScale: Double)

The method in charge of rendering the texture transformed using ctx and matrix. The method receives a texture that should be the original image with computeBorder additional pixels on each side.

Link copied to clipboard
fun Filter.renderToTextureWithBorder(ctx: RenderContext, matrix: Matrix, texture: Texture, texWidth: Int, texHeight: Int, filterScale: Double, block: (Texture, matrix: Matrix) -> Unit)
Link copied to clipboard
fun Filter.renderToTextureWithBorderUnsafe(ctx: RenderContext, matrix: Matrix, texture: Texture, texWidth: Int, texHeight: Int, filterScale: Double, result: RenderToTextureResult = RenderToTextureResult()): RenderToTextureResult