java.lang.Object | |
↳ | sofia.graphics.Anchor |
An Anchor
represents a point inside or on a bounding rectangle that
is used to position a shape relative to another shape.
Pre-existing anchors are provided for the nine common anchor points that
most people will want to use: TOP_LEFT
, TOP
,
TOP_RIGHT
; LEFT
, CENTER
, RIGHT
;
and BOTTOM_LEFT
, BOTTOM
, BOTTOM_RIGHT
.
Since Anchor
is an abstract class, users can easily implement their
own custom anchors for different types of shapes. For example, a circle
might provide anchors that lie on the curve itself rather than on its
bounding box.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Anchor | BOTTOM | Represents the bottom-center point of a bounding rectangle. | |||||||||
public static final Anchor | BOTTOM_LEFT | Represents the bottom-left point of a bounding rectangle. | |||||||||
public static final Anchor | BOTTOM_RIGHT | Represents the bottom-right point of a bounding rectangle. | |||||||||
public static final Anchor | CENTER | Represents the middle-center point of a bounding rectangle. | |||||||||
public static final Anchor | LEFT | Represents the middle-left point of a bounding rectangle. | |||||||||
public static final Anchor | RIGHT | Represents the middle-right point of a bounding rectangle. | |||||||||
public static final Anchor | TOP | Represents the top-center point of a bounding rectangle. | |||||||||
public static final Anchor | TOP_LEFT | Represents the top-left point of a bounding rectangle. | |||||||||
public static final Anchor | TOP_RIGHT | Represents the top-right point of a bounding rectangle. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Anchor() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final PointAndAnchor |
anchoredAt(PointF point)
Gets a PointAndAnchor object that represents the notion of
positioning a shape such that the receiving anchor point on that shape
is located at the specified point.
| ||||||||||
final PointAndAnchor |
anchoredAt(float x, float y)
Gets a PointAndAnchor object that represents the notion of
positioning a shape such that the receiving anchor point on that shape
is located at the specified point.
| ||||||||||
abstract PointF |
getPoint(RectF bounds)
Gets the point in the specified rectangle that the receiving anchor
represents.
| ||||||||||
final PointF |
of(View view)
Gets a point that represents the location of the receiver on the
specified view.
| ||||||||||
final PointF |
of(Shape shape)
Gets a point that represents the location of the receiver on the
specified shape.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Gets a PointAndAnchor object that represents the notion of positioning a shape such that the receiving anchor point on that shape is located at the specified point.
point | the point |
---|
Gets a PointAndAnchor object that represents the notion of positioning a shape such that the receiving anchor point on that shape is located at the specified point.
x | The x-coordinate. |
---|---|
y | The y-coordinate. |
Gets the point in the specified rectangle that the receiving anchor represents.
bounds | the bounding rectangle |
---|
Gets a point that represents the location of the receiver on the specified view.
PointF
object that represents the location of the
receiver on the shape view.
Gets a point that represents the location of the receiver on the specified shape.
shape | The shape. |
---|
PointF
object that represents the location of the
receiver on the shape.