I want to make such an object, and put on it a blur according to Gauss
- Yes, it seems we are giving the parameters for the documentation and everything seems to be here and there clearly shows docs.oracle.com/javase/tutorial/2d/geometry/primitives.html - Alexey Shimansky
- thanks, all worked well! - Mrchebik
- @ Alexey Shimansky Please post your comment as a response. - Nicolas Chabanovsky ♦
|
2 answers
In order to round the corners of a rectangle, it is enough just to call the appropriate class methods.
If you follow the documentation , you can see that the parameters are responsible for the rounding:
arcWidth — defines the horizontal diameter of the arc at the four corners of the rectangle. arcHeight — defines the vertical diameter of the arc at the four corners of the rectangle.
They can be set via setArcWidth and setArcHeight respectively.
Rectangle rect = new Rectangle(110, 110, 200, 200); rect.setArcWidth(20); rect.setArcHeight(20); rect.setStroke(Color.GREEN); rect.setStrokeWidth(10); If Canvas used, then when drawing, you can specify these parameters directly in the designer with the 5th and 6th parameters:
GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setFill(Color.RED); gc.fillRoundRect(50, 50, 100, 100, 30, 30); |
It is possible to use css : -fx-border-radius and -fx-border-insets
|
