Search in sources :

Example 11 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class CSDRender method getTempoScore.

protected String getTempoScore(Tempo tempo, double renderStart, double renderEnd) {
    Line line = tempo.getLine();
    if (line.size() == 1) {
        return "t 0 " + line.getLinePoint(0).getY();
    }
    if (renderStart > line.getLinePoint(line.size() - 1).getX()) {
        return "t 0 " + line.getLinePoint(line.size() - 1).getY();
    }
    StrBuilder buffer = new StrBuilder();
    buffer.append("t 0 ").append(line.getValue(renderStart));
    for (int i = 0; i < line.size(); i++) {
        LinePoint lp = line.getLinePoint(i);
        double pointBeat = lp.getX();
        if (pointBeat > renderStart) {
            if (renderEnd < 0 || pointBeat < renderEnd) {
                buffer.append(" ").append(pointBeat - renderStart);
                buffer.append(" ").append(lp.getY());
            } else {
                break;
            }
        }
    }
    if (renderEnd > 0) {
        buffer.append(" ").append(renderEnd - renderStart);
        buffer.append(" ").append(line.getValue(renderEnd));
    }
    buffer.append("\n");
    return buffer.toString();
}
Also used : SoundObjectParameterLine(blue.components.lines.SoundObjectParameterLine) Line(blue.components.lines.Line) LinePoint(blue.components.lines.LinePoint) StrBuilder(org.apache.commons.lang3.text.StrBuilder) LinePoint(blue.components.lines.LinePoint)

Example 12 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class ParameterLineView method repaint.

public void repaint() {
    GraphicsContext gc = getGraphicsContext2D();
    double w = getWidth();
    double h = getHeight();
    gc.setFill(Color.BLACK);
    gc.fillRect(0, 0, w, h);
    gc.setLineWidth(2.0);
    gc.setStroke(Color.WHITE);
    gc.strokeRect(0, 0, w, h);
    for (Line line : lineList) {
        boolean current = (line == getSelectedLine());
        Color c = current ? line.getColorFX() : line.getColorFX().darker();
        gc.setStroke(c);
        gc.setFill(c);
        drawLine(line, gc, w, h);
        if (current) {
            drawPoints(line, gc, w, h);
        }
    }
    drawSelectedPoint(gc);
}
Also used : Line(blue.components.lines.Line) GraphicsContext(javafx.scene.canvas.GraphicsContext) Color(javafx.scene.paint.Color)

Example 13 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class LineSelector method nextLine.

private void nextLine() {
    Line line = getSelectedLine();
    if (line == null || lineList.size() < 2) {
        return;
    }
    int index = lineList.indexOf(line) + 1;
    if (index >= lineList.size()) {
        index = 0;
    }
    setSelectedLine(lineList.get(index));
}
Also used : Line(blue.components.lines.Line)

Example 14 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class LineSelector method previousLine.

private void previousLine() {
    Line line = getSelectedLine();
    if (line == null || lineList.size() < 2) {
        return;
    }
    int index = lineList.indexOf(line) - 1;
    if (index < 0) {
        index = lineList.size() - 1;
    }
    setSelectedLine(lineList.get(index));
}
Also used : Line(blue.components.lines.Line)

Example 15 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class LineView method repaint.

public void repaint() {
    GraphicsContext gc = getGraphicsContext2D();
    double w = getWidth();
    double h = getHeight();
    gc.setFill(Color.BLACK);
    gc.fillRect(0, 0, w, h);
    gc.setLineWidth(1.0);
    for (Line line : lineList) {
        boolean current = (line == getSelectedLine());
        Color c = current ? line.getColorFX() : line.getColorFX().darker();
        gc.setStroke(c);
        gc.setFill(c);
        drawLine(line, gc, w, h);
        if (current) {
            drawPoints(line, gc, w, h);
        }
    }
    drawSelectedPoint(gc);
}
Also used : Line(blue.components.lines.Line) GraphicsContext(javafx.scene.canvas.GraphicsContext) Color(javafx.scene.paint.Color)

Aggregations

Line (blue.components.lines.Line)35 LinePoint (blue.components.lines.LinePoint)22 Point (java.awt.Point)11 SoundObjectParameterLine (blue.components.lines.SoundObjectParameterLine)4 Color (java.awt.Color)4 Iterator (java.util.Iterator)4 Graphics2D (java.awt.Graphics2D)3 RenderingHints (java.awt.RenderingHints)3 ModeManager (blue.ui.core.score.ModeManager)2 Element (electric.xml.Element)2 Elements (electric.xml.Elements)2 Rectangle (java.awt.Rectangle)2 BigDecimal (java.math.BigDecimal)2 GraphicsContext (javafx.scene.canvas.GraphicsContext)2 Color (javafx.scene.paint.Color)2 StrBuilder (org.apache.commons.lang3.text.StrBuilder)2 GenericInstrument (blue.orchestra.GenericInstrument)1 LineSelector (blue.orchestra.editor.blueSynthBuilder.jfx.LineSelector)1 ParameterLineView (blue.soundObject.editor.sound.ParameterLineView)1 TimeBar (blue.soundObject.editor.sound.TimeBar)1