public final class PixelMarkerOverlay extends Overlay
The default size is 5 pixels and the default color is red.
This object stores the list of pixels; this list can be edited with the setPoint(Point),
setPoints(Iterable), addPoint(Point), and clear() functions. All of these
mutator functions cause the overlay to be repainted.
| Constructor and Description |
|---|
PixelMarkerOverlay() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPoint(Point p)
Adds a point to the list of pixels marked by this overlay.
|
void |
clear()
Removes all pixels from the overlay, clearing the selection.
|
void |
paint(Graphics2D g,
BufferedImage image,
AffineTransform transform)
Called to paint the contents of this overlay.
|
void |
setColor(Color color)
Sets the color of the marker circles.
|
void |
setPoint(Point p)
Sets the argument as the only point marked by this overlay.
|
void |
setPoints(Iterable<Point> points)
Sets the marked pixels.
|
void |
setSize(int newSize)
Sets the size of the circle.
|
public void setSize(int newSize)
2*newSize+1.newSize - the new size of the marker circlesIllegalArgumentException - if newSize is negativepublic void setColor(Color color)
color - the new colorNullPointerException - if color is nullpublic void addPoint(Point p)
p - a new pointNullPointerException - if p is nullpublic void setPoint(Point p)
p - the point to mark; if null, then no points will be selectedpublic void setPoints(Iterable<Point> points)
points - an iterable of all the pixels that should be selectedNullPointerException - if points or any individual point is nullpublic void clear()
public void paint(Graphics2D g, BufferedImage image, AffineTransform transform)
Overlay
The method receives the currently displayed image. The image is never null -
if there is currently no image being displayed in the image viewer, then the
paint method is not called.
This method also receives the transformation that is applied to the image before it is displayed. This transformation is most commonly the concatenation of a uniform scale and a translation. The original image bounds (0, 0) - (image.getWidth(), image.getHeight()) are mapped using this transformation to get the final display bounds. The overlay should not rely on whether painting outside these final bounds will be visible or not.
Copyright © 2012. All Rights Reserved.