APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.image

public Class Kernel

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.util.Objects

The Kernel class defines a matrix that describes how a specified pixel and its surrounding pixels affect the value computed for the pixel's position in the output image of a filtering operation. The X origin and Y origin indicate the kernel matrix element that corresponds to the pixel position for which an output value is being computed.
See Also
ConvolveOp

Field Summary

Modifier and TypeField and Description
private float[]
private int
private int
private int
private int

Constructor Summary

AccessConstructor and Description
public
Kernel(int
width of the kernel
width
,
int
height of the kernel
height
,
float[]
kernel data in row major order
data
)

Constructs a Kernel object from an array of floats.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a clone of this object.
clone
()

Overrides java.lang.Object.clone.

Clones this object.

public final int

Returns:

the height of this Kernel.
getHeight
()

Returns the height of this Kernel.

public final float[]

Returns:

the data array containing the kernel data in row major order or, if data is null, a newly allocated array containing the kernel data in row major order
getKernelData
(float[]
if non-null, contains the returned kernel data
data
)

Returns the kernel data in row major order.

public final int

Returns:

the width of this Kernel.
getWidth
()

Returns the width of this Kernel.

public final int

Returns:

the X origin.
getXOrigin
()

Returns the X origin of this Kernel.

public final int

Returns:

the Y origin.
getYOrigin
()

Returns the Y origin of this Kernel.

private static native void
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
private float[] data
heightback to summary
private int height
widthback to summary
private int width
xOriginback to summary
private int xOrigin
yOriginback to summary
private int yOrigin

Constructor Detail

Kernelback to summary
public Kernel(int width, int height, float[] data)

Constructs a Kernel object from an array of floats. The first width*height elements of the data array are copied. If the length of the data array is less than width*height, an IllegalArgumentException is thrown. The X origin is (width-1)/2 and the Y origin is (height-1)/2.

Parameters
width:int

width of the kernel

height:int

height of the kernel

data:float[]

kernel data in row major order

Exceptions
NullPointerException:
if data is null
IllegalArgumentException:
  • if width or height is not positive
  • if product of width and height overflows an int
  • if the length of data is less than the product of width and height

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Clones this object.

Returns:Object

a clone of this object.

getHeightback to summary
public final int getHeight()

Returns the height of this Kernel.

Returns:int

the height of this Kernel.

getKernelDataback to summary
public final float[] getKernelData(float[] data)

Returns the kernel data in row major order. The data array is returned. If data is null, a new array is allocated.

Parameters
data:float[]

if non-null, contains the returned kernel data

Returns:float[]

the data array containing the kernel data in row major order or, if data is null, a newly allocated array containing the kernel data in row major order

Exceptions
IllegalArgumentException:
if data is less than the size of this Kernel
getWidthback to summary
public final int getWidth()

Returns the width of this Kernel.

Returns:int

the width of this Kernel.

getXOriginback to summary
public final int getXOrigin()

Returns the X origin of this Kernel.

Returns:int

the X origin.

getYOriginback to summary
public final int getYOrigin()

Returns the Y origin of this Kernel.

Returns:int

the Y origin.

initIDsback to summary
private static native void initIDs()