com.anji.imaging
Interface Surface

All Superinterfaces:
Configurable
All Known Implementing Classes:
Java2DSurface, JMagickSurface

public interface Surface
extends Configurable

A Surface is a 2d array of int values. It is an abstraction of an image or game board allowing the floating eye to access it without knowing details. Surface objects implementing this interface should not be used until setImage() has been called. setImage() should reset the image pixels, but not the size of the image, so the same object can be used for multiple images. Size of surface is set via properties - if size is not set via properties, defaults to size of first image set via setImage().


Field Summary
static java.lang.String SURFACE_HEIGHT_KEY
          final size of surface to which images will be scaled
static java.lang.String SURFACE_WIDTH_KEY
          final size of surface to which images will be scaled
static java.lang.String TRANSFORMER_CLASS_KEY
          class to perform image transformation; subclass of BufferedImageTransformer
 
Method Summary
 int[] getData()
           
 int getHeight()
           
 int getValue(int x, int y)
           
 int getWidth()
           
 void setImage(java.io.File file)
          Set source data of image.
 int[] transform(TransformParameters parms)
          transform image via translate, rotate, scale, crop
 
Methods inherited from interface com.anji.util.Configurable
init
 

Field Detail

TRANSFORMER_CLASS_KEY

public static final java.lang.String TRANSFORMER_CLASS_KEY
class to perform image transformation; subclass of BufferedImageTransformer

See Also:
Constant Field Values

SURFACE_WIDTH_KEY

public static final java.lang.String SURFACE_WIDTH_KEY
final size of surface to which images will be scaled

See Also:
Constant Field Values

SURFACE_HEIGHT_KEY

public static final java.lang.String SURFACE_HEIGHT_KEY
final size of surface to which images will be scaled

See Also:
Constant Field Values
Method Detail

setImage

public void setImage(java.io.File file)
              throws java.io.IOException
Set source data of image. The image file is scaled (using area averaging) to surface size.

Parameters:
file -
Throws:
java.io.IOException

transform

public int[] transform(TransformParameters parms)
transform image via translate, rotate, scale, crop

Parameters:
parms -
Returns:
transformed image flattened into 1D array

getData

public int[] getData()
Returns:
source image

getWidth

public int getWidth()
Returns:
width of source image

getHeight

public int getHeight()
Returns:
height of source image

getValue

public int getValue(int x,
                    int y)
Parameters:
x -
y -
Returns:
value of pixel at location x,y