Encapsulates a Postscript-style "path". More...
Inherits BArchivable.
Public Member Functions | |
BShape () | |
Creates an empty BShape object. | |
BShape (BMessage *archive) | |
Creates a new BShape message from an archive message. | |
BShape (const BShape &other) | |
Creates a new BShape object as a copy of other. | |
virtual | ~BShape () |
Destructor, deletes all associated data. | |
status_t | AddShape (const BShape *other) |
Adds the lines and curves of otherShape to BShape. | |
BRect | Bounds () const |
Returns a BRect that encloses all points in the BShape. | |
void | Clear () |
Deletes all data returning the BShape to an empty state. | |
BPoint | CurrentPosition () const |
Returns the current end point of the path. | |
Operators | |
BShape & | operator= (const BShape &other) |
Constructs a BShape object as a copy of other by overloading the = operator. | |
bool | operator== (const BShape &other) const |
Returns whether or not the contents of this BShape and other contain the same data. | |
bool | operator!= (const BShape &other) const |
Returns whether or not the contents of this BShape and other do NOT contain the same data. | |
Operations | |
status_t | MoveTo (BPoint point) |
Adds a "move to" operation to the BShape. | |
status_t | LineTo (BPoint linePoint) |
Adds a "draw line" operation to the BShape. | |
status_t | BezierTo (BPoint controlPoints[3]) |
Adds a "draw Bézier curve" operation to the BShape. | |
status_t | BezierTo (const BPoint &control1, const BPoint &control2, const BPoint &endPoint) |
Adds a "draw Bézier curve" operation to the BShape. | |
status_t | ArcTo (float rx, float ry, float angle, bool largeArc, bool counterClockWise, const BPoint &point) |
Adds a "draw arc" operation to the BShape. | |
status_t | Close () |
Adds an operation to close the BShape once it is fully constructed. | |
Public Member Functions inherited from BArchivable | |
BArchivable () | |
Constructor. Does nothing. | |
BArchivable (BMessage *from) | |
Constructor. Does important behind-the-scenes work in the unarchiving process. | |
virtual | ~BArchivable () |
Destructor. Does nothing. | |
virtual status_t | AllArchived (BMessage *archive) const |
Method relating to the use of BArchiver . | |
virtual status_t | AllUnarchived (const BMessage *archive) |
Method relating to the use of BUnarchiver . | |
virtual status_t | Archive (BMessage *into, bool deep=true) const |
Archive the object into a BMessage. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
Archiving | |
virtual status_t | Archive (BMessage *archive, bool deep=true) const |
Archives the BShape object to a BMessage. | |
static BArchivable * | Instantiate (BMessage *archive) |
Creates a new BShape object from an archive message. | |
Additional Inherited Members | |
Static Public Member Functions inherited from BArchivable | |
static BArchivable * | Instantiate (BMessage *archive) |
Static member to restore objects from messages. | |
Encapsulates a Postscript-style "path".
You can obtain the outlines of characters from a string as BShape objects by calling BFont::GetGlyphShapes().
BShape::BShape | ( | ) |
Creates an empty BShape object.
BShape::BShape | ( | const BShape & | other | ) |
BShape::BShape | ( | BMessage * | archive | ) |
Creates a new BShape message from an archive message.
You should call Instantiate() instead as it will validate whether or not the object was created successfully.
archive | The BMessage object to construct the data from. |
|
virtual |
Destructor, deletes all associated data.
Archives the BShape object to a BMessage.
B_OK
on scucess or an error code otherwise.Reimplemented from BArchivable.
status_t BShape::ArcTo | ( | float | rx, |
float | ry, | ||
float | angle, | ||
bool | largeArc, | ||
bool | counterClockWise, | ||
const BPoint & | point | ||
) |
Adds a "draw arc" operation to the BShape.
An arc is draw that begins at the current point and is specified by the parameters to this method.
rx | The horizontal radius of the arc. |
ry | The vertical radius of the arc. |
angle | The starting angle of the arc in degrees. |
largeArc | Whether or not to draw a large arc. |
counterClockWise | true to draw the arc counter-clockwise, false to draw the arc clockwise. |
point | The center point of the arc. |
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
Adds a "draw Bézier curve" operation to the BShape.
A Bézier curve is drawn that begins at the current point and is made up of the specified controlPoints.
controlPoints | The points that make up the Bézier curve. |
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
status_t BShape::BezierTo | ( | const BPoint & | control1, |
const BPoint & | control2, | ||
const BPoint & | endPoint | ||
) |
Adds a "draw Bézier curve" operation to the BShape.
A Bézier curve is drawn that begins at the current point and is made up of the specified points.
control1 | The first control point of the Bézier curve. |
control2 | The second control point of the Bézier curve. |
endPoint | The end point of the Bézier curve. |
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
BRect BShape::Bounds | ( | ) | const |
void BShape::Clear | ( | ) |
Deletes all data returning the BShape to an empty state.
status_t BShape::Close | ( | ) |
Adds an operation to close the BShape once it is fully constructed.
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
BPoint BShape::CurrentPosition | ( | ) | const |
Returns the current end point of the path.
B_ORIGIN
if no points have been added yet.
|
static |
Adds a "draw line" operation to the BShape.
A line will be drawn from the previous point to the point specified.
point | The point to draw a line to starting at the previous location. |
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
Adds a "move to" operation to the BShape.
The next LineTo() or BezierTo() will begin at point allowing you to create noncontiguous shapes.
point | The point to start the next LineTo() or BezierTo() at. |
B_OK
on success or an error code otherwise. B_OK | The operation was added successfully. |
B_NO_MEMORY | Ran out of memory while trying to add the operation. |
bool BShape::operator!= | ( | const BShape & | other | ) | const |
Returns whether or not the contents of this BShape and other do NOT contain the same data.
true
if the contents are NOT equal, false
otherwise.