Interface ModelRenderer<G>

All Superinterfaces:
Cloneable

public interface ModelRenderer<G> extends Cloneable
Author:
Richard
  • Method Details

    • setAttribute

      void setAttribute(String name, Object value) throws IllegalArgumentException
      Allows the user to set specific attributes on the underlying implementation. The following attributes must be available for Graphics2D renderer implementations:

      Example
      Key (String)Value (The type)
      text.rendering.hintjava.awt.RenderingHints

      Note that the supplied RenderingHints are used only during text rendering, so it is not necessary to set anti-alias and the like. Such hints should be supplied to the Graphics2D object before calling render. However, some implementations can supply text sub-pixel AA and to be able to use that, you need to set "text.rendering.hint" to a RenderingHints containing a sub-pixel AA hint. (This can be gotten from java.awt.Toolkit. getDefaultToolkit().getDesktopProperty("awt.font.desktophints")).
      Parameters:
      name - The name of the attribute.
      value - The value of the attribute.
      Throws:
      IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
      See Also:
    • getAttribute

      Object getAttribute(String name) throws IllegalArgumentException
      Allows the user to retrieve specific attributes on the underlying implementation. The following attributes must be available for Graphics2D renderer implementations:

      Example
      Key (String)Value (The type)
      text.rendering.hintjava.awt.RenderingHints
      use.layer.opacityjava.lang.Boolean
      use.shadowsjava.lang.Boolean
      use.owning.symbol.renderingjava.lang.Boolean

      Note that the supplied RenderingHints are used only during text rendering, so it is not necessary to set anti-alias and the like. Such hints should be supplied to the Graphics2D object before calling render. However, some implementations can supply text sub-pixel AA and to be able to use that, you need to set "text.rendering.hint" to a RenderingHints containing a sub-pixel AA hint. (This can be gotten from java.awt.Toolkit. getDefaultToolkit().getDesktopProperty("awt.font.desktophints")).

      The reason you can't set sub-pixel AA as a rendering hint to the graphics object is because on some JVM's it isn't possible to render with both normal graphics AA and text sub-pixel AA at the same time. Therefor, this needs to be supplied separately so that the renderer can momentarily turn off normal graphics AA during text painting if text sub-pixel AA is turned on.

      Regarding layer opacity, setting it to true will make the renderer respect the MTLayerHeader.getOpacity() property. It will be used to draw the layer semi-transparently. Setting it to false must ensure that no call is made to the graphics object's composite.
      Parameters:
      name - The name of the attribute.
      Returns:
      value The value of the attribute.
      Throws:
      IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
      See Also:
    • getDimension

      Dimension getDimension()
    • headlessRender

      void headlessRender(G target, Collection<MTCompleteVertex> vertices, Collection<MTCompleteEdge> edges, Insets insets)
      Renders only the supplied vertices and edges onto the target. Layers will not be taken into account and no decorations on edges or vertices will be renderd. This is a one time method call and should not change any state in the renderer.
      Parameters:
      vertices - The vertices to render or an empty list.
      edges - The edges to render or an empty list.
      target - The target to render to.
      insets - The insets. Insets.left = distance from drawing areas left border to the left-most vertex or edge. Insets.top = distance from drawing areas top border to the top-most vertex or edge, and so on for Insets.bottom and Insets.right.
    • getClip

      Shape getClip()
    • setClip

      void setClip(Shape clip)
      Sets the clip bounds of this renderer. When the renderer is about to render, it may use the clip shape to decide if it should bother rendering a certain drawable or not, based on bounds where the drawable is to be drawn and the clip shape. This is important when fast rendering is needed so that no processing power is spent on rendering things that will lay outside the clip.
      Parameters:
      clip - A clip shape that the renderer can draw inside. Note that some renderers may render outside the bounds too so this is more of a hint to help performance.
    • setModel

      void setModel(MTCompleteModel model)
    • setColorScheme

      void setColorScheme(MTColorScheme colorScheme)
    • setBackgroundColor

      void setBackgroundColor(Color backgroundColor)
    • setLanguages

      void setLanguages(Collection<MTLanguage> languages)
    • setLayers

      void setLayers(Collection<MTCompleteLayer> layers)
    • setDecorators

      void setDecorators(Collection<ModelDecorator> decorators)
    • render

      void render(G target)
    • clone

      Throws:
      CloneNotSupportedException