us.zuercher.gpx2map.plotter
Class ImageShape

java.lang.Object
  extended by us.zuercher.gpx2map.plotter.AbstractShape
      extended by us.zuercher.gpx2map.plotter.ImageShape

public class ImageShape
extends AbstractShape

ImageShape extends AbstractShape to render the contents of an image during plotting. By accepting an array of raster line data in the constructor, a single ImageMarkerStyle or other image-based MarkerStyle can create many ImageShapes that share references to the same image data.

Author:
Stephan Zuercher

Field Summary
private  Point center
          Center point of the rendered ImageShape.
private  boolean hasAlpha
          Alpha channel flag.
private  int height
          Image height, computed from rasterLines.
private  int[][][] rasterLines
          Image raster data.
private  int startingRow
          Starting row of image data.
private  int width
          Image width, computed from rasterLines.
 
Fields inherited from class us.zuercher.gpx2map.plotter.AbstractShape
pixelsByRow, zOrdering
 
Constructor Summary
ImageShape(int[][][] rasterLines, boolean hasAlpha, Point center)
          Constructs a new ImageShape.
 
Method Summary
 void computePixels(Dimension bounds)
          Computes the pixels necessary to draw this shape.
 int startDrawingRow()
          Returns the starting row of image data.
 
Methods inherited from class us.zuercher.gpx2map.plotter.AbstractShape
getPixelRowIterator, getZOrdering, setZOrdering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rasterLines

private int[][][] rasterLines
Image raster data.


width

private final int width
Image width, computed from rasterLines.


height

private final int height
Image height, computed from rasterLines.


hasAlpha

private final boolean hasAlpha
Alpha channel flag.


center

private final Point center
Center point of the rendered ImageShape.


startingRow

private final int startingRow
Starting row of image data. Computed from height and center.

Constructor Detail

ImageShape

public ImageShape(int[][][] rasterLines,
                  boolean hasAlpha,
                  Point center)
Constructs a new ImageShape. The data in rasterLines is never modified and may be safely reused for another ImageShape.

The dimensios of rasterLines is [height][width][depth], where depth is 3 when hasAlpha is false and 4 if hasAlpha is true.

Parameters:
rasterLines - image data
hasAlpha - alpha channel flag
center - center point of rendered image
Method Detail

computePixels

public void computePixels(Dimension bounds)
Computes the pixels necessary to draw this shape.

Specified by:
computePixels in class AbstractShape
Parameters:
bounds - the image dimensions
See Also:
AbstractShape.computePixels(Dimension)

startDrawingRow

public int startDrawingRow()
Returns the starting row of image data.

Specified by:
startDrawingRow in class AbstractShape
Returns:
the starting row of image data.
See Also:
AbstractShape.startDrawingRow()