Class Kernel
- java.lang.Object
-
- java.awt.image.Kernel
- All Implemented Interfaces:
Cloneable
public class Kernel extends Object implements Cloneable
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
Constructors
Constructor | Description |
---|---|
Kernel(int width,
int height,
float[] data) | Constructs a |
Methods
Modifier and Type | Method | Description |
---|---|---|
Object | clone() | Clones this object. |
int | getHeight() | Returns the height of this |
float[] | getKernelData(float[] data) | Returns the kernel data in row major order. |
int | getWidth() | Returns the width of this |
int | getXOrigin() | Returns the X origin of this |
int | getYOrigin() | Returns the Y origin of this |
Methods declared in class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructors
Kernel
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
- width of the kernel -
height
- height of the kernel -
data
- kernel data in row major order - Throws:
-
IllegalArgumentException
- if the length ofdata
is less than the product ofwidth
andheight
Methods
getXOrigin
public final int getXOrigin()
Returns the X origin of this Kernel
.
- Returns:
- the X origin.
getYOrigin
public final int getYOrigin()
Returns the Y origin of this Kernel
.
- Returns:
- the Y origin.
getWidth
public final int getWidth()
Returns the width of this Kernel
.
- Returns:
- the width of this
Kernel
.
getHeight
public final int getHeight()
Returns the height of this Kernel
.
- Returns:
- the height of this
Kernel
.
getKernelData
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
- if non-null, contains the returned kernel data - Returns:
- the
data
array containing the kernel data in row major order or, ifdata
isnull
, a newly allocated array containing the kernel data in row major order - Throws:
-
IllegalArgumentException
- ifdata
is less than the size of thisKernel
clone
public Object clone()
Clones this object.
© 1993, 2020, 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/11/docs/api/java.desktop/java/awt/image/Kernel.html