Records a series of drawing instructions that can be "replayed" later. More...
Inherits BArchivable.
Public Member Functions | |
BPicture () | |
Initializes an empty BPicture object. | |
BPicture (BMessage *data) | |
Initializes an BPicture object copying the data from from the passed in data archive. | |
BPicture (const BPicture &other) | |
Initializes an BPicture object copying the data from otherPicture. | |
virtual | ~BPicture () |
Destroys the BPicture object and deletes all associated data. | |
status_t | Flatten (BDataIO *stream) |
Flattens the contents of the BPicture object into stream. | |
virtual status_t | Perform (perform_code code, void *arg) |
Perform some action (internal method defined for binary compatibility purposes). | |
status_t | Play (void **callBackTable, int32 tableEntries, void *userData) |
Plays back a picture using the passed in call back functions. | |
status_t | Unflatten (BDataIO *stream) |
Unflattens the contents from the stream into the BPicture object. | |
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 *data, bool deep=true) const |
Archives the BPicture object into the data message. | |
static BArchivable * | Instantiate (BMessage *data) |
Returns a pointer to a new BPicture object created from the BPicture data archived in data. | |
Additional Inherited Members | |
Static Public Member Functions inherited from BArchivable | |
static BArchivable * | Instantiate (BMessage *archive) |
Static member to restore objects from messages. | |
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:
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.
BPicture::BPicture | ( | ) |
Initializes an empty BPicture object.
BPicture::BPicture | ( | const BPicture & | otherPicture | ) |
Initializes an BPicture object copying the data from otherPicture.
BPicture::BPicture | ( | BMessage * | data | ) |
Initializes an BPicture object copying the data from from the passed in data archive.
|
virtual |
Destroys the BPicture object and deletes all associated data.
Archives the BPicture object into the data message.
data | A pointer to the BMessage object to archive into. |
deep | The parameter has no effect to this method. |
B_OK
if everything went well or an error code otherwise. B_OK | The object was archived successfully. |
B_NO_MEMORY | Ran out of memory while archiving the object. |
Reimplemented from BArchivable.
Flattens the contents of the BPicture object into stream.
stream | The stream to write to. |
B_OK
on success or an error code otherwise. B_OK | The BPicture object was flattened successfully. |
B_BAD_VALUE | The stream pointer was NULL or the data was invalid. |
B_IO_ERROR | The number of bytes written does not equal the size of the contents of the BPicture object. |
|
static |
Returns a pointer to a new BPicture object created from the BPicture data archived in data.
|
virtual |
Perform some action (internal method defined for binary compatibility purposes).
Reimplemented from BArchivable.
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.
callBackTable | An array of pointers to pointers of call back functions. |
tableEntries | Specifies the number of function pointers found in callBackTable. |
user | A hook to pass additional data to each call back function. |
Unflattens the contents from the stream into the BPicture object.
stream | The stream to read from. |
B_OK
on success or an error code otherwise. B_OK | The object was unflattened successfully. |
B_BAD_VALUE | The stream pointer was NULL or the data was invalid. |
B_IO_ERROR | The number of bytes read does not equal the size of the contents of the BPicture object. |