Package gov.nih.mipav.model.algorithms
Class ContourPlot.CharacterAtlas
java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.CharacterAtlas
- Enclosing class:
ContourPlot
The CharacterAtlas class is a texture atlas for looking up character textures.
That is a texture containing rendered characters at specific positions.
This is used to be able to render an arbitrary sequence of characters by looking up
the corresponding area in the texture.
A
method.
A
with 2D vertices on the first attribute and 2D texture coordinates
on the second can be retrieved for a specified string using
.
ContourPlot.CharacterAtlas is defined by:
- its font size
- its font style (PLAIN, ITALIC, BOLD, BOLD|ITALIC)
ContourPlot.FontProvider.
This implementation limits the possible characters to the ones listed in
ContourPlot.SignedDistanceCharacters.CHARACTERS.
Any other character will be mapped to white space and will thus be invisible in the
render.
To obtain a character atlas use the static
invalid reference
CharacterAtlas#get(int, int)
invalid reference
VertexArray
invalid reference
CharacterAtlas#createVAforString(String, VertexArray)
- Author:
- hageldave
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final HashMap<Integer, HashMap<ContourPlot.GenericKey, ContourPlot.CharacterAtlas>> protected static final floatprivate static final char[]intintprotected static final ContourPlot.Imgintprotected static final floatintprotected static final floatintprotected intprotected static final float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Rectangle2DboundsForText(int textlength, int fontSize, int style) CallsboundsForText(int, Font)with corresponding Ubuntu Mono font.static Rectangle2DboundsForText(int textlength, Font font) Calculates the bounding rectangle for a specific number of characters in the specified font.
-
Field Details
-
CHARACTERS
private static final char[] CHARACTERS -
FONTMETRIC_IMG
-
ATLAS_COLLECTION
protected static final HashMap<Integer,HashMap<ContourPlot.GenericKey, ATLAS_COLLECTIONContourPlot.CharacterAtlas>> -
CONTEXT_2_STYLE_2_TEXTUREREF
-
leftPaddingFactor
protected static final float leftPaddingFactor- See Also:
-
rightPaddingFactor
protected static final float rightPaddingFactor- See Also:
-
topPaddingFactor
protected static final float topPaddingFactor- See Also:
-
botPaddingFactor
protected static final float botPaddingFactor- See Also:
-
font
-
charWidth
public int charWidth -
charHeigth
public int charHeigth -
fontSize
public int fontSize -
style
public int style -
owningCanvasID
public int owningCanvasID -
texID
protected int texID -
sdChars
-
-
Constructor Details
-
CharacterAtlas
public CharacterAtlas()
-
-
Method Details
-
boundsForText
CallsboundsForText(int, Font)with corresponding Ubuntu Mono font.- Parameters:
textlength- number of charactersfontSize- point size of the fontstyle- of the font e.g.Font.PLAIN.- Returns:
- bounding rectangle for a text of specified length and font.
-
boundsForText
Calculates the bounding rectangle for a specific number of characters in the specified font. The returned bounds are baseline relative which means that the origin may have a negative y coordinate that is the distance of the descent line from the baseline.- Parameters:
textlength- number of charactersfont- to measure with (has to be monospaced, or else bounds will be incorrect)- Returns:
- bounding rectangle for a text of specified length and font.
-