Cloneable
public class Kernel extends Object implements Cloneable
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.Constructor | Description |
---|---|
Kernel |
Constructs a Kernel object from an array of floats. |
Modifier and Type | Method | Description |
---|---|---|
Object |
clone() |
Clones this object. |
final int |
getHeight() |
Returns the height of this Kernel . |
final float[] |
getKernelData |
Returns the kernel data in row major order. |
final int |
getWidth() |
Returns the width of this Kernel . |
final int |
getXOrigin() |
Returns the X origin of this Kernel . |
final int |
getYOrigin() |
Returns the Y origin of this Kernel . |
public Kernel(int width, int height, float[] data)
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.width
- width of the kernelheight
- height of the kerneldata
- kernel data in row major orderIllegalArgumentException
- if the length of data
is less than the product of width
and height
public final int getXOrigin()
Kernel
.public final int getYOrigin()
Kernel
.public final int getWidth()
Kernel
.Kernel
.public final int getHeight()
Kernel
.Kernel
.public final float[] getKernelData(float[] data)
data
array is returned. If data
is null
, a new array is allocated.data
- if non-null, contains the returned kernel datadata
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 orderIllegalArgumentException
- if data
is less than the size of this Kernel
public Object clone()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/image/Kernel.html