com.jhlabs.math

Class ImageFunction2D

Implemented Interfaces:
Function2D

public class ImageFunction2D
extends java.lang.Object
implements Function2D

Field Summary

static int
CLAMP
static int
WRAP
static int
ZERO
protected boolean
alpha
protected int
edgeAction
protected int
height
protected int[]
pixels
protected int
width

Constructor Summary

ImageFunction2D(BufferedImage image)
ImageFunction2D(BufferedImage image, boolean alpha)
ImageFunction2D(BufferedImage image, int edgeAction, boolean alpha)
ImageFunction2D(Image image)
ImageFunction2D(Image image, int edgeAction, boolean alpha)
ImageFunction2D(int[] pixels, int width, int height, int edgeAction, boolean alpha)

Method Summary

float
evaluate(float x, float y)
int
getEdgeAction()
int
getHeight()
int[]
getPixels()
int[]
getRGB(BufferedImage image, int x, int y, int width, int height, int[] pixels)
A convenience method for getting ARGB pixels from an image.
int
getWidth()
void
init(int[] pixels, int width, int height, int edgeAction, boolean alpha)
void
setEdgeAction(int edgeAction)

Field Details

CLAMP

public static final int CLAMP
Field Value:
1

WRAP

public static final int WRAP
Field Value:
2

ZERO

public static final int ZERO
Field Value:
0

alpha

protected boolean alpha

edgeAction

protected int edgeAction

height

protected int height

pixels

protected int[] pixels

width

protected int width

Constructor Details

ImageFunction2D

public ImageFunction2D(BufferedImage image)

ImageFunction2D

public ImageFunction2D(BufferedImage image,
                       boolean alpha)

ImageFunction2D

public ImageFunction2D(BufferedImage image,
                       int edgeAction,
                       boolean alpha)

ImageFunction2D

public ImageFunction2D(Image image)

ImageFunction2D

public ImageFunction2D(Image image,
                       int edgeAction,
                       boolean alpha)

ImageFunction2D

public ImageFunction2D(int[] pixels,
                       int width,
                       int height,
                       int edgeAction,
                       boolean alpha)

Method Details

evaluate

public float evaluate(float x,
                      float y)
Specified by:
evaluate in interface Function2D

getEdgeAction

public int getEdgeAction()

getHeight

public int getHeight()

getPixels

public int[] getPixels()

getRGB

public int[] getRGB(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 - a BufferedImage object
x - the left edge of the pixel block
y - the right edge of the pixel block
width - the width of the pixel arry
height - the height of the pixel arry
pixels - the array to hold the returned pixels. May be null.
Returns:
the pixels
See Also:
ImageFunction2D

getWidth

public int getWidth()

init

public void init(int[] pixels,
                 int width,
                 int height,
                 int edgeAction,
                 boolean alpha)

setEdgeAction

public void setEdgeAction(int edgeAction)