1 /* 2 * Copyright 2002-2010 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 12 class BPoint; 13 class BRect; 14 class BShape; 15 16 namespace BPrivate { 17 class ServerLink; 18 class PicturePlayer; 19 }; 20 21 22 class BShapeIterator { 23 public: 24 BShapeIterator(); 25 virtual ~BShapeIterator(); 26 27 virtual status_t IterateMoveTo(BPoint* point); 28 virtual status_t IterateLineTo(int32 lineCount, 29 BPoint* linePoints); 30 virtual status_t IterateBezierTo(int32 bezierCount, 31 BPoint* bezierPoints); 32 virtual status_t IterateClose(); 33 34 virtual status_t IterateArcTo(float& rx, float& ry, 35 float& angle, bool largeArc, 36 bool counterClockWise, BPoint& point); 37 38 status_t Iterate(BShape* shape); 39 40 private: 41 virtual void _ReservedShapeIterator2(); 42 virtual void _ReservedShapeIterator3(); 43 virtual void _ReservedShapeIterator4(); 44 45 uint32 reserved[4]; 46 }; 47 48 49 class BShape : public BArchivable { 50 public: 51 BShape(); 52 BShape(const BShape& other); 53 #if defined(__cplusplus) && __cplusplus >= 201103L 54 BShape(BShape&& other); 55 #endif 56 BShape(BMessage* archive); 57 virtual ~BShape(); 58 59 static BArchivable* Instantiate(BMessage* archive); 60 virtual status_t Archive(BMessage* archive, 61 bool deep = true) const; 62 63 BShape& operator=(const BShape& other); 64 #if defined(__cplusplus) && __cplusplus >= 201103L 65 BShape& operator=(BShape&& other); 66 #endif 67 68 bool operator==(const BShape& other) const; 69 bool operator!=(const BShape& other) const; 70 71 void Clear(); 72 void MoveFrom(BShape& other); 73 BRect Bounds() const; 74 BPoint CurrentPosition() const; 75 76 status_t AddShape(const BShape* other); 77 78 status_t MoveTo(BPoint point); 79 status_t LineTo(BPoint linePoint); 80 status_t BezierTo(BPoint controlPoints[3]); 81 status_t BezierTo(const BPoint& control1, 82 const BPoint& control2, 83 const BPoint& endPoint); 84 status_t ArcTo(float rx, float ry, 85 float angle, bool largeArc, 86 bool counterClockWise, 87 const BPoint& point); 88 status_t Close(); 89 90 class Private; 91 92 private: 93 // FBC padding 94 virtual status_t Perform(perform_code code, void* data); 95 96 virtual void _ReservedShape1(); 97 virtual void _ReservedShape2(); 98 virtual void _ReservedShape3(); 99 virtual void _ReservedShape4(); 100 101 private: 102 friend class Private; 103 friend class BShapeIterator; 104 105 void InitData(); 106 bool AllocatePts(int32 count); 107 bool AllocateOps(int32 count); 108 109 private: 110 uint32 fState; 111 uint32 fBuildingOp; 112 void* fPrivateData; 113 114 uint32 reserved[4]; 115 }; 116 117 118 #endif // _SHAPE_H 119