xref: /haiku/headers/os/interface/Shape.h (revision 03187b607b2b5eec7ee059f1ead09bdba14991fb)
1 /*
2  * Copyright 2006-2007, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SHAPE_H
6 #define _SHAPE_H
7 
8 
9 #include <Archivable.h>
10 
11 class BPoint;
12 class BRect;
13 class BShape;
14 
15 namespace BPrivate {
16 	class ServerLink;
17 	class PicturePlayer;
18 };
19 
20 
21 class BShapeIterator {
22 public:
23 								BShapeIterator();
24 	virtual						~BShapeIterator();
25 
26 	virtual	status_t			IterateMoveTo(BPoint* point);
27 	virtual	status_t			IterateLineTo(int32 lineCount,
28 									BPoint* linePts);
29 	virtual	status_t			IterateBezierTo(int32 bezierCount,
30 									BPoint* bezierPts);
31 	virtual	status_t			IterateClose();
32 
33 			status_t			Iterate(BShape* shape);
34 
35 private:
36 	virtual	void				_ReservedShapeIterator1();
37 	virtual	void				_ReservedShapeIterator2();
38 	virtual	void				_ReservedShapeIterator3();
39 	virtual	void				_ReservedShapeIterator4();
40 
41 			uint32				reserved[4];
42 };
43 
44 
45 class BShape : public BArchivable {
46 public:
47 								BShape();
48 								BShape(const BShape& other);
49 								BShape(BMessage* archive);
50 	virtual						~BShape();
51 
52 	static	BArchivable*		Instantiate(BMessage* archive);
53 	virtual	status_t			Archive(BMessage* archive,
54 									bool deep = true) const;
55 
56 			void				Clear();
57 			BRect				Bounds() const;
58 
59 			status_t			AddShape(const BShape* other);
60 
61 			status_t			MoveTo(BPoint point);
62 			status_t			LineTo(BPoint linePoint);
63 			status_t			BezierTo(BPoint controlPoints[3]);
64 			status_t			Close();
65 
66 private:
67 	// FBC padding
68 	virtual status_t			Perform(perform_code code, void* data);
69 
70 	virtual	void				_ReservedShape1();
71 	virtual	void				_ReservedShape2();
72 	virtual	void				_ReservedShape3();
73 	virtual	void				_ReservedShape4();
74 
75 private:
76 	friend class BShapeIterator;
77 	friend class BView;
78 	friend class BFont;
79 	friend class BPrivate::PicturePlayer;
80 	friend class BPrivate::ServerLink;
81 
82 			void				GetData(int32* opCount, int32* ptCount,
83 									uint32** opList, BPoint** ptList);
84 			void				SetData(int32 opCount, int32 ptCount,
85 									const uint32* opList,
86 									const BPoint* ptList);
87 			void				InitData();
88 			bool				AllocatePts(int32 count);
89 			bool				AllocateOps(int32 count);
90 
91 private:
92 			uint32				fState;
93 			uint32				fBuildingOp;
94 			void*				fPrivateData;
95 
96 			uint32				reserved[4];
97 };
98 
99 #endif // _SHAPE_H
100