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