xref: /haiku/headers/os/interface/Shape.h (revision 1b8f7f13a3dc70e0e903cb94248220b40b732204)
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 	class PicturePlayer;
15 };
16 
17 
18 /*----------------------------------------------------------------*/
19 /*----- BShapeIterator class -------------------------------------*/
20 
21 class BShapeIterator {
22 
23 public:
24 						BShapeIterator();
25 virtual					~BShapeIterator();
26 
27 virtual	status_t		IterateMoveTo(BPoint *point);
28 virtual	status_t		IterateLineTo(int32 lineCount, BPoint *linePts);
29 virtual	status_t		IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
30 virtual	status_t		IterateClose();
31 
32 		status_t		Iterate(BShape *shape);
33 
34 private:
35 
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 /*----- BShape class ---------------------------------------------*/
46 
47 class BShape : public BArchivable {
48 
49 public:
50 						BShape();
51 						BShape(const BShape &copyFrom);
52 						BShape(BMessage *data);
53 virtual					~BShape();
54 
55 virtual	status_t		Archive(BMessage *into, bool deep = true) const;
56 static	BArchivable		*Instantiate(BMessage *data);
57 
58 		void			Clear();
59 		BRect			Bounds() const;
60 
61 		status_t		AddShape(const BShape *other);
62 
63 		status_t		MoveTo(BPoint point);
64 		status_t		LineTo(BPoint linePoint);
65 		status_t		BezierTo(BPoint controlPoints[3]);
66 		status_t		Close();
67 
68 /*----- Private or reserved ---------------*/
69 virtual status_t		Perform(perform_code d, void *arg);
70 
71 private:
72 
73 virtual	void			_ReservedShape1();
74 virtual	void			_ReservedShape2();
75 virtual	void			_ReservedShape3();
76 virtual	void			_ReservedShape4();
77 
78 		friend class	BShapeIterator;
79 		friend class	BView;
80 		friend class	BFont;
81 		friend class	BPrivate::PicturePlayer;
82 		friend class	BPrivate::ServerLink;
83 
84 		void			GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
85 		void			SetData(int32 opCount, int32 ptCount, const uint32 *opList, const BPoint *ptList);
86 		void			InitData();
87 		bool			AllocatePts(int32 count);
88 		bool			AllocateOps(int32 count);
89 
90 		uint32			fState;
91 		uint32			fBuildingOp;
92 		void *			fPrivateData;
93 		uint32			reserved[4];
94 };
95 
96 #endif
97