Package com.jhlabs.math
Class ImageFunction2D
- java.lang.Object
-
- com.jhlabs.math.ImageFunction2D
-
- All Implemented Interfaces:
Function2D
public class ImageFunction2D extends java.lang.Object implements Function2D
-
-
Constructor Summary
Constructors Constructor Description ImageFunction2D(int[] pixels, int width, int height, int edgeAction, boolean alpha)
ImageFunction2D(java.awt.Image image)
ImageFunction2D(java.awt.image.BufferedImage image)
ImageFunction2D(java.awt.image.BufferedImage image, boolean alpha)
ImageFunction2D(java.awt.image.BufferedImage image, int edgeAction, boolean alpha)
ImageFunction2D(java.awt.Image image, int edgeAction, boolean alpha)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
evaluate(float x, float y)
Evaluate the pixel and the x and y values according to the edge action.int
getEdgeAction()
Get the edgeAction.int
getHeight()
Get the height.int[]
getPixels()
Get the pixels.int[]
getRGB(java.awt.image.BufferedImage image, int x, int y, int width, int height, int[] pixels)
A convenience method for getting ARGB pixels from an image.int
getWidth()
Get the width.void
init(int[] pixels, int width, int height, int edgeAction, boolean alpha)
Initialize an image.void
setEdgeAction(int edgeAction)
Set the edgeAction.
-
-
-
Field Detail
-
ZERO
public static final int ZERO
- See Also:
- Constant Field Values
-
CLAMP
public static final int CLAMP
- See Also:
- Constant Field Values
-
WRAP
public static final int WRAP
- See Also:
- Constant Field Values
-
pixels
protected int[] pixels
-
width
protected int width
-
height
protected int height
-
edgeAction
protected int edgeAction
-
alpha
protected boolean alpha
-
-
Constructor Detail
-
ImageFunction2D
public ImageFunction2D(java.awt.image.BufferedImage image)
-
ImageFunction2D
public ImageFunction2D(java.awt.image.BufferedImage image, boolean alpha)
-
ImageFunction2D
public ImageFunction2D(java.awt.image.BufferedImage image, int edgeAction, boolean alpha)
-
ImageFunction2D
public ImageFunction2D(int[] pixels, int width, int height, int edgeAction, boolean alpha)
-
ImageFunction2D
public ImageFunction2D(java.awt.Image image)
-
ImageFunction2D
public ImageFunction2D(java.awt.Image image, int edgeAction, boolean alpha)
-
-
Method Detail
-
getRGB
public int[] getRGB(java.awt.image.BufferedImage image, int x, int y, int width, int height, int[] pixels)
A convenience method for getting ARGB pixels from an image. This tries to avoid the performance penalty of BufferedImage.getRGB unmanaging the image.- Parameters:
image
- The imagex
- The x value of the pixel in one of the cornersy
- The y value of the pixel in one of the cornerswidth
- The width of the pixels to getheight
- The height of the pixels to getpixels
- The image- Returns:
- The subimage
-
init
public void init(int[] pixels, int width, int height, int edgeAction, boolean alpha)
Initialize an image.- Parameters:
pixels
- The imagewidth
- The width of the pixels to getheight
- The height of the pixels to getedgeAction
- The edgeAction, one of ZERO, CLAMP or WRAP.alpha
- The alpha
-
evaluate
public float evaluate(float x, float y)
Evaluate the pixel and the x and y values according to the edge action.- Specified by:
evaluate
in interfaceFunction2D
- Parameters:
x
- The x valuey
- The y value- Returns:
- The value
-
setEdgeAction
public void setEdgeAction(int edgeAction)
Set the edgeAction.- Parameters:
edgeAction
- one of ZERO, CLAMP or WRAP.- See Also:
getEdgeAction()
-
getEdgeAction
public int getEdgeAction()
Get the edgeAction.- Returns:
- The edgeAction, one of ZERO, CLAMP or WRAP.
- See Also:
setEdgeAction(int)
-
getWidth
public int getWidth()
Get the width.- Returns:
- The width
-
getHeight
public int getHeight()
Get the height.- Returns:
- the height
-
getPixels
public int[] getPixels()
Get the pixels.- Returns:
- the pixels.
-
-