Class JLaTeXMathCache

java.lang.Object
org.scilab.forge.jlatexmath.cache.JLaTeXMathCache

public final class JLaTeXMathCache extends Object
Class to cache generated image from formulas
Author:
Calixte DENIZET
  • Method Details

    • setMaxCachedObjects

      public static void setMaxCachedObjects(int max)
      Set max size. Take care the cache will be reinitialized
      Parameters:
      max - the max size
    • getCachedTeXFormulaDimensions

      public static int[] getCachedTeXFormulaDimensions(String f, int style, int type, int size, int inset, Color fgcolor) throws ParseException
      Parameters:
      f - a formula
      style - a style like TeXConstants.STYLE_DISPLAY
      size - the size of font
      inset - the inset to add on the top, bottom, left and right
      Returns:
      an array of length 3 containing width, height and depth
      Throws:
      ParseException
    • getCachedTeXFormulaDimensions

      public static int[] getCachedTeXFormulaDimensions(String f, int style, int size, int inset) throws ParseException
      Throws:
      ParseException
    • getCachedTeXFormulaDimensions

      public static int[] getCachedTeXFormulaDimensions(Object o) throws ParseException
      Parameters:
      o - an Object to identify the image in the cache
      Returns:
      an array of length 3 containing width, height and depth
      Throws:
      ParseException
    • getCachedTeXFormula

      public static Object getCachedTeXFormula(String f, int style, int type, int size, int inset, Color fgcolor) throws ParseException
      Get a cached formula
      Parameters:
      f - a formula
      style - a style like TeXConstants.STYLE_DISPLAY
      size - the size of font
      inset - the inset to add on the top, bottom, left and right
      Returns:
      the key in the map
      Throws:
      ParseException
    • getCachedTeXFormula

      public static Object getCachedTeXFormula(String f, int style, int size, int inset) throws ParseException
      Throws:
      ParseException
    • clearCache

      public static void clearCache()
      Clear the cache
    • removeCachedTeXFormula

      public static void removeCachedTeXFormula(String f, int style, int type, int size, int inset, Color fgcolor) throws ParseException
      Remove a formula from the cache
      Parameters:
      f - a formula
      style - a style like TeXConstants.STYLE_DISPLAY
      size - the size of font
      inset - the inset to add on the top, bottom, left and right
      Throws:
      ParseException
    • removeCachedTeXFormula

      public static void removeCachedTeXFormula(String f, int style, int size, int inset) throws ParseException
      Throws:
      ParseException
    • removeCachedTeXFormula

      public static void removeCachedTeXFormula(Object o) throws ParseException
      Remove a formula from the cache. Take care, remove the Object o, invalidate it !
      Parameters:
      o - an Object to identify the image in the cache
      Throws:
      ParseException
    • paintCachedTeXFormula

      public static Object paintCachedTeXFormula(String f, int style, int type, int size, int inset, Color fgcolor, Graphics2D g) throws ParseException
      Paint a cached formula
      Parameters:
      f - a formula
      style - a style like TeXConstants.STYLE_DISPLAY
      size - the size of font
      inset - the inset to add on the top, bottom, left and right
      Returns:
      the key in the map
      Throws:
      ParseException
    • paintCachedTeXFormula

      public static Object paintCachedTeXFormula(String f, int style, int size, int inset, Graphics2D g) throws ParseException
      Throws:
      ParseException
    • paintCachedTeXFormula

      public static Object paintCachedTeXFormula(Object o, Graphics2D g) throws ParseException
      Paint a cached formula
      Parameters:
      o - an Object to identify the image in the cache
      g - the graphics where to paint the image
      Returns:
      the key in the map
      Throws:
      ParseException
    • getCachedTeXFormulaImage

      public static Image getCachedTeXFormulaImage(String f, int style, int type, int size, int inset, Color fgcolor) throws ParseException
      Get a cached formula
      Parameters:
      f - a formula
      style - a style like TeXConstants.STYLE_DISPLAY
      size - the size of font
      inset - the inset to add on the top, bottom, left and right
      Returns:
      the cached image
      Throws:
      ParseException
    • getCachedTeXFormulaImage

      public static Image getCachedTeXFormulaImage(String f, int style, int size, int inset) throws ParseException
      Throws:
      ParseException
    • getCachedTeXFormulaImage

      public static Image getCachedTeXFormulaImage(Object o) throws ParseException
      Get a cached formula
      Parameters:
      o - an Object to identify the image in the cache
      Returns:
      the cached image
      Throws:
      ParseException