xref: /haiku/headers/os/interface/Picture.h (revision e6b30aee0fd7a23d6a6baab9f3718945a0cd838a)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, OpenBeOS
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		Picture.h
23 //	Author:			Marc Flerackers (mflerackers@androme.be)
24 //	Description:	BPicture records a series of drawing instructions that can
25 //                  be "replayed" later.
26 //------------------------------------------------------------------------------
27 
28 #ifndef	_PICTURE_H
29 #define	_PICTURE_H
30 
31 #include <BeBuild.h>
32 #include <InterfaceDefs.h>
33 #include <Rect.h>
34 #include <Archivable.h>
35 
36 class BDataIO;
37 class BView;
38 struct _BPictureExtent_;
39 
40 // BPicture class --------------------------------------------------------------
41 class BPicture : public BArchivable {
42 public:
43 							BPicture();
44 							BPicture(const BPicture &original);
45 							BPicture(BMessage *data);
46 virtual						~BPicture();
47 static	BArchivable			*Instantiate(BMessage *data);
48 virtual	status_t			Archive(BMessage *data, bool deep = true) const;
49 virtual	status_t			Perform(perform_code d, void *arg);
50 
51 		status_t			Play(void **callBackTable,
52 								int32 tableEntries,
53 								void *userData);
54 
55 		status_t			Flatten(BDataIO *stream);
56 		status_t			Unflatten(BDataIO *stream);
57 
58 /*----- Private or reserved -----------------------------------------*/
59 private:
60 
61 friend class BWindow;
62 friend class BView;
63 friend class BPrintJob;
64 
65 virtual	void				_ReservedPicture1();
66 virtual	void				_ReservedPicture2();
67 virtual	void				_ReservedPicture3();
68 
69 		BPicture			&operator=(const BPicture &);
70 
71 		void				_InitData();
72 		void				_DisposeData();
73 
74 		void				_ImportData(const void *data, int32 size, BPicture **subs, int32 subCount);
75 		void				_ImportOldData(const void *data, int32 size);
76 
77 		void				SetToken(int32 token);
78 		int32				Token() const;
79 
80 		bool				_AssertLocalCopy();
81 		bool				_AssertOldLocalCopy();
82 		bool				_AssertServerCopy();
83 
84 		status_t			_Upload();
85 		status_t			_Download();
86 
87 		/**Deprecated API**/
88 							BPicture(const void *data, int32 size);
89 		const void			*Data() const;
90 		int32				DataSize() const;
91 
92 		void				Usurp(BPicture *lameDuck);
93 		BPicture			*StepDown();
94 
95 
96 		int32				fToken;
97 		_BPictureExtent_		*fExtent;
98 		BPicture			*fUsurped;
99 
100 		uint32				_reserved[3];
101 };
102 //------------------------------------------------------------------------------
103 
104 #endif // _PICTURE_H
105 
106