Class ChartGraphics
java.lang.Object
eu.bandm.music.applications.tabstaff.ChartGraphics
- Direct Known Subclasses:
ChartGraphics_byStrings
,ChartGraphics_svg
Subroutines and configuration data for the "grid" view of tabstaff,
for static and animated SVG renderings.
This is the superclass of two implementations, with explicit
String construction and one with the
JSVG library, resp.
Usage as a one-shot instance:
(1) Create one instance of a sub-class for one particular score and
grid geometry, (2) overwrite the graphic parameters by
{{a=b;}}
, (3) call
writeSequenceOfSvgs(String)
or
and/or writeToDynamicSVG(File)
to generate the graphic output.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
The roles of a key in a particular interpretation of the grid, when this assigns MIDI note on/off events. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
Configuration parameter: Size of the circle which stands for events by arbitrary hands.(package private) Color
Configuration parameter: Color of all diatonic keys.(package private) Color
Configuration parameter: Color of all key-press symbols.(package private) Color
Configuration parameter: Color of all keys between the diatonic keys.(package private) Color
Configuration parameter: Color of numbers on filled keypress symbols.(package private) int
Configuration parameter: offset between two adjacent squares which represent the keys.(package private) int
Configuration parameter: offset between two adjacent squares which represent the keys.(package private) int
Configuration parameter: border of squares representing keys which are root.(package private) int
Configuration parameter: border of squares representing keys which are not root.(package private) final int[]
Distances (in chromatic steps) for each scale position to its upper neighbour in a major scale.final int
Highest index for columns.final int
Highest index for rows.(package private) final int[]
Distances (in chromatic steps) for each scale position to its upper neighbour in a natural minor scale.(package private) final SimpleMessage.Sender
<XMLDocumentIdentifier> Target of all messages.(package private) int
Configuration parameter: Offset from the left margin of the graphic area to the very first square which represents a key.(package private) int
Configuration parameter: Offset from the top margin of the graphic area to the very first square which represents a key.(package private) int
Configuration parameter: Size of the rotated square which stands for left-hand events.(package private) int
Configuration parameter: Radius of the rounded corner.(package private) int
Configuration parameter: Radius of the rounded corner.final Tabstaff
The score data which will be rendered.(package private) int
Configuration parameters: Duration of one 1/1 note in seconds.(package private) int
Configuration parameter: width of the squares which represent the keys.(package private) int
Configuration parameter: height of the squares which represent the keys.(package private) int
Configuration parameter: Size of the upright square which stands for right-hand events. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ChartGraphics
(int rows, int cols, Tabstaff score, SimpleMessage.Sender<XMLDocumentIdentifier> msg) Basic constructor which defines fundamental input and output data. -
Method Summary
Modifier and TypeMethodDescription(package private) int
col2coord
(int column) Get the x coord of a given column number (from 1 to 8).static int
coord2index
(int r, int c) Translate a coordinate pair of the complete 8*8 area into a linear index.(package private) @Opt ChartGraphics.rank[]
Calculate the form and color of the grid background.(package private) int
row2coord
(int row) Get the y coord of a given row number (from 1 to 8).static ChartGraphics.rank[]
scaleToButtons
(Tabstaff.distance distance, int[] scaleDistances) Calculate the ranks of all squares to display (root, own, or foreign).abstract void
writeSequenceOfSvgs
(String fileStem) Service Access Point: Write to a sequence of distinct files whiche contain the graphics for different time points.abstract void
writeToDynamicSVG
(File file) Service Access Point: Write to one single file which contains the animated graphics stepping through the time points.
-
Field Details
-
score
The score data which will be rendered. -
msg
Target of all messages. -
maxRow
public final int maxRowHighest index for rows. -
maxCol
public final int maxColHighest index for columns. -
secondsPerWhole
int secondsPerWholeConfiguration parameters: Duration of one 1/1 note in seconds. Determins the tempo of the animated rendering. -
linewidthSlim
int linewidthSlimConfiguration parameter: border of squares representing keys which are not root. -
linewidthFat
int linewidthFatConfiguration parameter: border of squares representing keys which are root. -
sizeX
int sizeXConfiguration parameter: width of the squares which represent the keys. -
distX
int distXConfiguration parameter: offset between two adjacent squares which represent the keys. -
sizeY
int sizeYConfiguration parameter: height of the squares which represent the keys. -
distY
int distYConfiguration parameter: offset between two adjacent squares which represent the keys. -
roundX
int roundXConfiguration parameter: Radius of the rounded corner. -
roundY
int roundYConfiguration parameter: Radius of the rounded corner. -
offsetX
int offsetXConfiguration parameter: Offset from the left margin of the graphic area to the very first square which represents a key. (The offset from the last key to the right margin is fixed to half a button width.) -
offsetY
int offsetYConfiguration parameter: Offset from the top margin of the graphic area to the very first square which represents a key. (The offset from the last key to the bottom margin is fixed to half a button height.) -
squareSize
int squareSizeConfiguration parameter: Size of the upright square which stands for right-hand events. -
rotSquareSize
int rotSquareSizeConfiguration parameter: Size of the rotated square which stands for left-hand events. -
circleRadius
int circleRadiusConfiguration parameter: Size of the circle which stands for events by arbitrary hands. -
colorKeypress
Color colorKeypressConfiguration parameter: Color of all key-press symbols. -
colorDiatonic
Color colorDiatonicConfiguration parameter: Color of all diatonic keys. -
colorNumberOnFill
Color colorNumberOnFillConfiguration parameter: Color of numbers on filled keypress symbols. -
colorNotDiatonic
Color colorNotDiatonicConfiguration parameter: Color of all keys between the diatonic keys. -
majorMode
final int[] majorModeDistances (in chromatic steps) for each scale position to its upper neighbour in a major scale.ATTENTION scale support currently only provisionary.
-
minorMode
final int[] minorModeDistances (in chromatic steps) for each scale position to its upper neighbour in a natural minor scale.ATTENTION scale support currently only provisionary.
-
-
Constructor Details
-
ChartGraphics
protected ChartGraphics(int rows, int cols, Tabstaff score, SimpleMessage.Sender<XMLDocumentIdentifier> msg) Basic constructor which defines fundamental input and output data. Not called by the user, but the constructors of the subclasses.- Parameters:
rows
- number of rows = highest index of rows (because row numbers are 1-based!)cols
- number of cols = highest index of cols (because col numbers are 1-based!)
-
-
Method Details
-
writeSequenceOfSvgs
Service Access Point: Write to a sequence of distinct files whiche contain the graphics for different time points. -
writeToDynamicSVG
Service Access Point: Write to one single file which contains the animated graphics stepping through the time points.- Throws:
IOException
-
coord2index
public static int coord2index(int r, int c) Translate a coordinate pair of the complete 8*8 area into a linear index. This corresponds to a numbering of the keys from left to right, starting with the lowest row and ascending. -
scaleToButtons
Calculate the ranks of all squares to display (root, own, or foreign).
(ATTENTION button(1,1) is currently fixed to root, since dynamic layout change with "mode=nearest" is not yet implemented.)- Parameters:
distance
- how the leftmost key in each row is related to the leftmost key one row higher/lower.scaleDistances
- gives for every diatonic step the distance to its successor in chromatic steps. CURRENTLY seven positions must cover twelve chromatic steps.
-
col2coord
int col2coord(int column) Get the x coord of a given column number (from 1 to 8). This coordinate is used as the left edge of the painted button. -
row2coord
int row2coord(int row) Get the y coord of a given row number (from 1 to 8). This coordinate is used as the top edge of the painted button (= numerically lower and optically higher). -
initialGridPattern
Calculate the form and color of the grid background. (Currently restricted to the situation defined by the very first event.) (Currently restricted to evaluate distance and functionalKey-mode. Subset, orientation, fixed, and pitch base are ignored.)- Returns:
- null in case of errors in the voice data.
-