public abstract class AbstractAnnotation extends Object implements OverlayedImageCanvas.Overlay
OverlayedImageCanvas
.
This simple class offer facilities to specify the Color
, Composite
and
Stroke
that will be used to draw the annotation. There is a simple method to implement:
draw(Graphics2D)
, that receive a Graphics2D
that will paint the annotation
in image coordinates, so that the annotation "follows" the image when its display canvas
is panned or zoomed in/out.
OverlayedImageCanvas
,
OverlayedImageCanvas.Overlay
Modifier and Type | Field and Description |
---|---|
protected Color |
color |
protected Composite |
composite |
protected Stroke |
stroke |
Constructor and Description |
---|
AbstractAnnotation() |
Modifier and Type | Method and Description |
---|---|
abstract void |
draw(Graphics2D g2d)
Draw this annotation on the
OverlayedImageCanvas . |
void |
paint(Graphics g,
int x,
int y,
double magnification)
Paint this overlay on the given graphic device.
|
void |
setColor(Color color) |
void |
setComposite(Composite composite)
Set the composite that will be used to paint this overlay.
|
void |
setStroke(Stroke stroke) |
protected Composite composite
protected Color color
protected Stroke stroke
public void paint(Graphics g, int x, int y, double magnification)
OverlayedImageCanvas.Overlay
paint
in interface OverlayedImageCanvas.Overlay
g
- the graphic device provided by the OverlayedImageCanvas
x
- the top-left corner x-coordinate of the image rectangle currently displayed in the OverlayedImageCanvas
y
- the top-left corner y-coordinatemagnification
- the OverlayedImageCanvas
current magnificationpublic void setComposite(Composite composite)
OverlayedImageCanvas.Overlay
setComposite
in interface OverlayedImageCanvas.Overlay
public void setColor(Color color)
public void setStroke(Stroke stroke)
public abstract void draw(Graphics2D g2d)
OverlayedImageCanvas
.
The Graphics2D
received in argument is transformed so that drawing is made
in image coordinates (taking into account image magnification and panning), and
its color, stroke and composite are set with the fields of this annotation.
When this method returns, the graphic device has its original settings restored.
g2d
- the transformed graphic device to draw withCopyright © 2015–2021 Fiji. All rights reserved.