Class JLaTeXMathCache
- java.lang.Object
-
- org.scilab.forge.jlatexmath.cache.JLaTeXMathCache
-
public final class JLaTeXMathCache extends java.lang.Object
Class to cache generated image from formulas- Author:
- Calixte DENIZET
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearCache()
Clear the cachestatic java.lang.Object
getCachedTeXFormula(java.lang.String f, int style, int size, int inset)
static java.lang.Object
getCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
Get a cached formulastatic int[]
getCachedTeXFormulaDimensions(java.lang.Object o)
static int[]
getCachedTeXFormulaDimensions(java.lang.String f, int style, int size, int inset)
static int[]
getCachedTeXFormulaDimensions(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
static java.awt.Image
getCachedTeXFormulaImage(java.lang.Object o)
Get a cached formulastatic java.awt.Image
getCachedTeXFormulaImage(java.lang.String f, int style, int size, int inset)
static java.awt.Image
getCachedTeXFormulaImage(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
Get a cached formulastatic java.lang.Object
paintCachedTeXFormula(java.lang.Object o, java.awt.Graphics2D g)
Paint a cached formulastatic java.lang.Object
paintCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor, java.awt.Graphics2D g)
Paint a cached formulastatic java.lang.Object
paintCachedTeXFormula(java.lang.String f, int style, int size, int inset, java.awt.Graphics2D g)
static void
removeCachedTeXFormula(java.lang.Object o)
Remove a formula from the cache.static void
removeCachedTeXFormula(java.lang.String f, int style, int size, int inset)
static void
removeCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
Remove a formula from the cachestatic void
setMaxCachedObjects(int max)
Set max size.
-
-
-
Method Detail
-
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(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor) throws ParseException
- Parameters:
f
- a formulastyle
- a style like TeXConstants.STYLE_DISPLAYsize
- the size of fontinset
- 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(java.lang.String f, int style, int size, int inset) throws ParseException
- Throws:
ParseException
-
getCachedTeXFormulaDimensions
public static int[] getCachedTeXFormulaDimensions(java.lang.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 java.lang.Object getCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor) throws ParseException
Get a cached formula- Parameters:
f
- a formulastyle
- a style like TeXConstants.STYLE_DISPLAYsize
- the size of fontinset
- the inset to add on the top, bottom, left and right- Returns:
- the key in the map
- Throws:
ParseException
-
getCachedTeXFormula
public static java.lang.Object getCachedTeXFormula(java.lang.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(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor) throws ParseException
Remove a formula from the cache- Parameters:
f
- a formulastyle
- a style like TeXConstants.STYLE_DISPLAYsize
- the size of fontinset
- the inset to add on the top, bottom, left and right- Throws:
ParseException
-
removeCachedTeXFormula
public static void removeCachedTeXFormula(java.lang.String f, int style, int size, int inset) throws ParseException
- Throws:
ParseException
-
removeCachedTeXFormula
public static void removeCachedTeXFormula(java.lang.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 java.lang.Object paintCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor, java.awt.Graphics2D g) throws ParseException
Paint a cached formula- Parameters:
f
- a formulastyle
- a style like TeXConstants.STYLE_DISPLAYsize
- the size of fontinset
- the inset to add on the top, bottom, left and right- Returns:
- the key in the map
- Throws:
ParseException
-
paintCachedTeXFormula
public static java.lang.Object paintCachedTeXFormula(java.lang.String f, int style, int size, int inset, java.awt.Graphics2D g) throws ParseException
- Throws:
ParseException
-
paintCachedTeXFormula
public static java.lang.Object paintCachedTeXFormula(java.lang.Object o, java.awt.Graphics2D g) throws ParseException
Paint a cached formula- Parameters:
o
- an Object to identify the image in the cacheg
- the graphics where to paint the image- Returns:
- the key in the map
- Throws:
ParseException
-
getCachedTeXFormulaImage
public static java.awt.Image getCachedTeXFormulaImage(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor) throws ParseException
Get a cached formula- Parameters:
f
- a formulastyle
- a style like TeXConstants.STYLE_DISPLAYsize
- the size of fontinset
- the inset to add on the top, bottom, left and right- Returns:
- the cached image
- Throws:
ParseException
-
getCachedTeXFormulaImage
public static java.awt.Image getCachedTeXFormulaImage(java.lang.String f, int style, int size, int inset) throws ParseException
- Throws:
ParseException
-
getCachedTeXFormulaImage
public static java.awt.Image getCachedTeXFormulaImage(java.lang.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
-
-