if (shape.isVisible()) {
int x = shape.getX();
int y = shape.getY();
Bounds transformedBounds = shape.getTransformedBounds();
transformedBounds = transformedBounds.translate(x, y);
if (transformedBounds.intersects(clipBounds)) {
Graphics2D shapeGraphics = (Graphics2D)graphics.create();
shapeGraphics.translate(x, y);
shapeGraphics.transform(shape.getTransforms().getAffineTransform());