Skip to content
Snippets Groups Projects
Select Git revision
  • 195b2e99a73d660ecfdf3b38045decfd48791e9c
  • main default protected
  • NewGraphicSystem
  • LayeredRendering
4 results

FrameBuffer-Instanced.vert

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CenterDecorator.java 843 B
    package shape;
    
    import javafx.geometry.Point2D;
    import javafx.scene.canvas.GraphicsContext;
    import javafx.scene.paint.Color;
    
    public class CenterDecorator extends Decorator{
        private final double radius;
        public CenterDecorator(Shape decoratedShape, double radius) {
            super(decoratedShape);
            this.radius = radius;
        }
            protected void drawDecoration(GraphicsContext context) {
    
            if (decoratedshape.pointsCount() >= 2) {
                Point2D point0 = decoratedshape.point(0);
                Point2D point1 = decoratedshape.point(1);
    
                double centerX = point0.getX() + point1.getX() / 2;
                double centerY = point0.getY() + point1.getY() / 2;
    
                context.setFill(Color.RED);
                context.strokeOval(centerX - radius, centerY - radius, radius * 2, radius * 2);
            }
        }
    }