void BPrintJob::_AddPicture(BPicture& picture, BRect& rect, BPoint& where) { ASSERT(fSpoolFile != NULL); fCurrentPageHeader->number_of_pictures++; fSpoolFile->Write(&where, sizeof(BRect)); fSpoolFile->Write(&rect, sizeof(BPoint)); picture.Flatten(fSpoolFile); }
void PictureView::AllAttached() { BeginPicture(new BPicture); DrawStuff(this); BPicture *picture = EndPicture(); if (picture == NULL) return; BMessage message; picture->Archive(&message); message.PrintToStream(); BMallocIO stream; status_t status = picture->Flatten(&stream); delete picture; if (status != B_OK) printf("Error flattening BPicture: %s\n", strerror(status)); if (status == B_OK) { stream.Seek(0, SEEK_SET); fPicture = new BPicture(); status = fPicture->Unflatten(&stream); if (status != B_OK) { printf("Error unflattening BPicture: %s\n", strerror(status)); return; } } BMessage message2; fPicture->Archive(&message2); message2.PrintToStream(); }