當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。