本文整理汇总了Java中javafx.scene.canvas.GraphicsContext.quadraticCurveTo方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsContext.quadraticCurveTo方法的具体用法?Java GraphicsContext.quadraticCurveTo怎么用?Java GraphicsContext.quadraticCurveTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.canvas.GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext.quadraticCurveTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawRoundedRect
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public static final void drawRoundedRect(final GraphicsContext CTX, final CtxBounds BOUNDS, final CtxCornerRadii RADII) {
double x = BOUNDS.getX();
double y = BOUNDS.getY();
double width = BOUNDS.getWidth();
double height = BOUNDS.getHeight();
double xPlusWidth = x + width;
double yPlusHeight = y + height;
CTX.beginPath();
CTX.moveTo(x + RADII.getTopLeft(), y);
CTX.lineTo(xPlusWidth - RADII.getTopRight(), y);
CTX.quadraticCurveTo(xPlusWidth, y, xPlusWidth, y + RADII.getTopRight());
CTX.lineTo(xPlusWidth, yPlusHeight - RADII.getBottomRight());
CTX.quadraticCurveTo(xPlusWidth, yPlusHeight, xPlusWidth - RADII.getBottomRight(), yPlusHeight);
CTX.lineTo(x + RADII.getBottomLeft(), yPlusHeight);
CTX.quadraticCurveTo(x, yPlusHeight, x, yPlusHeight - RADII.getBottomLeft());
CTX.lineTo(x, y + RADII.getTopLeft());
CTX.quadraticCurveTo(x, y, x + RADII.getTopLeft(), y);
CTX.closePath();
}
示例2: drawRoundedRect
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
private static void drawRoundedRect(final GraphicsContext CTX, final CtxBounds BOUNDS, final CtxCornerRadii RADII) {
double x = BOUNDS.getX();
double y = BOUNDS.getY();
double width = BOUNDS.getWidth();
double height = BOUNDS.getHeight();
double xPlusWidth = x + width;
double yPlusHeight = y + height;
CTX.beginPath();
CTX.moveTo(x + RADII.getTopRight(), y);
CTX.lineTo(xPlusWidth - RADII.getTopRight(), y);
CTX.quadraticCurveTo(xPlusWidth, y, xPlusWidth, y + RADII.getTopRight());
CTX.lineTo(xPlusWidth, yPlusHeight - RADII.getBottomRight());
CTX.quadraticCurveTo(xPlusWidth, yPlusHeight, xPlusWidth - RADII.getBottomRight(), yPlusHeight);
CTX.lineTo(x + RADII.getBottomLeft(), yPlusHeight);
CTX.quadraticCurveTo(x, yPlusHeight, x, yPlusHeight - RADII.getBottomLeft());
CTX.lineTo(x, y + RADII.getTopRight());
CTX.quadraticCurveTo(x, y, x + RADII.getTopRight(), y);
CTX.closePath();
}
示例3: draw
import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void draw(final GraphicsContext CTX, final boolean FILL, final boolean STROKE) {
PathIterator pi = getPathIterator(new Affine());
CTX.setFillRule(WindingRule.WIND_EVEN_ODD == pi.getWindingRule() ? FillRule.EVEN_ODD : FillRule.NON_ZERO);
CTX.beginPath();
double[] seg = new double[6];
int segType;
while(!pi.isDone()) {
segType = pi.currentSegment(seg);
switch (segType) {
case PathIterator.MOVE_TO : CTX.moveTo(seg[0], seg[1]); break;
case PathIterator.LINE_TO : CTX.lineTo(seg[0], seg[1]); break;
case PathIterator.QUAD_TO : CTX.quadraticCurveTo(seg[0], seg[1], seg[2], seg[3]);break;
case PathIterator.BEZIER_TO: CTX.bezierCurveTo(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);break;
case PathIterator.CLOSE : CTX.closePath();break;
default : break;
}
pi.next();
}
if (FILL) { CTX.setFill(fill); CTX.fill(); }
if (STROKE) { CTX.setStroke(stroke); CTX.stroke(); }
}