xref: /haiku/headers/os/interface/Picture.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
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				init_data();
82 		void				import_data(const void *data, int32 size, BPicture **subs, int32 subCount);
83 		void				import_old_data(const void *data, int32 size);
84 		void				set_token(int32 token);
85 		bool				assert_local_copy();
86 		bool				assert_old_local_copy();
87 		bool				assert_server_copy();
88 
89 		/**Deprecated API**/
90 							BPicture(const void *data, int32 size);
91 		const void			*Data() const;
92 		int32				DataSize() const;
93 
94 		void				usurp(BPicture *lameDuck);
95 		BPicture			*step_down();
96 
97 		int32				token;
98 		_BPictureExtent_	*extent;
99 		BPicture			*usurped;
100 		uint32				_reserved[3];
101 };
102 //------------------------------------------------------------------------------
103 
104 #endif // _PICTURE_H
105 
106