use of java.awt.geom.Path2D in project jdk8u_jdk by JetBrains.
the class Path2DCopyConstructor method test.
static void test(Path2D p2d, boolean isEmpty) {
testEqual(new Path2D.Float(p2d), p2d);
testEqual(new Path2D.Double(p2d), p2d);
testEqual(new GeneralPath(p2d), p2d);
testIterator(new Path2D.Float(p2d), p2d);
testIterator(new Path2D.Double(p2d), p2d);
testIterator((Path2D) p2d.clone(), p2d);
testFlattening(new Path2D.Float(p2d), p2d);
testFlattening(new Path2D.Double(p2d), p2d);
testFlattening((Path2D) p2d.clone(), p2d);
testAddMove(new Path2D.Float(p2d));
testAddMove(new Path2D.Double(p2d));
testAddMove((Path2D) p2d.clone());
// These should expect exception if empty
testAddLine(new Path2D.Float(p2d), isEmpty);
testAddLine(new Path2D.Double(p2d), isEmpty);
testAddLine((Path2D) p2d.clone(), isEmpty);
testAddQuad(new Path2D.Float(p2d), isEmpty);
testAddQuad(new Path2D.Double(p2d), isEmpty);
testAddQuad((Path2D) p2d.clone(), isEmpty);
testAddCubic(new Path2D.Float(p2d), isEmpty);
testAddCubic(new Path2D.Double(p2d), isEmpty);
testAddCubic((Path2D) p2d.clone(), isEmpty);
testAddClose(new Path2D.Float(p2d), isEmpty);
testAddClose(new Path2D.Double(p2d), isEmpty);
testAddClose((Path2D) p2d.clone(), isEmpty);
testGetBounds(new Path2D.Float(p2d), p2d);
testGetBounds(new Path2D.Double(p2d), p2d);
testGetBounds((Path2D) p2d.clone(), p2d);
testTransform(new Path2D.Float(p2d));
testTransform(new Path2D.Double(p2d));
testTransform((Path2D) p2d.clone());
testIntersect(new Path2D.Float(p2d), p2d);
testIntersect(new Path2D.Double(p2d), p2d);
testIntersect((Path2D) p2d.clone(), p2d);
testContains(new Path2D.Float(p2d), p2d);
testContains(new Path2D.Double(p2d), p2d);
testContains((Path2D) p2d.clone(), p2d);
testGetCurrentPoint(new Path2D.Float(p2d), p2d);
testGetCurrentPoint(new Path2D.Double(p2d), p2d);
testGetCurrentPoint((Path2D) p2d.clone(), p2d);
}
use of java.awt.geom.Path2D in project intellij-community by JetBrains.
the class EditorPainter method getBorderShape.
private static Shape getBorderShape(float x, float y, float width, int height, boolean rounded) {
if (width <= 0 || height <= 0)
return null;
Shape outer = rounded ? new RoundRectangle2D.Float(x, y, width, height, 2, 2) : new Rectangle2D.Float(x, y, width, height);
if (width <= 2 || height <= 2)
return outer;
Shape inner = new Rectangle2D.Float(x + 1, y + 1, width - 2, height - 2);
Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
path.append(outer, false);
path.append(inner, false);
return path;
}
use of java.awt.geom.Path2D in project aima-java by aimacode.
the class GraphicsTransfer2D method transfer.
/**
* Transfers a {@link Polyline2D} into its {@link Shape} representative.
* @param polyline the polyline to be transferred.
* @return the transferred shape.
*/
private static Shape transfer(Polyline2D polyline) {
Path2D result = new java.awt.geom.Path2D.Double();
Point2D[] vertexes = polyline.getVertexes();
result.moveTo(vertexes[0].getX(), vertexes[0].getY());
for (int i = 1; i < vertexes.length; i++) {
result.lineTo(vertexes[i].getX(), vertexes[i].getY());
}
if (polyline.isClosed())
result.closePath();
return result;
}
use of java.awt.geom.Path2D in project poi by apache.
the class ShapeDebuggerRenderer method drawPath.
@Override
protected Path2D drawPath(XDGFShape shape) {
Path2D path = super.drawPath(shape);
if (_debugAcceptor == null || _debugAcceptor.accept(shape)) {
// show numbers to associate shapes with ids.. doesn't always work
Font f = _graphics.getFont();
_graphics.scale(1, -1);
_graphics.setFont(f.deriveFont(0.05F));
String shapeId = "" + shape.getID();
float shapeOffset = -0.1F;
if (shape.hasMasterShape()) {
shapeId += " MS:" + shape.getMasterShape().getID();
shapeOffset -= 0.15F;
}
_graphics.drawString(shapeId, shapeOffset, 0);
_graphics.setFont(f);
_graphics.scale(1, -1);
}
return path;
}
use of java.awt.geom.Path2D in project frostwire by frostwire.
the class SkinTableHeaderPainter method paintBorder.
private void paintBorder(Graphics2D g, int width, int height) {
Path2D path = new Path2D.Double(Path2D.WIND_EVEN_ODD);
path.reset();
path.moveTo(0, height - 1);
path.lineTo(width - 1, height - 1);
path.lineTo(width - 1, 0);
g.setPaint(SkinColors.TABLE_HEADER_BORDER_COLOR);
g.draw(path);
}
Aggregations