本文整理汇总了Java中com.sun.javafx.geom.Path2D类的典型用法代码示例。如果您正苦于以下问题:Java Path2D类的具体用法?Java Path2D怎么用?Java Path2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Path2D类属于com.sun.javafx.geom包,在下文中一共展示了Path2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBeveledRect
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
static Shape makeBeveledRect(float rx, float ry,
float rw, float rh,
float d)
{
float rx0 = rx;
float ry0 = ry;
float rx1 = rx + rw;
float ry1 = ry + rh;
Path2D p = new Path2D();
p.moveTo(rx0, ry0 - d);
p.lineTo(rx1, ry0 - d);
p.lineTo(rx1 + d, ry0);
p.lineTo(rx1 + d, ry1);
p.lineTo(rx1, ry1 + d);
p.lineTo(rx0, ry1 + d);
p.lineTo(rx0 - d, ry1);
p.lineTo(rx0 - d, ry0);
p.closePath();
return p;
}
示例2: createCenteredStrokedShapeOpenPisces
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
private static Shape createCenteredStrokedShapeOpenPisces(Shape s, BasicStroke stroke)
{
final float lw = (stroke.getType() == BasicStroke.TYPE_CENTERED) ?
stroke.getLineWidth() : stroke.getLineWidth() * 2.0f;
final Path2D p2d = new Path2D(Path2D.WIND_NON_ZERO);
PathConsumer2D pc2d =
new com.sun.openpisces.Stroker(p2d, lw, stroke.getEndCap(),
stroke.getLineJoin(),
stroke.getMiterLimit());
if (stroke.isDashed()) {
pc2d = new com.sun.openpisces.Dasher(pc2d, stroke.getDashArray(),
stroke.getDashPhase());
}
com.sun.prism.impl.shape.OpenPiscesPrismUtils.feedConsumer(
s.getPathIterator(null), pc2d);
return p2d;
}
示例3: createCenteredStrokedShape
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
static Shape createCenteredStrokedShape(Shape s, BasicStroke stroke)
{
final float lw = (stroke.getType() == BasicStroke.TYPE_CENTERED) ?
stroke.getLineWidth() : stroke.getLineWidth() * 2.0f;
final RendererContext rdrCtx = MarlinRenderingEngine.getRendererContext();
try {
// initialize a large copyable Path2D to avoid a lot of array growing:
final Path2D p2d = rdrCtx.getPath2D();
if (s instanceof NGCanvasPath) {
s = ((NGCanvasPath)s).getGeometry(); // use internal Path2D
}
MarlinPrismUtils.strokeTo(rdrCtx, s, stroke, lw,
rdrCtx.transformerPC2D.wrapPath2D(p2d)
);
// Use Path2D copy constructor (trim)
return new Path2D(p2d);
} finally {
// recycle the RendererContext instance
MarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
示例4: createCenteredStrokedShape
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
static Shape createCenteredStrokedShape(Shape s, BasicStroke stroke)
{
final float lw = (stroke.getType() == BasicStroke.TYPE_CENTERED) ?
stroke.getLineWidth() : stroke.getLineWidth() * 2.0f;
final DRendererContext rdrCtx = DMarlinRenderingEngine.getRendererContext();
try {
// initialize a large copyable Path2D to avoid a lot of array growing:
final Path2D p2d = rdrCtx.getPath2D();
if (s instanceof NGCanvasPath) {
s = ((NGCanvasPath)s).getGeometry(); // use internal Path2D
}
DMarlinPrismUtils.strokeTo(rdrCtx, s, stroke, lw,
rdrCtx.transformerPC2D.wrapPath2D(p2d)
);
// Use Path2D copy constructor (trim)
return new Path2D(p2d);
} finally {
// recycle the DRendererContext instance
DMarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
示例5: NGCanvas
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public NGCanvas() {
Toolkit tk = Toolkit.getToolkit();
ScreenConfigurationAccessor screenAccessor = tk.getScreenConfigurationAccessor();
float hPS = 1.0f;
for (Object screen : tk.getScreens()) {
hPS = Math.max(screenAccessor.getRenderScale(screen), hPS);
}
highestPixelScale = hPS;
cv = new RenderBuf(InitType.PRESERVE_UPPER_LEFT);
temp = new RenderBuf(InitType.CLEAR);
clip = new RenderBuf(InitType.FILL_WHITE);
path = new Path2D();
ngtext = new NGText();
textLayout = new PrismTextLayout();
transform = new Affine2D();
clipStack = new LinkedList<Path2D>();
initAttributes();
}
示例6: initAttributes
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
private void initAttributes() {
globalAlpha = 1.0f;
blendmode = Mode.SRC_OVER;
fillPaint = Color.BLACK;
strokePaint = Color.BLACK;
linewidth = 1.0f;
linecap = BasicStroke.CAP_SQUARE;
linejoin = BasicStroke.JOIN_MITER;
miterlimit = 10f;
dashes = null;
dashOffset = 0.0f;
stroke = null;
path.setWindingRule(Path2D.WIND_NON_ZERO);
// ngtext stores no state between render operations
// textLayout stores no state between render operations
pgfont = (PGFont) Font.getDefault().impl_getNativeFont();
smoothing = SMOOTH_GRAY;
align = ALIGN_LEFT;
baseline = VPos.BASELINE.ordinal();
transform.setToScale(highestPixelScale, highestPixelScale);
clipStack.clear();
resetClip(false);
}
示例7: strokeTo
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public static void strokeTo(
final DRendererContext rdrCtx,
final Shape shape,
final BasicStroke stroke,
final float lineWidth,
final DPathConsumer2D out)
{
final DPathConsumer2D pc2d = initStroker(rdrCtx, stroke, lineWidth, null, out);
if (shape instanceof Path2D) {
feedConsumer(rdrCtx, (Path2D)shape, null, pc2d);
} else {
feedConsumer(rdrCtx, shape.getPathIterator(null), pc2d);
}
}
示例8: strokeTo
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public static void strokeTo(
final RendererContext rdrCtx,
final Shape shape,
final BasicStroke stroke,
final float lineWidth,
final PathConsumer2D out)
{
final PathConsumer2D pc2d = initStroker(rdrCtx, stroke, lineWidth, null, out);
if (shape instanceof Path2D) {
feedConsumer(rdrCtx, (Path2D)shape, null, pc2d);
} else {
feedConsumer(rdrCtx, shape.getPathIterator(null), pc2d);
}
}
示例9: verify
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public static boolean verify(String svg) {
if (StringUtil.isEmpty(svg)) {
return false;
}
return TaskUtil.uncatch(() -> new Path2D().appendSVGPath(svg));
}
示例10: strokeRoundRectangle
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
Shape strokeRoundRectangle(RoundRectangle2D rr) {
if (rr.width < 0 || rr.height < 0) {
return new Path2D();
}
if (isDashed()) {
return null;
}
int j;
float aw = rr.arcWidth;
float ah = rr.arcHeight;
if (aw <= 0f || ah <= 0f) {
aw = ah = 0f;
if (type == TYPE_INNER) {
j = JOIN_MITER;
} else {
j = this.join;
if (j == JOIN_MITER && miterLimit < SQRT_2) {
j = JOIN_BEVEL;
}
}
} else {
if (aw < ah * 0.9f || ah < aw * 0.9f) {
// RT-27416
// TODO: Need to check these multipliers and
// optimize this case...
return null;
}
j = JOIN_ROUND;
}
float id, od;
if (type == TYPE_INNER) {
od = 0f;
id = this.width;
} else if (type == TYPE_OUTER) {
od = this.width;
id = 0f;
} else {
od = id = this.width/2f;
}
Shape outer;
switch (j) {
case JOIN_MITER:
outer = new RoundRectangle2D(rr.x - od, rr.y - od,
rr.width+od*2f, rr.height+od*2f,
0f, 0f);
break;
case JOIN_BEVEL:
outer = makeBeveledRect(rr.x, rr.y, rr.width, rr.height, od);
break;
case JOIN_ROUND:
outer = new RoundRectangle2D(rr.x - od, rr.y - od,
rr.width+od*2f, rr.height+od*2f,
aw+od*2f, ah+od*2f);
break;
default:
throw new InternalError("Unrecognized line join style");
}
if (rr.width <= id*2f || rr.height <= id*2f) {
return outer;
}
aw -= id*2f;
ah -= id*2f;
if (aw <= 0f || ah <= 0f) {
aw = ah = 0f;
}
Shape inner = new RoundRectangle2D(rr.x + id, rr.y + id,
rr.width-id*2f, rr.height-id*2f,
aw, ah);
Path2D p2d = (outer instanceof Path2D)
? ((Path2D) outer) : new Path2D(outer);
p2d.setWindingRule(Path2D.WIND_EVEN_ODD);
p2d.append(inner, false);
return p2d;
}
示例11: wrapPath2D
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public PathConsumer2D wrapPath2D(Path2D p2d) {
return wp_Path2DWrapper.init(p2d);
}
示例12: init
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
Path2DWrapper init(Path2D p2d) {
this.p2d = p2d;
return this;
}
示例13: wrapPath2D
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
public DPathConsumer2D wrapPath2D(Path2D p2d) {
return wp_Path2DWrapper.init(p2d);
}
示例14: testEmptyFloatPaths
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
@Test(timeout=10000)
public void testEmptyFloatPaths() {
echo("\n - Test: new Path2D(0) ---");
test(() -> new Path2D(Path2D.WIND_NON_ZERO, 0));
}
示例15: testFloatPaths
import com.sun.javafx.geom.Path2D; //导入依赖的package包/类
@Test(timeout=10000)
public void testFloatPaths() {
echo("\n - Test: new Path2D() ---");
test(() -> new Path2D());
}