The Interface Kit: BShapeIterator


Derived from: (none)

Declared in: be/interface/Shape.h


[method summary]

Applications can create classes derived from BShapeIterator to iterate over the components of a BShape object. There are four virtual functions that the application must implement to process the four graphics commands described in the BShape documentation: MoveTo(), LineTo(), BezierTo(), and Close().

These functions can be implemented to do anything they like with the commands (rendering them to the screen comes to mind as one possibility).

Constructor and Destructor





      virtual ~BShapeIterator() 


Member Functions


      status_t Iterate(BShape *shape)

Iterate() iterates over each command that comprises the shape, in order, calling the Iterate...() function that corresponds to each command.


B_OK. No error.

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

IterateBezier(), IterateClose(), IterateLineTo(), IterateMoveTo()

      virtual status_t IterateBezier(int32 bezierCount, BPoint * bezierPoints)
      virtual status_t IterateClose(void)
      virtual status_t IterateLineTo(int32 lineCount, BPoint * linePoints)
      virtual status_t IterateMoveTo(BPoint * point)

These functions are called by Iterate() to process the shape commands. Your BShapeIterator-derived class must implement these four functions.

The Be Book, in lovely HTML, for BeOS Release 4.

Copyright © 1998 Be, Inc. All rights reserved.

Last modified January 4, 1999.