xref: /haiku/headers/os/interface/Shape.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
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 /*----------------------------------------------------------------*/
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 		void			GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
82 		void			SetData(int32 opCount, int32 ptCount, uint32 *opList, BPoint *ptList);
83 		void			InitData();
84 
85 		uint32			fState;
86 		uint32			fBuildingOp;
87 		void *			fPrivateData;
88 		uint32			reserved[4];
89 
90 public:
91 /*----- Deprecated ---------------*/
92 						BShape(BShape &copyFrom);
93 		BRect			Bounds();
94 		status_t		AddShape(BShape *other);
95 };
96 
97 #endif
98