Class ChartGraphics_svg

java.lang.Object
eu.bandm.music.applications.tabstaff.ChartGraphics
eu.bandm.music.applications.tabstaff.ChartGraphics_svg

public class ChartGraphics_svg extends ChartGraphics
Subroutines and configuration data for the "grid" view of tabstaff, for static and animated SVG renderings. Usage as a one-shot instance: create one instance of a sub-class for one particular score and grid geometry, then call writeSequenceOfSvgs(String) or and/or writeToDynamicSVG(File) to generate the graphic output. Optical parameters can be changed by subclassing-on-the-fly with
new ChartGraphics_svg{{a=b;}}(8, 8, score,msg), etc.

This is the implementation variant which uses the SVG library JSVG by Jonathan Sevy. It needs version jsvg_1.2_beta_2, see the JSVG homepage.

  • Field Details

    • svgDocument

      com.jsevy.jsvg.SVGDocument svgDocument
      Needed as global reference for adding the transparency animation.
    • start

      float start
      Global input register for adding the transparency animation.
    • end

      float end
      Global input register for adding the transparency animation.
    • articulationDistance

      float articulationDistance
      Duration (in seconds) subtracted from the end of a keypress, to visually indicate key repetitions.
    • strokeSlim

      BasicStroke strokeSlim
    • strokeFat

      BasicStroke strokeFat
    • boldFont

      Font boldFont
  • Constructor Details

  • Method Details

    • writeSequenceOfSvgs

      public void writeSequenceOfSvgs(String fileStem)
      Create one static SVG diagram for each time point. The rational value of the time point is encoded in the file name and shown above the key grid.

      (In contrast to the tabstaff paper, "hand" has been propagated explicitly when parsing, and "finger" is propagated because here the most recent event is processed anyhow.)

      Specified by:
      writeSequenceOfSvgs in class ChartGraphics
    • writeToDynamicSVG

      public void writeToDynamicSVG(File file) throws IOException
      Point of Service: Create an animated SVG file which shows the sequence of key presses. Tempo given by the configuration parameter ChartGraphics.secondsPerWhole.
      Specified by:
      writeToDynamicSVG in class ChartGraphics
      Throws:
      IOException
    • writeSvgEvent

      void writeSvgEvent(Graphics2D gr, Event e)
      Generate the graphic representation of one particular event from the score. If global var end == FLOAT.POSITIVE_INFINITY then NO ANIMATION AT ALL shall be applied.
    • putAnimation

      void putAnimation()
      Set the last created svg element to non-transparent (= visible) only for the time interval from start to end. Add no animation at all iff end == POSITIVE_INFINITY.
    • initGraphics

      void initGraphics()
      Initialize the resources needed for drawing.
    • svgFullGrid

      public void svgFullGrid(Graphics2D gr, ChartGraphics.rank[] ranks)
      Construct the code for a complete key display, with the pre-selected coun of rows and columns.
      Parameters:
      ranks - give how to paint the squares representing the keys at the coordinates (1,1) (1,2) .. (1,8) (2,1) .. (8,8)
    • diamond

      Path2D diamond(double x, double y)
    • xDiamond

      public void xDiamond(Graphics2D gr, boolean attack, int column, int row)
      Generate the svg code for a diamond symbol for a key press.
    • xSquare

      public void xSquare(Graphics2D gr, boolean attack, int column, int row)
      Generate the svg code for a diamond symbol for a key press.
    • xCircle

      public void xCircle(Graphics2D gr, boolean attack, int column, int row)
      Generate the svg code for a diamond symbol for a key press.
    • tie

      void tie(Graphics2D gr, int column, int row)
      Generate an "arriving" tie symbol. This decorates silent fingerchange events.
    • number

      public void number(Graphics2D gr, int column, int row, int finger, Color color)
      Generate the svg source for printing the finger number.