BShape

Derived From:
Mix-in Classes:BArchivable
Declared In:interface/Shape.h
Library:libbe.so
Allocation:Constructor only
Class Overview

Constructor and Destructor

BShape()

BShape(); BShape(const BShape& copyFrom); BShape(BMessagearchive);

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();

Releases memory occupied by the BShape object.


Member Functions

AddShape()

status_t AddShape(const BShape* otherShape);

AddShape() adds the lines and curves that comprise the otherShape to the shape.

Return CodeDescription

B_OK.

No error.

Other errors.

None are defined at this time, but you should always check for errors returned by this function.

Archive()

virtual Archive(BMessagearchive,
                bool deep = true) const;

Stores the BShape in the BMessage archive.

See also: BArchivable::Archive(), Instantiate() static function

BezierTo()

status_t 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 CodeDescription

B_OK.

No error.

Other errors.

None are defined at this time, but you should always check for errors returned by this function.

Bounds()

BRect Bounds() const;

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 Clear();

Clear() deletes all the lines and Beziér curves that comprise the shape, leaving it empty.

Close()

void Close();

Close() should be called when the shape has been fully-constructed by calls to the BezierTo(), LineTo(), and MoveTo() functions.

Return CodeDescription

B_OK.

No error.

Other errors.

None are defined at this time, but you should always check for errors returned by this function.

LineTo()

status_t 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 CodeDescription

B_OK.

No error.

Other errors.

None are defined at this time, but you should always check for errors returned by this function.

MoveTo()

status_t 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 CodeDescription

B_OK.

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 BArchivableInstantiate(BMessagearchive);

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.

BArchivable::Instantiate(), instantiate_object(), Archive()


Archived Fields

The Archive() function adds the following fields to its BMessage argument:

FieldType codeDescription
ptsB_POINT_TYPEThe list of points used by the shape's commands.
opsB_INT32_TYPEThe list of command opcodes indicating the shape's commands.
Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.