FileDocCategorySizeDatePackage
Kernel.javaAPI DocAndroid 1.5 API3987Wed May 06 22:41:54 BST 2009java.awt.image

Kernel

public class Kernel extends Object implements Cloneable
The Kernel class provides a matrix. This matrix is stored as a float array which describes how a specified pixel affects the value calculated for the pixel's position in the output image of a filtering operation. The X, Y origins indicate the kernel matrix element which corresponds to the pixel position for which an output value is being calculated.
since
Android 1.0

Fields Summary
private final int
xOrigin
The x origin.
private final int
yOrigin
The y origin.
private int
width
The width.
private int
height
The height.
float[]
data
The data.
Constructors Summary
public Kernel(int width, int height, float[] data)
Instantiates a new Kernel with the specified float array. The width*height elements of the data array are copied.

param
width the width of the Kernel.
param
height the height of the Kernel.
param
data the data of Kernel.

        int dataLength = width * height;
        if (data.length < dataLength) {
            // awt.22B=Length of data should not be less than width*height
            throw new IllegalArgumentException(Messages.getString("awt.22B")); //$NON-NLS-1$
        }

        this.width = width;
        this.height = height;

        this.data = new float[dataLength];
        System.arraycopy(data, 0, this.data, 0, dataLength);

        xOrigin = (width - 1) / 2;
        yOrigin = (height - 1) / 2;
    
Methods Summary
public java.lang.Objectclone()
Returns a copy of this Kernel object.

return
the copy of this Kernel object.

        return new Kernel(width, height, data);
    
public final intgetHeight()
Gets the height of this Kernel.

return
the height of this Kernel.

        return height;
    
public final float[]getKernelData(float[] data)
Gets the float data array of this Kernel.

param
data the float array where the resulted data will be stored.
return
the float data array of this Kernel.

        if (data == null) {
            data = new float[this.data.length];
        }
        System.arraycopy(this.data, 0, data, 0, this.data.length);

        return data;
    
public final intgetWidth()
Gets the width of this Kernel.

return
the width of this Kernel.

        return width;
    
public final intgetXOrigin()
Gets the X origin of this Kernel.

return
the X origin of this Kernel.

        return xOrigin;
    
public final intgetYOrigin()
Gets the Y origin of this Kernel.

return
the Y origin of this Kernel.

        return yOrigin;