Class PixelMarkerOverlay
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.
Author Kazo Csaba
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Sets the color of the marker circles.void
Sets the argument as the only point marked by this overlay.void
Sets the marked pixels.void
setSize
(int newSize) Sets the size of the circle.Methods inherited from class org.loboevolution.img.Overlay
addOverlayComponent, removeOverlayComponent, repaint
-
Constructor Details
-
PixelMarkerOverlay
public PixelMarkerOverlay()
-
-
Method Details
-
setSize
public void setSize(int newSize) Sets the size of the circle. The actual width and height of the circle will be2*newSize+1
.- Parameters:
newSize
- the new size of the marker circles- Throws:
IllegalArgumentException
- ifnewSize
is negative
-
setColor
Sets the color of the marker circles.- Parameters:
color
- the new color- Throws:
NullPointerException
- in case of error ifcolor
isnull
-
addPoint
Adds a point to the list of pixels marked by this overlay.- Parameters:
p
- a new point- Throws:
NullPointerException
- in case of error ifp
isnull
-
setPoint
Sets the argument as the only point marked by this overlay.- Parameters:
p
- the point to mark; ifnull
, then no points will be selected
-
setPoints
Sets the marked pixels.- Parameters:
points
- an iterable of all the pixels that should be selected- Throws:
NullPointerException
- in case of error ifpoints
or any individual point isnull
-
clear
public void clear()Removes all pixels from the overlay, clearing the selection. -
paint
Called to paint the contents of this overlay. The graphics context to paint on is a copy for this overlay and can be freely modified.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.
-