Class ContourPlot.CharacterAtlas

java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.CharacterAtlas
Enclosing class:
ContourPlot

public static class ContourPlot.CharacterAtlas extends Object
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 ContourPlot.CharacterAtlas is defined by:
  • its font size
  • its font style (PLAIN, ITALIC, BOLD, BOLD|ITALIC)
The font used is Ubuntu Mono which is a monospaced font, which can be accessed through the 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)
method. A
invalid reference
VertexArray
with 2D vertices on the first attribute and 2D texture coordinates on the second can be retrieved for a specified string using
invalid reference
CharacterAtlas#createVAforString(String, VertexArray)
.
Author:
hageldave
  • Field Details

  • Constructor Details

    • CharacterAtlas

      public CharacterAtlas()
  • Method Details

    • boundsForText

      public static Rectangle2D boundsForText(int textlength, int fontSize, int style)
      Calls boundsForText(int, Font) with corresponding Ubuntu Mono font.
      Parameters:
      textlength - number of characters
      fontSize - point size of the font
      style - of the font e.g. Font.PLAIN.
      Returns:
      bounding rectangle for a text of specified length and font.
    • boundsForText

      public static Rectangle2D boundsForText(int textlength, Font font)
      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 characters
      font - to measure with (has to be monospaced, or else bounds will be incorrect)
      Returns:
      bounding rectangle for a text of specified length and font.