xref: /haiku/headers/os/interface/Picture.h (revision 079c69cbfd7cd3c97baae91332251c8388a8bb02)
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 // Standard Includes -----------------------------------------------------------
32 
33 // System Includes -------------------------------------------------------------
34 #include <BeBuild.h>
35 #include <InterfaceDefs.h>
36 #include <Rect.h>
37 #include <Archivable.h>
38 
39 // Project Includes ------------------------------------------------------------
40 
41 // Local Includes --------------------------------------------------------------
42 
43 // Local Defines ---------------------------------------------------------------
44 
45 // Globals ---------------------------------------------------------------------
46 
47 class BView;
48 struct _BPictureExtent_;
49 
50 // BPicture class --------------------------------------------------------------
51 class BPicture : public BArchivable {
52 public:
53 							BPicture();
54 							BPicture(const BPicture &original);
55 							BPicture(BMessage *data);
56 virtual						~BPicture();
57 static	BArchivable			*Instantiate(BMessage *data);
58 virtual	status_t			Archive(BMessage *data, bool deep = true) const;
59 virtual	status_t			Perform(perform_code d, void *arg);
60 
61 		status_t			Play(void **callBackTable,
62 								int32 tableEntries,
63 								void *userData);
64 
65 		status_t			Flatten(BDataIO *stream);
66 		status_t			Unflatten(BDataIO *stream);
67 
68 /*----- Private or reserved -----------------------------------------*/
69 private:
70 
71 friend class BWindow;
72 friend class BView;
73 friend class BPrintJob;
74 
75 virtual	void				_ReservedPicture1();
76 virtual	void				_ReservedPicture2();
77 virtual	void				_ReservedPicture3();
78 
79 		BPicture			&operator=(const BPicture &);
80 
81 		void				_InitData();
82 		void				_DisposeData();
83 
84 		void				_ImportData(const void *data, int32 size, BPicture **subs, int32 subCount);
85 		void				_ImportOldData(const void *data, int32 size);
86 		void				SetToken(int32 token);
87 		bool				_AssertLocalCopy();
88 		bool				_AssertOldLocalCopy();
89 		bool				_AssertServerCopy();
90 
91 		status_t			_Upload();
92 		status_t			_Download();
93 
94 		/**Deprecated API**/
95 							BPicture(const void *data, int32 size);
96 		const void			*Data() const;
97 		int32				DataSize() const;
98 
99 		void				Usurp(BPicture *lameDuck);
100 		BPicture			*StepDown();
101 
102 		int32				token;
103 		_BPictureExtent_		*extent;
104 		BPicture			*usurped;
105 		uint32				_reserved[3];
106 };
107 //------------------------------------------------------------------------------
108 
109 #endif // _PICTURE_H
110 
111