Public Member Functions | List of all members
BPicture Class Reference

Records a series of drawing instructions that can be "replayed" later. More...

Inherits BArchivable.

Public Member Functions

 BPicture ()
 Initializes an empty BPicture object. More...
 
 BPicture (const BPicture &other)
 Initializes an BPicture object copying the data from otherPicture. More...
 
 BPicture (BMessage *data)
 Initializes an BPicture object copying the data from from the passed in data archive. More...
 
virtual ~BPicture ()
 Destroys the BPicture object and deletes all associated data. More...
 
status_t Flatten (BDataIO *stream)
 Flattens the contents of the BPicture object into stream. More...
 
virtual status_t Perform (perform_code code, void *arg)
 Perform some action (internal method defined for binary compatibility purposes). More...
 
status_t Play (void **callBackTable, int32 tableEntries, void *userData)
 Plays back a picture using the passed in call back functions. More...
 
status_t Unflatten (BDataIO *stream)
 Unflattens the contents from the stream into the BPicture object. More...
 
- Public Member Functions inherited from BArchivable
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process. More...
 
 BArchivable ()
 Constructor. Does nothing. More...
 
virtual ~BArchivable ()
 Destructor. Does nothing. More...
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver. More...
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver. More...
 

Archiving

virtual status_t Archive (BMessage *data, bool deep=true) const
 Archives the BPicture object into the data message. More...
 
static BArchivableInstantiate (BMessage *data)
 Returns a pointer to a new BPicture object created from the BPicture data archived in data. More...
 

Additional Inherited Members

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

Detailed Description

Records a series of drawing instructions that can be "replayed" later.

A BPicture, unlike a BBitmap, is independent of the display resolution as it contains drawing instructions rather than image data.

To begin drawing you first create a new BPicture object and pass it to BView::BeginPicture(). All subsequent drawing instructions are drawn into the BPicture object instead of the BView. When you are done recording call BView::EndPicture() which stops drawing into the BPicture object and passes a pointer to it back to the caller.

For example:

BPicture* picture;
view->BeginPicture(new BPicture);
// drawing instructions go here
picture = view->EndPicture();

Only drawing instructions performed directly on the view, not its child views are send to the BPicture object and BPicture captures only primitive graphics operations. The view must be attached to a window for the drawing instruction to be recorded. Drawing instructions are recorded even if the view is hidden or resides outside the clipping region or the window is off-screen.

The BPicture object data is erased when passed to BView::BeginPicture(). If you'd like to append data to a BPicture object instead use BView::AppendToPicture(). Both BView::BeginPicture() and BView::AppendToPicture() must be followed by a call to BView::EndPicture() to finish recording.

See also
BView::AppendToPicture()
BView::BeginPicture()
BView::EndPicture()
Since
BeOS R3

Constructor & Destructor Documentation

◆ BPicture() [1/3]

BPicture::BPicture ( )

Initializes an empty BPicture object.

Since
BeOS R3

◆ BPicture() [2/3]

BPicture::BPicture ( const BPicture otherPicture)

Initializes an BPicture object copying the data from otherPicture.

Since
BeOS R3

◆ BPicture() [3/3]

BPicture::BPicture ( BMessage data)

Initializes an BPicture object copying the data from from the passed in data archive.

Since
BeOS R3

◆ ~BPicture()

BPicture::~BPicture ( )
virtual

Destroys the BPicture object and deletes all associated data.

Since
BeOS R3

Member Function Documentation

◆ Archive()

status_t BPicture::Archive ( BMessage data,
bool  deep = true 
) const
virtual

Archives the BPicture object into the data message.

Parameters
dataA pointer to the BMessage object to archive into.
deepThe parameter has no effect to this method.
Returns
A status code, B_OK if everything went well or an error code otherwise.
Return values
B_OKThe object was archived successfully.
B_NO_MEMORYRan out of memory while archiving the object.
See also
BArchivable::Archive()
BPicture::Instantiate()
Since
BeOS R3

Reimplemented from BArchivable.

◆ Flatten()

status_t BPicture::Flatten ( BDataIO stream)

Flattens the contents of the BPicture object into stream.

Parameters
streamThe stream to write to.
Returns
A status code, B_OK on success or an error code otherwise.
Return values
B_OKThe BPicture object was flattened successfully.
B_BAD_VALUEThe stream pointer was NULL or the data was invalid.
B_IO_ERRORThe number of bytes written does not equal the size of the contents of the BPicture object.
Since
Haiku R1

◆ Instantiate()

BArchivable * BPicture::Instantiate ( BMessage data)
static

Returns a pointer to a new BPicture object created from the BPicture data archived in data.

Returns
A newly created BPicture object or NULL if the message doesn't contain an archived BPicture.
See also
BArchivable::Instantiate()
Since
BeOS R3

◆ Perform()

status_t BPicture::Perform ( perform_code  code,
void *  arg 
)
virtual

Perform some action (internal method defined for binary compatibility purposes).

Since
Haiku R1

Reimplemented from BArchivable.

◆ Play()

status_t BPicture::Play ( void **  callBackTable,
int32  tableEntries,
void *  user 
)

Plays back a picture using the passed in call back functions.

See http://haiku-os.org/legacy-docs/bebook/BPicture.html#BPicture_Play for details.

Parameters
callBackTableAn array of pointers to pointers of call back functions.
tableEntriesSpecifies the number of function pointers found in callBackTable.
userA hook to pass additional data to each call back function.
Returns
A status code.
Return values
B_OKThe BPicture object was played back successfully.
B_ERRORBPicture data is NULL.
Since
BeOS R3

◆ Unflatten()

status_t BPicture::Unflatten ( BDataIO stream)

Unflattens the contents from the stream into the BPicture object.

Parameters
streamThe stream to read from.
Returns
A status code, B_OK on success or an error code otherwise.
Return values
B_OKThe object was unflattened successfully.
B_BAD_VALUEThe stream pointer was NULL or the data was invalid.
B_IO_ERRORThe number of bytes read does not equal the size of the contents of the BPicture object.
Since
Haiku R1