Class ChartGraphics_svg
java.lang.Object
eu.bandm.music.applications.tabstaff.ChartGraphics
eu.bandm.music.applications.tabstaff.ChartGraphics_svg
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.music.applications.tabstaff.ChartGraphics
ChartGraphics.rank
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) float
Duration (in seconds) subtracted from the end of a keypress, to visually indicate key repetitions.(package private) Font
(package private) float
Global input register for adding the transparency animation.(package private) float
Global input register for adding the transparency animation.(package private) BasicStroke
(package private) BasicStroke
(package private) com.jsevy.jsvg.SVGDocument
Needed as global reference for adding the transparency animation.Fields inherited from class eu.bandm.music.applications.tabstaff.ChartGraphics
circleRadius, colorDiatonic, colorKeypress, colorNotDiatonic, colorNumberOnFill, distX, distY, linewidthFat, linewidthSlim, majorMode, maxCol, maxRow, minorMode, msg, offsetX, offsetY, rotSquareSize, roundX, roundY, score, secondsPerWhole, sizeX, sizeY, squareSize
-
Constructor Summary
ConstructorsConstructorDescriptionChartGraphics_svg
(int rows, int cols, Tabstaff score, SimpleMessage.Sender<XMLDocumentIdentifier> msg) Called by the user. -
Method Summary
Modifier and TypeMethodDescription(package private) Path2D
diamond
(double x, double y) (package private) void
Initialize the resources needed for drawing.void
number
(Graphics2D gr, int column, int row, int finger, Color color) Generate the svg source for printing the finger number.(package private) void
void
svgFullGrid
(Graphics2D gr, ChartGraphics.rank[] ranks) Construct the code for a complete key display, with the pre-selected coun of rows and columns.(package private) void
tie
(Graphics2D gr, int column, int row) Generate an "arriving" tie symbol.void
writeSequenceOfSvgs
(String fileStem) Create one static SVG diagram for each time point.(package private) void
writeSvgEvent
(Graphics2D gr, Event e) Generate the graphic representation of one particular event from the score.void
writeToDynamicSVG
(File file) Point of Service: Create an animated SVG file which shows the sequence of key presses.void
xCircle
(Graphics2D gr, boolean attack, int column, int row) Generate the svg code for a diamond symbol for a key press.void
xDiamond
(Graphics2D gr, boolean attack, int column, int row) Generate the svg code for a diamond symbol for a key press.void
xSquare
(Graphics2D gr, boolean attack, int column, int row) Generate the svg code for a diamond symbol for a key press.Methods inherited from class eu.bandm.music.applications.tabstaff.ChartGraphics
col2coord, coord2index, initialGridPattern, row2coord, scaleToButtons
-
Field Details
-
svgDocument
com.jsevy.jsvg.SVGDocument svgDocumentNeeded as global reference for adding the transparency animation. -
start
float startGlobal input register for adding the transparency animation. -
end
float endGlobal input register for adding the transparency animation. -
articulationDistance
float articulationDistanceDuration (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
-
ChartGraphics_svg
public ChartGraphics_svg(int rows, int cols, Tabstaff score, SimpleMessage.Sender<XMLDocumentIdentifier> msg) Called by the user. Only constructor.
-
-
Method Details
-
writeSequenceOfSvgs
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 classChartGraphics
-
writeToDynamicSVG
Point of Service: Create an animated SVG file which shows the sequence of key presses. Tempo given by the configuration parameterChartGraphics.secondsPerWhole
.- Specified by:
writeToDynamicSVG
in classChartGraphics
- Throws:
IOException
-
writeSvgEvent
Generate the graphic representation of one particular event from the score. If global varend
== FLOAT.POSITIVE_INFINITY then NO ANIMATION AT ALL shall be applied. -
putAnimation
void putAnimation() -
initGraphics
void initGraphics()Initialize the resources needed for drawing. -
svgFullGrid
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
-
xDiamond
Generate the svg code for a diamond symbol for a key press. -
xSquare
Generate the svg code for a diamond symbol for a key press. -
xCircle
Generate the svg code for a diamond symbol for a key press. -
tie
Generate an "arriving" tie symbol. This decorates silent fingerchange events. -
number
Generate the svg source for printing the finger number.
-