Search in sources :

Example 1 with Rectangle2f

use of com.xenoage.utils.math.geom.Rectangle2f in project Zong by Xenoage.

the class PathSymbolGraphicAttribute method getBounds.

@Override
public Rectangle2D getBounds() {
    Rectangle2f f = symbol.getBoundingRect();
    f.scale(scaling);
    return new Rectangle2D.Float(f.x1(), f.y1(), f.width(), f.height());
}
Also used : Rectangle2f(com.xenoage.utils.math.geom.Rectangle2f)

Example 2 with Rectangle2f

use of com.xenoage.utils.math.geom.Rectangle2f in project Zong by Xenoage.

the class FrameRenderer method getLocalRect.

protected Rectangle2f getLocalRect(Frame frame) {
    float x = frame.getSize().width;
    float y = frame.getSize().height;
    Rectangle2f rect = new Rectangle2f(-x / 2, -y / 2, x, y);
    return rect;
}
Also used : Rectangle2f(com.xenoage.utils.math.geom.Rectangle2f)

Example 3 with Rectangle2f

use of com.xenoage.utils.math.geom.Rectangle2f in project Zong by Xenoage.

the class ChordStamper method getNoteheadXMm.

// TIDY
private float getNoteheadXMm(float xMm, float scaling, StaffStamping staff, Symbol symbol) {
    float ret = xMm;
    Rectangle2f bounds = symbol.getBoundingRect().scale(scaling);
    float interlineSpace = staff.is;
    float lineWidth = staff.getLineWidthMm();
    ret += (bounds.size.width / 2) * interlineSpace - lineWidth / 2;
    return ret;
}
Also used : Rectangle2f(com.xenoage.utils.math.geom.Rectangle2f)

Example 4 with Rectangle2f

use of com.xenoage.utils.math.geom.Rectangle2f in project Zong by Xenoage.

the class FlagsStamping method getBoundingShape.

@Override
public Shape getBoundingShape() {
    if (cachedBoundingShape != null)
        return cachedBoundingShape;
    // compute bounding shape
    float flagsDistance = getFlagsDistance(flagsDirection, scaling);
    float interlineSpace = parentStaff.is;
    for (int i = 0; i < flagsCount; i++) {
        Rectangle2f bounds = symbol.getBoundingRect().scale(scaling * interlineSpace);
        if (flagsDirection == FlagsDirection.Up) {
            bounds = bounds.move(0, -bounds.size.height);
        }
        bounds = bounds.move(0, -i * flagsDistance * interlineSpace);
        if (cachedBoundingShape == null)
            cachedBoundingShape = bounds;
        else
            cachedBoundingShape = cachedBoundingShape.extend(bounds);
    }
    cachedBoundingShape.move(position.xMm, parentStaff.computeYMm(position.lp));
    return cachedBoundingShape;
}
Also used : Rectangle2f(com.xenoage.utils.math.geom.Rectangle2f)

Example 5 with Rectangle2f

use of com.xenoage.utils.math.geom.Rectangle2f in project Zong by Xenoage.

the class StaffSymbolStamping method getBoundingShape.

@Override
public Rectangle2f getBoundingShape() {
    Rectangle2f bounds = symbol.getBoundingRect();
    bounds = bounds.scale(scaling * parentStaff.is);
    bounds = bounds.move(position.xMm, parentStaff.computeYMm(position.lp));
    return bounds;
}
Also used : Rectangle2f(com.xenoage.utils.math.geom.Rectangle2f)

Aggregations

Rectangle2f (com.xenoage.utils.math.geom.Rectangle2f)15 Point2f (com.xenoage.utils.math.geom.Point2f)4 Color (com.xenoage.utils.color.Color)2 Stamping (com.xenoage.zong.musiclayout.stampings.Stamping)2 ImageFrame (com.xenoage.zong.layout.frames.ImageFrame)1 ScoreFrame (com.xenoage.zong.layout.frames.ScoreFrame)1 TextFrame (com.xenoage.zong.layout.frames.TextFrame)1 ScoreFrameLayout (com.xenoage.zong.musiclayout.ScoreFrameLayout)1 StaffStamping (com.xenoage.zong.musiclayout.stampings.StaffStamping)1 StampingMock (com.xenoage.zong.musiclayout.stampings.StampingMock)1 StemStamping (com.xenoage.zong.musiclayout.stampings.StemStamping)1 BitmapLine (com.xenoage.zong.musiclayout.stampings.bitmap.BitmapLine)1 BitmapStaff (com.xenoage.zong.musiclayout.stampings.bitmap.BitmapStaff)1 Test (org.junit.Test)1