Class Kernel
java.lang.Object
java.awt.image.Kernel
- All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionKernel(int width, int height, float[] data) Constructs aKernelobject from an array of floats. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones this object.final intReturns the height of thisKernel.final float[]getKernelData(float[] data) Returns the kernel data in row major order.final intgetWidth()Returns the width of thisKernel.final intReturns the X origin of thisKernel.final intReturns the Y origin of thisKernel.Methods declared in class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionbooleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
Kernel
public Kernel(int width, int height, float[] data) Constructs aKernelobject from an array of floats. The firstwidth*heightelements of thedataarray are copied. If the length of thedataarray is less than width*height, anIllegalArgumentExceptionis thrown. The X origin is (width-1)/2 and the Y origin is (height-1)/2.- Parameters:
width- width of the kernelheight- height of the kerneldata- kernel data in row major order- Throws:
NullPointerException- ifdatais nullIllegalArgumentException- ifwidthorheightis not positiveIllegalArgumentException- if product ofwidthandheightoverflows an intIllegalArgumentException- if the length ofdatais less than the product ofwidthandheight
-
-
Method Details
-
getXOrigin
public final int getXOrigin()Returns the X origin of thisKernel.- Returns:
- the X origin.
-
getYOrigin
public final int getYOrigin()Returns the Y origin of thisKernel.- Returns:
- the Y origin.
-
getWidth
public final int getWidth()Returns the width of thisKernel.- Returns:
- the width of this
Kernel.
-
getHeight
public final int getHeight()Returns the height of thisKernel.- Returns:
- the height of this
Kernel.
-
getKernelData
public final float[] getKernelData(float[] data) Returns the kernel data in row major order. Thedataarray is returned. Ifdataisnull, a new array is allocated.- Parameters:
data- if non-null, contains the returned kernel data- Returns:
- the
dataarray containing the kernel data in row major order or, ifdataisnull, a newly allocated array containing the kernel data in row major order - Throws:
IllegalArgumentException- ifdatais less than the size of thisKernel
-
clone
-