us.zuercher.gpx2map.image.generic
Class GenericImage

java.lang.Object
  extended by us.zuercher.gpx2map.image.generic.GenericImage
All Implemented Interfaces:
Image

public class GenericImage
extends Object
implements Image

GenericImage is an image loaded by the GenericImageFactory.

Author:
Stephan Zuercher

Field Summary
private  int currentRasterLine
          Current raster line for getNextRasterLine().
private  boolean hasAlphaChannel
          Alpha channel flag.
private  int height
          Image height.
private  int[][][] raster
          Raster data.
private  int width
          Image width.
 
Constructor Summary
GenericImage(int[][][] raster, boolean hasAlphaChannel)
          Constructs a new GenericImage.
 
Method Summary
 void close()
          Closes the series of raster lines for this image.
 int getDepth()
          Returns the raster depth of this image.
 int getHeight()
          Returns the height of this image.
 int[][] getNextRasterLine()
          Returns the next raster line for this image.
 int[][][] getRaster()
          Returns the raster for this image.
 int getWidth()
          Returns the width of this image.
 boolean hasAlphaChannel()
          Returns whether this image has an alpha channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

private final int width
Image width.


height

private final int height
Image height.


raster

private final int[][][] raster
Raster data.


hasAlphaChannel

private final boolean hasAlphaChannel
Alpha channel flag.


currentRasterLine

private int currentRasterLine
Current raster line for getNextRasterLine().

Constructor Detail

GenericImage

GenericImage(int[][][] raster,
             boolean hasAlphaChannel)
Constructs a new GenericImage.

Parameters:
raster - raster data
hasAlphaChannel - alpha channel flag
Method Detail

hasAlphaChannel

public boolean hasAlphaChannel()
Returns whether this image has an alpha channel.

Specified by:
hasAlphaChannel in interface Image
Returns:
true if this image has an alpha channel.

getWidth

public int getWidth()
Returns the width of this image.

Specified by:
getWidth in interface Image
Returns:
the width of this image.

getHeight

public int getHeight()
Returns the height of this image.

Specified by:
getHeight in interface Image
Returns:
the height of this image.

getDepth

public int getDepth()
Returns the raster depth of this image. Always 3 or 4, depending on the presence of the alpha channel.

Specified by:
getDepth in interface Image
Returns:
raster depth of this image

getRaster

public int[][][] getRaster()
Returns the raster for this image.

Specified by:
getRaster in interface Image
Returns:
the raster for this image.

getNextRasterLine

public int[][] getNextRasterLine()
Returns the next raster line for this image. Use this method and close() or getRaster(), but do not combine calls to this method and getRaster().

Specified by:
getNextRasterLine in interface Image
Returns:
the next raster line of this image or null if EOF

close

public void close()
Closes the series of raster lines for this image.

Specified by:
close in interface Image