本文整理匯總了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);
}