Package uk.ac.starlink.ttools.plot
Class BitSetPixellator
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.BitSetPixellator
-
- All Implemented Interfaces:
Pixellator
public class BitSetPixellator extends java.lang.Object implements Pixellator
Pixellator built on a bit vector.- Since:
- 23 Aug 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description BitSetPixellator(java.awt.Rectangle bounds, java.util.BitSet mask)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BitSetPixellator
copy(Pixellator pixer)
Creates a new pixellator with the same content as an existing one.java.awt.Rectangle
getBounds()
Returns a copy of the bounding rectangle for this pixellator.int
getX()
Returns the X value for the current point.int
getY()
Returns the Y value for the current point.boolean
next()
Moves to the next point in the sequence.void
start()
Makes this object ready to iterate.
-
-
-
Constructor Detail
-
BitSetPixellator
public BitSetPixellator(java.awt.Rectangle bounds, java.util.BitSet mask)
Constructor. Point(x,y)
of the pixellator is represented by mask index(x-bounds.x) + bounds.width * (y-bounds.y)
.- Parameters:
bounds
- bounds of this pixellatormask
- bit vector with a point set for each filled in pixel
-
-
Method Detail
-
getBounds
public java.awt.Rectangle getBounds()
Description copied from interface:Pixellator
Returns a copy of the bounding rectangle for this pixellator. All points iterated over by this object will fall within this rectangle. If this object has no points,null
may be returned.- Specified by:
getBounds
in interfacePixellator
- Returns:
- bounds
-
start
public void start()
Description copied from interface:Pixellator
Makes this object ready to iterate. Should be called before any call toPixellator.next()
.- Specified by:
start
in interfacePixellator
-
next
public boolean next()
Description copied from interface:Pixellator
Moves to the next point in the sequence. Must be called before any call toPixellator.getX()
/Pixellator.getY()
. Returns value indicates whether there is a next point.- Specified by:
next
in interfacePixellator
- Returns:
- next true iff there are more points
-
getX
public int getX()
Description copied from interface:Pixellator
Returns the X value for the current point.- Specified by:
getX
in interfacePixellator
- Returns:
- x
-
getY
public int getY()
Description copied from interface:Pixellator
Returns the Y value for the current point.- Specified by:
getY
in interfacePixellator
- Returns:
- y
-
copy
public static BitSetPixellator copy(Pixellator pixer)
Creates a new pixellator with the same content as an existing one. The bounds of the new one are derived from the actual limits of the pixels in the input, so may differ from those reported by thegetBounds
method of the input.- Parameters:
pixer
- pixellator to copy- Returns:
- clone
-
-