Skip to content
Snippets Groups Projects
Select Git revision
  • f6148c1d09f7ab5c4a248e8555a1c51a049a53cd
  • master default protected
2 results

Decorator.java

Blame
  • Forked from COUETOUX Basile / graphic-2020
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Decorator.java 722 B
    package shape;
    
    import javafx.geometry.Point2D;
    import javafx.scene.canvas.GraphicsContext;
    
    public abstract class Decorator implements Shape {
        protected Shape decoratedShape;
    
        public Decorator(Shape decoratedShape) {
            this.decoratedShape = decoratedShape;
        }
    
        @Override
        public int pointsCount() {
            return decoratedShape.pointsCount();
        }
    
        @Override
        public Point2D point(int index) {
            return decoratedShape.point(index);
        }
    
        @Override
        public void draw(GraphicsContext graphicsContext) {
            decoratedShape.draw(graphicsContext);
            drawDecoration(graphicsContext);
        }
    
        protected abstract void drawDecoration(GraphicsContext graphicsContext);
    }