/** * Transform the supplied shape with the overridden transform * method so that the shape is distorted by the perspective * transform. * @param shape a shape to transform * @return a GeneralPath for the transformed shape */ @Override public Shape transform(Shape shape) { return transform(shape, 0); } public Shape transform(Shape shape, float flatness) {
switch(type) { case PathIterator.SEG_MOVETO: Point2D p = transform(new Point2D.Float(coords[0], coords[1])); newPath.moveTo((float)p.getX(), (float)p.getY()); break; p = transform(new Point2D.Float(coords[0], coords[1])); newPath.lineTo((float)p.getX(), (float) p.getY()); break; p = transform(new Point2D.Float(coords[0], coords[1])); Point2D q = transform(new Point2D.Float(coords[2], coords[3])); newPath.quadTo((float)p.getX(), (float)p.getY(), (float)q.getX(), (float)q.getY()); break; p = transform(new Point2D.Float(coords[0], coords[1])); q = transform(new Point2D.Float(coords[2], coords[3])); Point2D r = transform(new Point2D.Float(coords[4], coords[5])); newPath.curveTo((float)p.getX(), (float)p.getY(), (float)q.getX(), (float)q.getY(),