当前位置: 首页>>代码示例>>Java>>正文


Java Path2D.Float方法代码示例

本文整理汇总了Java中java.awt.geom.Path2D.Float方法的典型用法代码示例。如果您正苦于以下问题:Java Path2D.Float方法的具体用法?Java Path2D.Float怎么用?Java Path2D.Float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Path2D的用法示例。


在下文中一共展示了Path2D.Float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
private void doPath(SunGraphics2D sg2d, Shape s, boolean isFill) {
    Path2D.Float p2df;
    int transx, transy;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        if (s instanceof Path2D.Float) {
            p2df = (Path2D.Float)s;
        } else {
            p2df = new Path2D.Float(s);
        }
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        p2df = new Path2D.Float(s, sg2d.transform);
        transx = 0;
        transy = 0;
    }
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XDoPath(sg2d, sg2d.surfaceData.getNativeOps(), xgc,
                transx, transy, p2df, isFill);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:X11Renderer.java

示例2: makeEllipse

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public Path2D makeEllipse(Complex G1, Complex G2, int m, double xOffset, double yOffset) {
	Path2D path = new Path2D.Float();
	int recPoints = Math.max(minReconstructionSamples, G.length * 3);
	for (int i = 0; i < recPoints; i++) {
		double t = (double) i / recPoints;
		Complex p1 = this.getEllipsePoint(G1, G2, m, t);
		double xt = p1.re();
		double yt = p1.im();
		if (i == 0) {
			path.moveTo(xt + xOffset, yt + yOffset);
		}
		else {
			path.lineTo(xt + xOffset, yt + yOffset);
		}
	}
	path.closePath();
	return path;
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:19,代码来源:FourierDescriptor.java

示例3: getPath2D

import java.awt.geom.Path2D; //导入方法依赖的package包/类
Path2D.Float getPath2D() {
    // resolve reference:
    Path2D.Float p2d
        = (refPath2D != null) ? refPath2D.get() : null;

    // create a new Path2D ?
    if (p2d == null) {
        p2d = new Path2D.Float(Path2D.WIND_NON_ZERO, INITIAL_EDGES_COUNT); // 32K

        // update weak reference:
        refPath2D = new WeakReference<Path2D.Float>(p2d);
    }
    // reset the path anyway:
    p2d.reset();
    return p2d;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:RendererContext.java

示例4: draw

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public void draw(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        if (s instanceof Polygon) {
            if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                Polygon p = (Polygon)s;
                drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
                return;
            }
        }
        Path2D.Float p2df;
        int transx, transy;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        drawPath(sg2d, p2df, transx, transy);
    } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
        ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
        try {
            fillSpans(sg2d, si, 0, 0);
        } finally {
            si.dispose();
        }
    } else {
        fill(sg2d, sg2d.stroke.createStrokedShape(s));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:BufferedRenderPipe.java

示例5: drawPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
protected void drawPath(SunGraphics2D sg2d,
                        Path2D.Float p2df, int transx, int transy)
{
    rq.lock();
    try {
        validateContext(sg2d);
        drawHandler.validate(sg2d);
        ProcessPath.drawPath(drawHandler, p2df, transx, transy);
    } finally {
        rq.unlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:BufferedRenderPipe.java

示例6: main

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final Path2D path1 = new Path2D.Double(Path2D.WIND_EVEN_ODD, 0);
    path1.moveTo(10, 10);
    path1.lineTo(20, 20);
    final Path2D path2 = new Path2D.Float(Path2D.WIND_EVEN_ODD, 0);
    path2.moveTo(10, 10);
    path2.lineTo(20, 20);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:EmptyCapacity.java

示例7: fillPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
protected void fillPath(SunGraphics2D sg2d,
                        Path2D.Float p2df, int transx, int transy)
{
    rq.lock();
    try {
        validateContext(sg2d);
        drawHandler.validate(sg2d);
        drawHandler.startFillPath();
        ProcessPath.fillPath(drawHandler, p2df, transx, transy);
        drawHandler.endFillPath();
    } finally {
        rq.unlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:BufferedRenderPipe.java

示例8: doShape

import java.awt.geom.Path2D; //导入方法依赖的package包/类
void doShape(GDIWindowSurfaceData sData,
             Region clip, Composite comp, int color,
             int transX, int transY,
             Path2D.Float p2df, boolean isfill)
{
    GraphicsPrimitive.tracePrimitive(isfill
                                     ? "GDIFillShape"
                                     : "GDIDrawShape");
    super.doShape(sData, clip, comp, color,
                  transX, transY, p2df, isfill);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:GDIRenderer.java

示例9: fill

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public void fill(SunGraphics2D sg2d, Shape s) {
    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        Path2D.Float p2df;
        int transX;
        int transY;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transX = sg2d.transX;
            transY = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transX = 0;
            transY = 0;
        }
        sg2d.loops.fillPathLoop.FillPath(sg2d, sg2d.getSurfaceData(),
                                         transX, transY, p2df);
        return;
    }

    ShapeSpanIterator sr = getFillSSI(sg2d);
    try {
        sr.setOutputArea(sg2d.getCompClip());
        AffineTransform at =
            ((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT)
             ? null
             : sg2d.transform);
        sr.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, sr);
    } finally {
        sr.dispose();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:37,代码来源:LoopPipe.java

示例10: paintBorder

import java.awt.geom.Path2D; //导入方法依赖的package包/类
/**
 * Paints the border for the specified component with the
 * specified position and size.
 *
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:LineBorder.java

示例11: FillPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public void FillPath(SunGraphics2D sg2d, SurfaceData sData,
                     int transX, int transY,
                     Path2D.Float p2df)
{
    tracePrimitive(target);
    target.FillPath(sg2d, sData, transX, transY, p2df);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:FillPath.java

示例12: DrawPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public void DrawPath(SunGraphics2D sg2d, SurfaceData sData,
                     int transX, int transY,
                     Path2D.Float p2df)
{
    tracePrimitive(target);
    target.DrawPath(sg2d, sData, transX, transY, p2df);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DrawPath.java

示例13: fill

import java.awt.geom.Path2D; //导入方法依赖的package包/类
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float)s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans (we could
        // delegate to fillPolygon() here, but most hardware accelerated
        // libraries cannot handle non-convex polygons, so we will use
        // the FillSpans approach by default)
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:BufferedRenderPipe.java

示例14: drawPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
protected void drawPath(SunGraphics2D sg2d,
                        Path2D.Float p2df, int transx, int transy)
{
    GraphicsPrimitive.tracePrimitive("OGLDrawPath");
    oglr.drawPath(sg2d, p2df, transx, transy);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:OGLRenderer.java

示例15: XDoPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
native void XDoPath(SunGraphics2D sg2d, long pXSData, long xgc,
int transX, int transY, Path2D.Float p2df,
boolean isFill);
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:X11Renderer.java


注:本文中的java.awt.geom.Path2D.Float方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。