/*
* Copyright 2015 Laszlo Balazs-Csiki
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
* General Public License, version 3 as published by the Free
* Software Foundation.
*
* Pixelitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pixelitor. If not, see <http://www.gnu.org/licenses/>.
*/
package pixelitor.tools.shapes;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
* A custom shape based on a Path2D.Float
*/
public abstract class GeneralShape implements Shape {
final Path2D.Float path = new Path2D.Float();
@Override
public Rectangle getBounds() {
return path.getBounds();
}
@Override
public Rectangle2D getBounds2D() {
return path.getBounds2D();
}
@Override
public boolean contains(double x, double y) {
return path.contains(x, y);
}
@Override
public boolean contains(Point2D p) {
return path.contains(p);
}
@Override
public boolean intersects(double x, double y, double w, double h) {
return path.intersects(x, y, w, h);
}
@Override
public boolean intersects(Rectangle2D r) {
return path.intersects(r);
}
@Override
public boolean contains(double x, double y, double w, double h) {
return path.contains(x, y, w, h);
}
@Override
public boolean contains(Rectangle2D r) {
return path.contains(r);
}
@Override
public PathIterator getPathIterator(AffineTransform at) {
return path.getPathIterator(at);
}
@Override
public PathIterator getPathIterator(AffineTransform at, double flatness) {
return path.getPathIterator(at, flatness);
}
}