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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static
final
Anchor
|
BOTTOM
|
Represents the bottom-center point of a bounding rectangle. | |||||||||
static
final
Anchor
|
BOTTOM_LEFT
|
Represents the bottom-left point of a bounding rectangle. | |||||||||
static
final
Anchor
|
BOTTOM_RIGHT
|
Represents the bottom-right point of a bounding rectangle. | |||||||||
static
final
Anchor
|
CENTER
|
Represents the middle-center point of a bounding rectangle. | |||||||||
static
final
Anchor
|
LEFT
|
Represents the middle-left point of a bounding rectangle. | |||||||||
static
final
Anchor
|
RIGHT
|
Represents the middle-right point of a bounding rectangle. | |||||||||
static
final
Anchor
|
TOP
|
Represents the top-center point of a bounding rectangle. | |||||||||
static
final
Anchor
|
TOP_LEFT
|
Represents the top-left point of a bounding rectangle. | |||||||||
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. | ||||||||||
static
Anchor
|
fractional(float x, float y)
Gets an anchor that represents a relative position inside a bounding
box.
| ||||||||||
abstract
PointF
|
getPoint(RectF bounds)
Gets the point in the specified rectangle that the receiving anchor
represents.
| ||||||||||
final
PointF
|
of(Shape shape)
Gets a point that represents the location of the receiver on the
specified shape.
| ||||||||||
final
PointF
|
of(View view)
Gets a point that represents the location of the receiver on the
specified view.
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
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.
a PointAndAnchor
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.
A PointAndAnchor
object.
Gets an anchor that represents a relative position inside a bounding
box. The values x
and y
represent fractions of the width
and height of the box, so 0.0 would represent the left/top and 1.0 would
represent the right/bottom. Negative values and values greater than one
would position the anchor outside the box.
an Anchor
representing the specified relative position
inside the bounding box
Gets the point in the specified rectangle that the receiving anchor represents.
a PointF object that represents the location of the anchor
Gets a point that represents the location of the receiver on the specified shape.
A PointF object that represents the location of the receiver on the shape.
Gets a point that represents the location of the receiver on the specified view.
A PointF object that represents the location of the receiver on the shape view.