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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations