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


Java GeneralPath.append方法代码示例

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


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

示例1: getRegiaoComentario

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
public Shape getRegiaoComentario() {
    if (Regiao == null) {

        GeneralPath pa = new GeneralPath();
        pa.setWindingRule(GeneralPath.WIND_NON_ZERO);

        Rectangle rec = getBounds();
        int tam = Math.min(rec.width / 6, rec.height / 6);
        int curv = tam / 4;
        int lw = rec.x + rec.width;
        int[] px = new int[]{rec.x, lw - tam, lw, lw, rec.x};
        int[] py = new int[]{rec.y, rec.y, rec.y + tam, rec.y + rec.height, rec.y + rec.height};
        Polygon po = new Polygon(px, py, 5);
        pa.append(po, true);
        pa.moveTo(lw - tam, rec.y);
        pa.curveTo(lw - tam, rec.y, lw - tam + curv, rec.y + curv, lw - tam, rec.y + tam - (1));
        pa.moveTo(lw - tam, rec.y + tam - (1));
        pa.lineTo(lw, rec.y + tam);
        pa.closePath();
        Regiao = pa;
    }
    return Regiao;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:24,代码来源:LivreBase.java

示例2: getCross

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
private GeneralPath getCross(Decoration decoration) {
    double quarterWidth = (WIDTH - DECORATION_SIZE) / 2;
    double quarterHeight = (HEIGHT - DECORATION_SIZE) / 2;
    double offset = 0;
    double width = WIDTH;
    double height = HEIGHT;
    switch(decoration) {
    case SCANDINAVIAN_CROSS:
        offset = CROSS_OFFSET;
        break;
    case GREEK_CROSS:
        width = height = Math.min(WIDTH, HEIGHT) - 2 * DECORATION_SIZE;
        break;
    default:
        break;
    }
    GeneralPath cross = new GeneralPath();
    cross.append(new Rectangle2D.Double((WIDTH - width) / 2, quarterHeight,
                                        width, DECORATION_SIZE), false);
    cross.append(new Rectangle2D.Double(quarterWidth - offset, (HEIGHT - height) / 2,
                                        DECORATION_SIZE, height), false);
    return cross;
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:24,代码来源:Flag.java

示例3: getUnderlineShape

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
Shape getUnderlineShape(float thickness,
                        float x1,
                        float x2,
                        float y) {

    GeneralPath gp = new GeneralPath();

    Line2D.Float line = new Line2D.Float(x1, y, x2, y);
    gp.append(stroke.createStrokedShape(line), false);

    line.y1 += DEFAULT_THICKNESS;
    line.y2 += DEFAULT_THICKNESS;
    line.x1 += DEFAULT_THICKNESS;

    gp.append(stroke.createStrokedShape(line), false);

    return gp;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:Underline.java

示例4: mapShape

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
public Shape mapShape(Shape s) {
    if (LOGMAP) LOG.format("mapshape on path: %s\n", LayoutPathImpl.SegmentPath.this);
    PathIterator pi = s.getPathIterator(null, 1); // cheap way to handle curves.

    if (LOGMAP) LOG.format("start\n");
    init();

    final double[] coords = new double[2];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case SEG_CLOSE: close(); break;
        case SEG_MOVETO: moveTo(coords[0], coords[1]); break;
        case SEG_LINETO: lineTo(coords[0], coords[1]); break;
        default: break;
        }

        pi.next();
    }
    if (LOGMAP) LOG.format("finish\n\n");

    GeneralPath gp = new GeneralPath();
    for (Segment seg: segments) {
        gp.append(seg.gp, false);
    }
    return gp;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:LayoutPathImpl.java

示例5: drawNeedle

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * Draws the needle.
 *
 * @param g2  the graphics device.
 * @param plotArea  the plot area.
 * @param rotate  the rotation point.
 * @param angle  the angle.
 */
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea, Point2D rotate, double angle) {

    GeneralPath shape = new GeneralPath();
    shape.append(new Arc2D.Double(-9.0, -7.0, 10,
                                  14, 0.0, 25.5,  Arc2D.OPEN), true);
    shape.append(new Arc2D.Double(0.0, -7.0, 10,
                                  14, 154.5, 25.5,  Arc2D.OPEN), true);
    shape.closePath();
    getTransform().setToTranslation(plotArea.getMinX(), plotArea.getMaxY());
    getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3);
    shape.transform(getTransform());

    if ((rotate != null) && (angle != 0)) {
        /// we have rotation
        getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
        shape.transform(getTransform());
    }

    defaultDisplay(g2, shape);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:ShipNeedle.java

示例6: getWindow

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * Returns the shape for the window for this dial.  Some dial layers will
 * request that their drawing be clipped within this window.
 *
 * @param frame  the reference frame (<code>null</code> not permitted).
 *
 * @return The shape of the dial's window.
 */
public Shape getWindow(Rectangle2D frame) {
    
    Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame, 
            this.innerRadius, this.innerRadius);
    Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame, 
            this.outerRadius, this.outerRadius);
    Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle, this.extent, 
            Arc2D.OPEN);
    Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle 
            + this.extent, - this.extent, Arc2D.OPEN);
    GeneralPath p = new GeneralPath();
    Point2D point1 = inner.getStartPoint();
    p.moveTo((float) point1.getX(), (float) point1.getY());
    p.append(inner, true);
    p.append(outer, true);
    p.closePath();
    return p;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:StandardDialFrame.java

示例7: getOuterWindow

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
protected Shape getOuterWindow(Rectangle2D frame) {
    double radiusMargin = 0.02;
    double angleMargin = 1.5;
    Rectangle2D innerFrame = DialPlot.rectangleByRadius(frame, 
            this.innerRadius - radiusMargin, this.innerRadius 
            - radiusMargin);
    Rectangle2D outerFrame = DialPlot.rectangleByRadius(frame, 
            this.outerRadius + radiusMargin, this.outerRadius 
            + radiusMargin);
    Arc2D inner = new Arc2D.Double(innerFrame, this.startAngle 
            - angleMargin, this.extent + 2 * angleMargin, Arc2D.OPEN);
    Arc2D outer = new Arc2D.Double(outerFrame, this.startAngle 
            + angleMargin + this.extent, - this.extent - 2 * angleMargin, 
            Arc2D.OPEN);
    GeneralPath p = new GeneralPath();
    Point2D point1 = inner.getStartPoint();
    p.moveTo((float) point1.getX(), (float) point1.getY());
    p.append(inner, true);
    p.append(outer, true);
    p.closePath();
    return p;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:StandardDialFrame.java

示例8: coArcTo

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
private static void coArcTo(GeneralPath p, double x2, double y2, double x3, double y3) {
	Point2D p1 = p.getCurrentPoint();
	double x1 = p1.getX();
	double y1 = p1.getY();
	boolean xe = (x1 == x2 && x2 == x3);
	boolean ye = (y1 == y2 && y2 == y3);
	if (xe && ye) return;
	if (xe || ye) { p.lineTo(x3, y3); return; }
	double d = arcHK(x1, y1, x2, y2, x3, y3);
	double h = arcH(x1, y1, x2, y2, x3, y3) / d;
	double k = arcK(x1, y1, x2, y2, x3, y3) / d;
	if (Double.isNaN(h) || Double.isInfinite(h)) { p.lineTo(x3, y3); return; }
	if (Double.isNaN(k) || Double.isInfinite(k)) { p.lineTo(x3, y3); return; }
	double r = Math.hypot(k - y1, x1 - h);
	double a1 = Math.toDegrees(Math.atan2(k - y1, x1 - h));
	double a2 = Math.toDegrees(Math.atan2(k - y2, x2 - h));
	double a3 = Math.toDegrees(Math.atan2(k - y3, x3 - h));
	Arc2D.Double arc = new Arc2D.Double();
	arc.x = h - r;
	arc.y = k - r;
	arc.width = r + r;
	arc.height = r + r;
	arc.start = a1;
	if ((a1 <= a2 && a2 <= a3) || (a3 <= a2 && a2 <= a1)) {
		arc.extent = a3 - a1;
	} else if (a3 <= a1) {
		arc.extent = a3 - a1 + 360;
	} else {
		arc.extent = a3 - a1 - 360;
	}
	p.append(arc, true);
}
 
开发者ID:kreativekorp,项目名称:vexillo,代码行数:33,代码来源:Symbol.java

示例9: getOutline

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
public Shape getOutline(AffineTransform tx) {

        GeneralPath dstShape = new GeneralPath(GeneralPath.WIND_NON_ZERO);

        for (int i=0, n = 0; i < fComponents.length; i++, n += 2) {
            TextLineComponent tlc = fComponents[getComponentLogicalIndex(i)];

            dstShape.append(tlc.getOutline(locs[n], locs[n+1]), false);
        }

        if (tx != null) {
            dstShape.transform(tx);
        }
        return dstShape;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:TextLine.java

示例10: getGlyphVectorOutline

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
    GeneralPath path = null;
    GeneralPath gp;
    int glyphIndex = 0;
    int[] tmpGlyphs;

    while (glyphIndex < glyphs.length) {
        int start = glyphIndex;
        int slot = glyphs[glyphIndex] >>> 24;
        while (glyphIndex < glyphs.length &&
               (glyphs[glyphIndex+1] >>> 24) == slot) {
            glyphIndex++;
        }
        int tmpLen = glyphIndex-start+1;
        tmpGlyphs = new int[tmpLen];
        for (int i=0;i<tmpLen;i++) {
            tmpGlyphs[i] = glyphs[i] & SLOTMASK;
        }
        gp = getStrikeForSlot(slot).getGlyphVectorOutline(tmpGlyphs, x, y);
        if (path == null) {
            path = gp;
        } else if (gp != null) {
            path.append(gp, false);
        }
    }
    if (path == null) {
        return new GeneralPath();
    } else {
        return path;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:CompositeStrike.java

示例11: rect

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 *
 */
public void rect(double x, double y, double w, double h)
{
	currentPath = new GeneralPath();
	currentPath.append(new Rectangle2D.Double((state.dx + x) * state.scale,
			(state.dy + y) * state.scale, w * state.scale, h * state.scale),
			false);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:11,代码来源:mxGraphicsCanvas2D.java

示例12: subdivide

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
private GeneralPath subdivide (Point b0, Point b1, Point b2, Point b3) {            
    double cutDistance = getTargetAnchorShape().getCutDistance();
    double minDistance = cutDistance - ENDPOINT_DEVIATION;
    /**
     * if the cutDistance is valid the last segment of the curve
     * gets reduced by subdivision until the distance of the endpoint(epDistance) 
     * satisfys the condition (cutDistance > epDistance > (cutDistance - ENDPOINT-DEVIATION)
     */
    if(cutDistance > minDistance && minDistance > 0 ) {
        GeneralPath path = new GeneralPath(); 
        
        path.moveTo(b0.x, b0.y);
        
        CubicCurve2D.Double left = new CubicCurve2D.Double(
                b0.x, b0.y, 
                b1.x, b1.y,
                b2.x, b2.y, 
                b3.x, b3.y);
        
        CubicCurve2D right=new CubicCurve2D.Double();
        left.subdivide(left, right);   
        double distance = b3.distance(left.getP2());
        //if the distance is bigger as the cutDistance the left segment is added
        //and the right segment is divided again
        while(distance>cutDistance){                    
            path.append(left, true);
            right.subdivide(left, right);
            distance = b3.distance(left.getP2());
            //if the devision removed to much the left segment is divided
            while(distance < minDistance) {                            
                //changes the distance to ~ (distance+distance/2)
                left.subdivide(left, right);
                distance = b3.distance(left.getP2());
            }
        }                  
        //append the last segment with (minDistance < distance < cutDistance)
        //actually we should check if the a division happend, but this is very unlikly
        path.append(left, true);         
        return path;
    }
    return null;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:43,代码来源:BezierWidget.java

示例13: ellipse

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * 
 */
public void ellipse(double x, double y, double w, double h) {
  currentPath = new GeneralPath();
  currentPath.append(new Ellipse2D.Double((state.dx + x) * state.scale,
      (state.dy + y) * state.scale, w * state.scale, h * state.scale), false);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:mxGraphicsCanvas2D.java

示例14: getUnionRhombus

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
private GeneralPath getUnionRhombus() {
    GeneralPath unionPath = new GeneralPath();

    int count = 1;
    int square = 1;
    while (square < stars) {
        count++;
        square = count * count;
    }
    int rows = stars / count;
    if (rows * count < stars) rows++;
    int starCount = 0;
    double a = WIDTH / 2 - BEND_X;
    double b = HEIGHT / 2 - BEND_Y;

    if (stars < 14) {
        double c = Math.sqrt(a * a + b * b);
        double r = (a * b) / c;
        double radius = 0.6 * r;
        unionPath = getCircleOfStars(radius);
        center(unionPath, WIDTH / 2, HEIGHT / 2);
    } else {
        double dx = a / count;
        double dy = b / count;
        double dx1 = a / rows;
        double dy1 = b / rows;
        outer: for (int index = 0; index < rows; index++) {
            double x = BEND_X + dx + index * dx1;
            double y = HEIGHT / 2 - index * dy1;
            for (int star = 0; star < count; star++) {
                unionPath.append(getStar(x, y), false);
                starCount++;
                if (starCount == stars) {
                    break outer;
                } else {
                    x += dx;
                    y += dy;
                }
            }
        }
    }

    return unionPath;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:45,代码来源:Flag.java

示例15: createReligiousMissionLabel

import java.awt.geom.GeneralPath; //导入方法依赖的package包/类
/**
 * Draws a cross indicating a religious mission is present in the
 * native village.
 *
 * @param extent The nominal height of the image.
 * @param padding Padding to add around the image.
 * @param backgroundColor The image background color.
 * @param expertMissionary True if the label should show expertise.
 * @return A suitable {@code BufferedImage}.
 */
private static BufferedImage createReligiousMissionLabel(int extent,
        int padding, Color backgroundColor, boolean expertMissionary) {
    // create path
    double offset = extent * 0.5;
    double size1 = extent - padding - padding;
    double bar = size1 / 3.0;
    double inset = 0.0;
    double kludge = 0.0;

    GeneralPath circle = new GeneralPath();
    GeneralPath cross = new GeneralPath();
    if (expertMissionary) {
        // this is meant to represent the eucharist (the -1, +1 thing is a nasty kludge)
        circle.append(new Ellipse2D.Double(padding-1, padding-1, size1+1, size1+1), false);
        inset = 4.0;
        bar = (size1 - inset - inset) / 3.0;
        // more nasty -1, +1 kludges
        kludge = 1.0;
    }
    offset -= 1.0;
    cross.moveTo(offset, padding + inset - kludge);
    cross.lineTo(offset, extent - padding - inset);
    cross.moveTo(offset - bar, padding + bar + inset);
    cross.lineTo(offset + bar + 1, padding + bar + inset);

    // draw everything
    BufferedImage bi = new BufferedImage(extent, extent, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = bi.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setColor(backgroundColor);
    g.fill(new RoundRectangle2D.Float(0, 0, extent, extent, padding, padding));
    g.setColor(ImageLibrary.getForegroundColor(backgroundColor));
    if (expertMissionary) {
        g.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
        g.draw(circle);
        g.setStroke(new BasicStroke(1.6f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    } else {
        g.setStroke(new BasicStroke(2.4f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    }
    g.draw(cross);
    g.dispose();
    return bi;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:55,代码来源:MapViewer.java


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