Package ij.gui
Class TextRoi
java.lang.Object
ij.gui.Roi
ij.gui.TextRoi
- All Implemented Interfaces:
Serializable
,Cloneable
This class is a rectangular ROI containing text.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
Fields inherited from class ij.gui.Roi
ANGLE, asp_bk, aspect, cachedMask, center, clipboard, clipHeight, clipWidth, clipX, clipY, COMPOSITE, constrain, CONSTRUCTING, fillColor, FREELINE, FREEROI, HANDLE_SIZE, handleColor, ic, ignoreClipRect, imp, instanceColor, LINE, lineWidth, mag, MOVING, MOVING_HANDLE, nonScalable, NORMAL, NOT_PASTING, oldHeight, oldWidth, oldX, oldY, onePixelWide, OVAL, overlay, pasteMode, POINT, POLYGON, POLYLINE, previousRoi, RECTANGLE, RESIZING, ROIColor, stroke, strokeColor, TRACED_ROI, type, updateFullWindow, wideLine, xMax, yMax
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a TextRoi using the specified location, size and Font.Creates a TextRoi using sub-pixel coordinates.Creates a TextRoi using the specified sub-pixel location and Font.Creates a TextRoi.Creates a TextRoi using the specified location and Font.Deprecated.Use this constructor as a drop-in replacement for ImageProcessor.drawString(). -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChar
(char c) This method is used by the text tool to add typed characters to displayed text selections.void
clear
(ImageProcessor ip) clone()
Returns a copy of this TextRoi.void
Draws the text on the screen, clipped to the ROI.void
void
Renders the text on the image.double
getAngle()
Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle).boolean
Returns the state of the 'antialiased' instance variable.Returns the current (instance) font.boolean
static String
getFont()
Returns the name of the global (default) font.static int
Returns the global (default) justification (LEFT, CENTER or RIGHT).int
Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT).getMacroCode
(String cmd, ImagePlus imp) Used by the Recorder for recording the text tool.static int
getSize()
Returns the global (default) font size.static int
getStyle()
Returns the global (default) font style.getText()
protected void
handleMouseUp
(int screenX, int screenY) static boolean
Returns the state of global 'antialiasedText' variable, which is used by the "Fonts" widget.boolean
Returns 'true' if this is an ROI primarily used from drawing (e.g., TextRoi or Arrow).void
setAngle
(double angle) void
setAntialiased
(boolean antialiased) Sets the 'antialiased' instance variable.void
setCurrentFont
(Font font) Set the current (instance) font.static void
setDefaultAngle
(double angle) Sets the default angle.static void
setDefaultFillColor
(Color fillColor) Sets the default fill (background) color.void
setDrawStringMode
(boolean drawStringMode) static void
Sets the global font face, size and style that will be used by TextROIs interactively created using the text tool.static void
Sets the font face, size, style and antialiasing mode that will be used by TextROIs interactively created using the text tool.static void
setGlobalJustification
(int justification) Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)void
setJustification
(int justification) Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT)Methods inherited from class ij.gui.Roi
abortPaste, addRoiListener, clipRectMargin, contains, copyAttributes, drawPixels, enableSubPixelResolution, endPaste, equals, getAngle, getBoundingRect, getBounds, getColor, getContourCentroid, getConvexHull, getCornerDiameter, getCPosition, getCurrentPasteMode, getDebugInfo, getDefaultFillColor, getDrawOffset, getFeretsDiameter, getFeretValues, getFillColor, getFloatAngle, getFloatBounds, getFloatHeight, getFloatPolygon, getFloatWidth, getHashCode, getImage, getImageID, getInterpolatedPolygon, getInterpolatedPolygon, getInterpolatedPolygon, getLength, getMagnification, getMask, getName, getPasteMode, getPolygon, getPosition, getProperties, getProperty, getPropertyCount, getPrototypeOverlay, getRotationCenter, getRoundRectArcSize, getScaledStroke, getState, getStatistics, getStroke, getStrokeColor, getStrokeWidth, getTPosition, getType, getTypeAsString, getXBase, getYBase, getZPosition, grow, handleMouseDown, handleMouseDrag, isActiveOverlayRoi, isArea, isCursor, isHandle, isLine, isVisible, lineCircleIntersection, mouseDownInHandle, mouseDragged, mouseMoved, mouseReleased, moveHandle, notifyListeners, nudge, nudgeCorner, removeRoiListener, screenX, screenXD, screenY, screenYD, setColor, setCornerDiameter, setDrawOffset, setFillColor, setIgnoreClipRect, setImage, setInstanceColor, setIsCursor, setLineWidth, setLocation, setLocation, setName, setNonScalable, setPasteMode, setPosition, setPosition, setProperties, setProperty, setPrototypeOverlay, setRotationCenter, setRoundRectArcSize, setStroke, setStrokeColor, setStrokeWidth, setStrokeWidth, showStatus, startPaste, subPixelResolution, temporarilyHide, toFloat, toInt, toInt, toIntR, toString, update, updateClipRect, updateWideLine
-
Field Details
-
LEFT
public static final int LEFT- See Also:
-
CENTER
public static final int CENTER- See Also:
-
RIGHT
public static final int RIGHT- See Also:
-
-
Constructor Details
-
TextRoi
Creates a TextRoi. -
TextRoi
Use this constructor as a drop-in replacement for ImageProcessor.drawString(). -
TextRoi
Creates a TextRoi using sub-pixel coordinates. -
TextRoi
Creates a TextRoi using the specified location and Font. -
TextRoi
Creates a TextRoi using the specified sub-pixel location and Font. -
TextRoi
Creates a TextRoi using the specified location, size and Font. public TextRoi(int x, int y, int width, int height, String text, Font font) { super(x, y, width, height); init(text, font); } /** Creates a TextRoi using the specified sub-pixel location, size and Font. -
TextRoi
Deprecated. -
TextRoi
-
-
Method Details
-
addChar
public void addChar(char c) This method is used by the text tool to add typed characters to displayed text selections. -
drawPixels
Renders the text on the image.- Overrides:
drawPixels
in classRoi
- See Also:
-
draw
Draws the text on the screen, clipped to the ROI. -
drawOverlay
- Overrides:
drawOverlay
in classRoi
-
getFont
Returns the name of the global (default) font. -
getSize
public static int getSize()Returns the global (default) font size. -
getStyle
public static int getStyle()Returns the global (default) font style. -
setCurrentFont
Set the current (instance) font. -
getCurrentFont
Returns the current (instance) font. -
isAntialiased
public static boolean isAntialiased()Returns the state of global 'antialiasedText' variable, which is used by the "Fonts" widget. -
setAntialiased
public void setAntialiased(boolean antialiased) Sets the 'antialiased' instance variable. -
getAntialiased
public boolean getAntialiased()Returns the state of the 'antialiased' instance variable. -
setGlobalJustification
public static void setGlobalJustification(int justification) Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT) -
getGlobalJustification
public static int getGlobalJustification()Returns the global (default) justification (LEFT, CENTER or RIGHT). -
setJustification
public void setJustification(int justification) Sets the 'justification' instance variable (must be LEFT, CENTER or RIGHT) -
getJustification
public int getJustification()Returns the value of the 'justification' instance variable (LEFT, CENTER or RIGHT). -
setFont
Sets the global font face, size and style that will be used by TextROIs interactively created using the text tool. -
setFont
Sets the font face, size, style and antialiasing mode that will be used by TextROIs interactively created using the text tool. -
setDefaultFillColor
Sets the default fill (background) color. -
setDefaultAngle
public static void setDefaultAngle(double angle) Sets the default angle. -
handleMouseUp
protected void handleMouseUp(int screenX, int screenY) - Overrides:
handleMouseUp
in classRoi
-
getMacroCode
Used by the Recorder for recording the text tool. -
getText
-
isDrawingTool
public boolean isDrawingTool()Description copied from class:Roi
Returns 'true' if this is an ROI primarily used from drawing (e.g., TextRoi or Arrow).- Overrides:
isDrawingTool
in classRoi
-
clear
-
clone
Returns a copy of this TextRoi. -
getAngle
public double getAngle()Description copied from class:Roi
Overridden by PolygonRoi (angle between first two points), TextRoi (text angle) and Line (line angle). -
setAngle
public void setAngle(double angle) -
getDrawStringMode
public boolean getDrawStringMode() -
setDrawStringMode
public void setDrawStringMode(boolean drawStringMode)
-