1 /*
2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
25
26 package javafx.scene.shape;
27
28 import com.sun.javafx.geom.BaseBounds;
29 import com.sun.javafx.geom.Ellipse2D;
30 import com.sun.javafx.geom.transform.BaseTransform;
31 import com.sun.javafx.scene.DirtyBits;
32 import com.sun.javafx.scene.NodeHelper;
33 import com.sun.javafx.scene.shape.CircleHelper;
34 import com.sun.javafx.scene.shape.ShapeHelper;
35 import com.sun.javafx.sg.prism.NGCircle;
36 import com.sun.javafx.sg.prism.NGNode;
37 import com.sun.javafx.sg.prism.NGShape;
38 import javafx.beans.property.DoubleProperty;
39 import javafx.beans.property.DoublePropertyBase;
40 import javafx.scene.Node;
41 import javafx.scene.paint.Paint;
42
43 /**
44 * The {@code Circle} class creates a new circle
45 * with the specified radius and center location measured in pixels
46 *
47 * Example usage. The following code creates a circle with radius 50px centered
48 * at (100,100)px.
49 *
50 <PRE>
51 import javafx.scene.shape.*;
52
53 Circle circle = new Circle();
54 circle.setCenterX(100.0f);
55 circle.setCenterY(100.0f);
56 circle.setRadius(50.0f);
57 }
58 </PRE>
59 * @since JavaFX 2.0
60 */
61 public class Circle extends Shape {
62 static {
63 CircleHelper.setCircleAccessor(new CircleHelper.CircleAccessor() {
64 @Override
65 public NGNode doCreatePeer(Node node) {
66 return ((Circle) node).doCreatePeer();
67 }
68
69 @Override
70 public void doUpdatePeer(Node node) {
71 ((Circle) node).doUpdatePeer();
72 }
73
74 @Override
75 public BaseBounds doComputeGeomBounds(Node node,
76 BaseBounds bounds, BaseTransform tx) {
77 return ((Circle) node).doComputeGeomBounds(bounds, tx);
78 }
|
1 /*
2 * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
25
26 package javafx.scene.shape;
27
28 import com.sun.javafx.geom.BaseBounds;
29 import com.sun.javafx.geom.Ellipse2D;
30 import com.sun.javafx.geom.transform.BaseTransform;
31 import com.sun.javafx.scene.DirtyBits;
32 import com.sun.javafx.scene.NodeHelper;
33 import com.sun.javafx.scene.shape.CircleHelper;
34 import com.sun.javafx.scene.shape.ShapeHelper;
35 import com.sun.javafx.sg.prism.NGCircle;
36 import com.sun.javafx.sg.prism.NGNode;
37 import com.sun.javafx.sg.prism.NGShape;
38 import javafx.beans.property.DoubleProperty;
39 import javafx.beans.property.DoublePropertyBase;
40 import javafx.scene.Node;
41 import javafx.scene.paint.Paint;
42
43 /**
44 * The {@code Circle} class creates a new circle
45 * with the specified radius and center location measured in pixels.
46 * <p>
47 * Example usage. The following code creates a circle with radius of 50 pixels
48 * centered at (100,100).
49 * </p>
50 *
51 <pre>{@code
52 import javafx.scene.shape.Circle;
53
54 Circle circle = new Circle();
55 circle.setCenterX(100.0f);
56 circle.setCenterY(100.0f);
57 circle.setRadius(50.0f);
58 }</pre>
59 * @since JavaFX 2.0
60 */
61 public class Circle extends Shape {
62 static {
63 CircleHelper.setCircleAccessor(new CircleHelper.CircleAccessor() {
64 @Override
65 public NGNode doCreatePeer(Node node) {
66 return ((Circle) node).doCreatePeer();
67 }
68
69 @Override
70 public void doUpdatePeer(Node node) {
71 ((Circle) node).doUpdatePeer();
72 }
73
74 @Override
75 public BaseBounds doComputeGeomBounds(Node node,
76 BaseBounds bounds, BaseTransform tx) {
77 return ((Circle) node).doComputeGeomBounds(bounds, tx);
78 }
|