BShape¶
Constructor and Destructor¶
BShape()
BShape::BShape()
BShape::BShape(const BShape ©From)
BShape::BShape(BMessage *archive)
Creates a new BShape object. The first form of the BShape constructor creates an empty shape. The second form, which accepts another BShape as an argument, copies that shape into the new one. The third form reconstructs a BShape from an archive.
~BShape()
virtual BShape::~BShape()
Releases memory occupied by the BShape object.
Member Functions¶
AddShape()
status_t BShape::AddShape(const BShape *otherShape)
AddShape() adds the lines and curves that comprise the otherShape to the shape.
Return Code |
Description |
---|---|
|
No error. |
Other errors. |
None are defined at this time, but you should always check for errors returned by this function. |
Archive()
virtual BShape::Archive(BMessage *archive, bool deep = true) const
Stores the BShape in the BMessage
archive.
See also: BArchivable::Archive()
,
Instantiate()
static function
BezierTo()
status_t BShape::BezierTo(BPoint controlPoints[3])
Adds a command to the BShape that represents a Beziér curve that begins at the current coordinates and is constructed using the specified control points.
Return Code |
Description |
---|---|
|
No error. |
Other errors. |
None are defined at this time, but you should always check for errors returned by this function. |
Bounds()
Bounds() returns the bounds rectangle of the entire shape; this rectangle encloses all the lines and Beziér curves that comprise the shape.
Clear()
void BShape::Clear()
Clear() deletes all the lines and Beziér curves that comprise the shape, leaving it empty.
Close()
void BShape::Close()
Close() should be called when the shape has been
fully-constructed by calls to the BezierTo()
,
LineTo()
, and MoveTo()
functions.
Return Code |
Description |
---|---|
|
No error. |
Other errors. |
None are defined at this time, but you should always check for errors returned by this function. |
LineTo()
status_t BShape::LineTo(BPoint point)
Adds a “draw line” command to the BShape. A line will be drawn from the previous coordinates to the specified coordinates.
Return Code |
Description |
---|---|
|
No error. |
Other errors. |
None are defined at this time, but you should always check for errors returned by this function. |
MoveTo()
status_t BShape::MoveTo(BPoint point)
Adds a “move to” command to the BShape. The next
LineTo()
or BezierTo()
will begin
at this point. This lets you create noncontiguous shapes.
Return Code |
Description |
---|---|
|
No error. |
Other errors. |
None are defined at this time, but you should always check for errors returned by this function. |
Static Functions¶
Instantiate()
static BArchivable *BShape::Instantiate(BMessage *archive)
Returns a new BShape object, allocated by new and created with
the version of the constructor that takes a BMessage
archive.
However, if the archive message doesn’t contain data for a BShape
object, the return value will be NULL.
Archived Fields¶
The Archive()
function adds the following fields to
its BMessage
argument:
Field |
Type code |
Description |
---|---|---|
pts |
|
The list of points used by the shape’s commands. |
ops |
|
The list of command opcodes indicating the shape’s commands. |