本文整理汇总了Java中java.awt.geom.CubicCurve2D.getCtrlP1方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve2D.getCtrlP1方法的具体用法?Java CubicCurve2D.getCtrlP1怎么用?Java CubicCurve2D.getCtrlP1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.CubicCurve2D
的用法示例。
在下文中一共展示了CubicCurve2D.getCtrlP1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSlur
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
private void addSlur (SlurInter slur,
Integer num,
HorizontalSide side,
boolean continuation)
{
final Staff staff = current.note.getStaff();
final CubicCurve2D curve = slur.getCurve();
// Slur element
final Slur pmSlur = factory.createSlur();
if (num != null) {
pmSlur.setNumber(num);
}
// Type
pmSlur.setType(
continuation ? StartStopContinue.CONTINUE
: ((side == LEFT) ? StartStopContinue.START : StartStopContinue.STOP));
// Placement
if (side == LEFT) {
pmSlur.setPlacement(slur.isAbove() ? AboveBelow.ABOVE : AboveBelow.BELOW);
}
// End point
final Point2D end = (side == LEFT) ? curve.getP1() : curve.getP2();
pmSlur.setDefaultX(toTenths(end.getX() - current.note.getCenterLeft().x));
pmSlur.setDefaultY(yOf(end, staff));
// Control point
final Point2D ctrl = (side == LEFT) ? curve.getCtrlP1() : curve.getCtrlP2();
if ((side == LEFT) && continuation) {
pmSlur.setBezierX2(toTenths(ctrl.getX() - end.getX()));
pmSlur.setBezierY2(toTenths(end.getY() - ctrl.getY()));
} else {
pmSlur.setBezierX(toTenths(ctrl.getX() - end.getX()));
pmSlur.setBezierY(toTenths(end.getY() - ctrl.getY()));
}
getNotations().getTiedOrSlurOrTuplet().add(pmSlur);
}