Loading...
Searching...
No Matches
Public Member Functions | List of all members
BShape Class Reference

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
BShapeoperator= (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 BArchivableInstantiate (BMessage *archive)
 Creates a new BShape object from an archive message.
 

Additional Inherited Members

- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages.
 

Detailed Description

Encapsulates a Postscript-style "path".

You can obtain the outlines of characters from a string as BShape objects by calling BFont::GetGlyphShapes().

Since
BeOS R4

Constructor & Destructor Documentation

◆ BShape() [1/3]

BShape::BShape ( )

Creates an empty BShape object.

Since
BeOS R4

◆ BShape() [2/3]

BShape::BShape ( const BShape other)

Creates a new BShape object as a copy of other.

Parameters
otherThe BShape object to copy from.
Since
BeOS R4

◆ BShape() [3/3]

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.

Parameters
archiveThe BMessage object to construct the data from.
Since
BeOS R4

◆ ~BShape()

BShape::~BShape ( )
virtual

Destructor, deletes all associated data.

Since
BeOS R4

Member Function Documentation

◆ AddShape()

status_t BShape::AddShape ( const BShape otherShape)

Adds the lines and curves of otherShape to BShape.

Returns
Always returns B_OK.
Since
BeOS R4

◆ Archive()

status_t BShape::Archive ( BMessage archive,
bool  deep = true 
) const
virtual

Archives the BShape object to a BMessage.

Parameters
archiveThe BMessage object to archive the BShape data to.
deepCurrently unused.
Returns
A status code, B_OK on scucess or an error code otherwise.
Since
BeOS R4

Reimplemented from BArchivable.

◆ ArcTo()

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.

Parameters
rxThe horizontal radius of the arc.
ryThe vertical radius of the arc.
angleThe starting angle of the arc in degrees.
largeArcWhether or not to draw a large arc.
counterClockWisetrue to draw the arc counter-clockwise, false to draw the arc clockwise.
pointThe center point of the arc.
Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
Haiku R1

◆ BezierTo() [1/2]

status_t BShape::BezierTo ( BPoint  controlPoints[3])

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.

Parameters
controlPointsThe points that make up the Bézier curve.
Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
BeOS R4

◆ BezierTo() [2/2]

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.

Parameters
control1The first control point of the Bézier curve.
control2The second control point of the Bézier curve.
endPointThe end point of the Bézier curve.
Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
Haiku R1

◆ Bounds()

BRect BShape::Bounds ( ) const

Returns a BRect that encloses all points in the BShape.

Warning
This implementation doesn't take into account curves at all.
Since
BeOS R4

◆ Clear()

void BShape::Clear ( )

Deletes all data returning the BShape to an empty state.

Since
BeOS R4

◆ Close()

status_t BShape::Close ( )

Adds an operation to close the BShape once it is fully constructed.

Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
BeOS R4

◆ CurrentPosition()

BPoint BShape::CurrentPosition ( ) const

Returns the current end point of the path.

Returns
The current end point of the path or B_ORIGIN if no points have been added yet.
Since
Haiku R1

◆ Instantiate()

BArchivable * BShape::Instantiate ( BMessage archive)
static

Creates a new BShape object from an archive message.

Parameters
archiveThe BMessage object to construct the BShape data from.
Returns
A new BShape object or NULL if archive was invalid.
Since
BeOS R4

◆ LineTo()

status_t BShape::LineTo ( BPoint  point)

Adds a "draw line" operation to the BShape.

A line will be drawn from the previous point to the point specified.

Parameters
pointThe point to draw a line to starting at the previous location.
Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
BeOS R4

◆ MoveTo()

status_t BShape::MoveTo ( BPoint  point)

Adds a "move to" operation to the BShape.

The next LineTo() or BezierTo() will begin at point allowing you to create noncontiguous shapes.

Parameters
pointThe point to start the next LineTo() or BezierTo() at.
Returns
Returns a status code, B_OK on success or an error code otherwise.
Return values
B_OKThe operation was added successfully.
B_NO_MEMORYRan out of memory while trying to add the operation.
Since
BeOS R4

◆ operator!=()

bool BShape::operator!= ( const BShape other) const

Returns whether or not the contents of this BShape and other do NOT contain the same data.

Returns
true if the contents are NOT equal, false otherwise.
Since
Haiku R1

◆ operator=()

BShape & BShape::operator= ( const BShape other)

Constructs a BShape object as a copy of other by overloading the = operator.

Parameters
otherThe BShape object to copy from.

Always returns *this.

Since
Haiku R1

◆ operator==()

bool BShape::operator== ( const BShape other) const

Returns whether or not the contents of this BShape and other contain the same data.

Returns
true if the contents are equal, false otherwise.
Since
Haiku R1