ConvolveOp

open class ConvolveOp(kernelData: FloatArray, length: Int) : Texture.TextureOp

This class implements a convolution from the source texture to the destination texture. Convolution using a convolution kernel is a spatial operation that computes the output pixel from an input pixel by multiplying the kernel with the surround of the input pixel. This allows the output pixel to be affected by the immediate neighborhood in a way that can be mathematically specified with a kernel, and the kernel size is length * length by passing in a float array with the length of length ^ 2.

The destination texture always has a alpha channel, and color components will be pre-multiplied with the alpha component. The convolution operation provides a free transformation effect for the input texture, and two predefined convolution operations are provided in the Texture class, which are transparency and Gaussian blur(averageConvolve33, gaussianBlurConvolve33 and so on). Also, you can use the method convolve to get an instance of this class. All convolution operations and processed textures will be cached by the Texture class to improve rendering performance.

For the edge pixels of the image, the default value of missing pixels within the convolution radius is set to 0 when performing convolution operations.

The transform in its super class TextureOp is useless here for it is NORMAL_MATRIX.

Author

KKoishi_

Parameters

kernelData

kernel data in row major order.

length

the length of the kernel (square) matrix.

Constructors

Link copied to clipboard
constructor(kernelData: FloatArray, length: Int)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun apply(g: Graphics2D, texture: BufferedImage)

Apply this operation to the specified Graphics2D and render the texture using g.

Link copied to clipboard
open override fun createDestImage(texture: BufferedImage): BufferedImage

Creates a zeroed destination image with the correct size and number of bands.

Link copied to clipboard
open override fun toString(): String