Search in sources :

Example 56 with GeneralPath

use of java.awt.geom.GeneralPath in project openblocks by mikaelhg.

the class CQueryField method getMag.

private Shape getMag(int w, int h) {
    Ellipse2D.Double e = new Ellipse2D.Double(h / 2, h / 6, h * 1 / 3, h * 1 / 3);
    GeneralPath shape = new GeneralPath();
    shape.moveTo(h / 3, h * 2 / 3);
    shape.lineTo(h / 2, h / 2);
    shape.append(e, false);
    return shape;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) Ellipse2D(java.awt.geom.Ellipse2D)

Example 57 with GeneralPath

use of java.awt.geom.GeneralPath in project scriptographer by scriptographer.

the class GraphicContext method clone.

/**
     * @return a deep copy of this context
     */
public Object clone() {
    GraphicContext copyGc = new GraphicContext(defaultTransform);
    //
    // Now, copy each GC element in turn
    //
    // Default transform
    /* Set in constructor */
    // Transform
    copyGc.transform = new AffineTransform(this.transform);
    // Transform stack
    copyGc.transformStack = new ArrayList<TransformStackElement>(transformStack.size());
    for (int i = 0; i < this.transformStack.size(); i++) {
        TransformStackElement stackElement = this.transformStack.get(i);
        copyGc.transformStack.add((TransformStackElement) stackElement.clone());
    }
    // Transform stack validity
    copyGc.transformStackValid = this.transformStackValid;
    // Paint (immutable by requirement)
    copyGc.paint = this.paint;
    // Stroke (immutable by requirement)
    copyGc.stroke = this.stroke;
    // Composite (immutable by requirement)
    copyGc.composite = this.composite;
    // Clip
    if (clip != null)
        copyGc.clip = new GeneralPath(clip);
    else
        copyGc.clip = null;
    // RenderingHints
    copyGc.hints = (RenderingHints) this.hints.clone();
    // Font (immutable)
    copyGc.font = this.font;
    // Background, Foreground (immutable)
    copyGc.background = this.background;
    copyGc.foreground = this.foreground;
    return copyGc;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) AffineTransform(java.awt.geom.AffineTransform) Paint(java.awt.Paint)

Example 58 with GeneralPath

use of java.awt.geom.GeneralPath in project scriptographer by scriptographer.

the class CompoundPath method toShape.

/**
	 * Converts to a Java2D shape.
	 * 
	 * @jshide
	 */
@Override
public GeneralPath toShape() {
    Path path = (Path) getFirstChild();
    GeneralPath shape = path.toShape();
    while ((path = (Path) path.getNextSibling()) != null) {
        shape.append(path.toShape(), false);
    }
    return shape;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) GeneralPath(java.awt.geom.GeneralPath)

Example 59 with GeneralPath

use of java.awt.geom.GeneralPath in project scriptographer by scriptographer.

the class Path method toShape.

/**
	 * Converts to a Java2D shape.
	 * 
	 * @jshide
	 */
public GeneralPath toShape() {
    GeneralPath path = new GeneralPath();
    SegmentList segments = getSegments();
    Segment first = segments.getFirst();
    path.moveTo((float) first.point.x, (float) first.point.y);
    Segment seg = first;
    for (int i = 1, l = segments.size(); i < l; i++) {
        Segment next = segments.get(i);
        addSegment(path, seg, next);
        seg = next;
    }
    if (isClosed()) {
        addSegment(path, seg, first);
        path.closePath();
    }
    path.setWindingRule(getStyle().getWindingRule() == WindingRule.NON_ZERO ? GeneralPath.WIND_NON_ZERO : GeneralPath.WIND_EVEN_ODD);
    return path;
}
Also used : GeneralPath(java.awt.geom.GeneralPath)

Example 60 with GeneralPath

use of java.awt.geom.GeneralPath in project android_frameworks_base by DirtyUnicorns.

the class Path_Delegate method offset.

/**
     * Offset the path by (dx,dy), returning true on success
     *
     * @param dx  The amount in the X direction to offset the entire path
     * @param dy  The amount in the Y direction to offset the entire path
     */
public void offset(float dx, float dy) {
    GeneralPath newPath = new GeneralPath();
    PathIterator iterator = mPath.getPathIterator(new AffineTransform(0, 0, dx, 0, 0, dy));
    newPath.append(iterator, false);
    mPath = newPath;
}
Also used : GeneralPath(java.awt.geom.GeneralPath) PathIterator(java.awt.geom.PathIterator) AffineTransform(java.awt.geom.AffineTransform)

Aggregations

GeneralPath (java.awt.geom.GeneralPath)96 Point (java.awt.Point)14 AffineTransform (java.awt.geom.AffineTransform)14 PathIterator (java.awt.geom.PathIterator)14 Graphics2D (java.awt.Graphics2D)8 Rectangle2D (java.awt.geom.Rectangle2D)8 Color (java.awt.Color)7 Paint (java.awt.Paint)7 BasicStroke (java.awt.BasicStroke)6 Point2D (java.awt.geom.Point2D)6 Stroke (java.awt.Stroke)5 Area (java.awt.geom.Area)4 Shape (java.awt.Shape)3 CubicCurve2D (java.awt.geom.CubicCurve2D)3 LayoutPathImpl (sun.font.LayoutPathImpl)3 GradientPaint (java.awt.GradientPaint)2 Rectangle (java.awt.Rectangle)2 Line2D (java.awt.geom.Line2D)2 RoundRectangle2D (java.awt.geom.RoundRectangle2D)2 JBColor (com.intellij.ui.JBColor)1