1 /* 2 * Copyright 2001-2019, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * DarkWyrm <bpmagic@columbus.rr.com> 7 * Stefano Ceccherini <stefano.ceccherini@gmail.com> 8 * Julian Harnath <julian.harnath@rwth-aachen.de> 9 * Stephan Aßmus <superstippi@gmx.de> 10 */ 11 #ifndef SERVER_PICTURE_H 12 #define SERVER_PICTURE_H 13 14 15 #include <DataIO.h> 16 17 #include <AutoDeleter.h> 18 #include <ObjectList.h> 19 #include <PictureDataWriter.h> 20 #include <Referenceable.h> 21 22 23 class BFile; 24 class Canvas; 25 class ServerApp; 26 class ServerFont; 27 class View; 28 29 namespace BPrivate { 30 class LinkReceiver; 31 class PortLink; 32 } 33 class BList; 34 35 36 class ServerPicture : public BReferenceable, public PictureDataWriter { 37 public: 38 ServerPicture(); 39 ServerPicture(const ServerPicture& other); 40 ServerPicture(const char* fileName, 41 int32 offset); 42 virtual ~ServerPicture(); 43 44 int32 Token() { return fToken; } 45 bool SetOwner(ServerApp* owner); 46 ServerApp* Owner() const { return fOwner; } 47 48 bool ReleaseClientReference(); 49 50 void EnterStateChange(); 51 void ExitStateChange(); 52 53 void SyncState(Canvas* canvas); 54 void WriteFontState(const ServerFont& font, 55 uint16 mask); 56 57 void Play(Canvas* target); 58 59 void PushPicture(ServerPicture* picture); 60 ServerPicture* PopPicture(); 61 62 void AppendPicture(ServerPicture* picture); 63 bool NestPicture(ServerPicture* picture); 64 65 off_t DataLength() const; 66 67 status_t ImportData(BPrivate::LinkReceiver& link); 68 status_t ExportData(BPrivate::PortLink& link); 69 70 private: 71 friend class PictureBoundingBoxPlayer; 72 73 typedef BObjectList<ServerPicture> PictureList; 74 75 int32 fToken; 76 ObjectDeleter<BFile> 77 fFile; 78 ObjectDeleter<BPositionIO> 79 fData; 80 ObjectDeleter<PictureList> 81 fPictures; 82 BReference<ServerPicture> 83 fPushed; 84 ServerApp* fOwner; 85 }; 86 87 88 #endif // SERVER_PICTURE_H 89