Class TextureFactory


  • public final class TextureFactory
    extends java.lang.Object
    This class generate Paints from WMF hatch definitions. All generated Paints are cached for future use.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TextureFactory getInstance()
      Get the unique instance of the class.
      static TextureFactory getInstance​(float scale)
      Get the unique instance of the class, setting the scale of the pattern.
      java.awt.Paint getTexture​(int textureId)
      Get a texture from a WMF hatch definition (in black Color).
      java.awt.Paint getTexture​(int textureId, java.awt.Color foreground)
      Get a texture from a WMF hatch definition, with a foreground color.
      java.awt.Paint getTexture​(int textureId, java.awt.Color foreground, java.awt.Color background)
      Get a texture from a WMF hatch definition, with a foreground and a background color.
      void reset()
      Rest the factory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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 java.awt.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 java.awt.Paint getTexture​(int textureId,
                                         java.awt.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 java.awt.Paint getTexture​(int textureId,
                                         java.awt.Color foreground,
                                         java.awt.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.