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