Class TextureFactory

java.lang.Object
org.apache.batik.transcoder.wmf.tosvg.TextureFactory

public final class TextureFactory extends Object
This class generate Paints from WMF hatch definitions. All generated Paints are cached for future use.
Version:
$Id: TextureFactory.java 1831635 2018-05-15 13:33:47Z ssteiner $
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    Contain a handle to a Colored texture, with optional foreground and background colors.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static TextureFactory
     
    private float
     
    private static final int
     
    private Map
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    TextureFactory(float scale)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private Paint
    createTexture(int textureId, Color foreground, Color background)
    Called internally if the Paint does not exist in the cache and must be created.
    Get the unique instance of the class.
    getInstance(float scale)
    Get the unique instance of the class, setting the scale of the pattern.
    getTexture(int textureId)
    Get a texture from a WMF hatch definition (in black Color).
    getTexture(int textureId, Color foreground)
    Get a texture from a WMF hatch definition, with a foreground color.
    getTexture(int textureId, Color foreground, Color background)
    Get a texture from a WMF hatch definition, with a foreground and a background color.
    void
    Rest the factory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • TextureFactory

      private TextureFactory(float scale)
  • Method Details

    • getInstance

      public static TextureFactory getInstance()
      Get the unique instance of the class.
    • getInstance

      public static TextureFactory getInstance(float scale)
      Get the unique instance of the class, setting the scale of the pattern. TODO : scale is not handled for now
    • reset

      public void reset()
      Rest the factory. It empties all the previouly cached Paints are disposed of.
    • getTexture

      public Paint getTexture(int textureId)
      Get a texture from a WMF hatch definition (in black Color). This texture will be cached, so the Paint will only be created once.
    • getTexture

      public Paint getTexture(int textureId, Color foreground)
      Get a texture from a WMF hatch definition, with a foreground color. This texture will be cached, so the Paint will only be created once.
    • getTexture

      public Paint getTexture(int textureId, Color foreground, Color background)
      Get a texture from a WMF hatch definition, with a foreground and a background color. This texture will be cached, so the Paint will only be created once.
    • createTexture

      private Paint createTexture(int textureId, Color foreground, Color background)
      Called internally if the Paint does not exist in the cache and must be created.