1 /* 2 * Copyright 2006-2007, 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 <BeBuild.h> 10 #include <Archivable.h> 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, 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 virtual void _ReservedShapeIterator1(); 36 virtual void _ReservedShapeIterator2(); 37 virtual void _ReservedShapeIterator3(); 38 virtual void _ReservedShapeIterator4(); 39 40 uint32 reserved[4]; 41 }; 42 43 44 class BShape : public BArchivable { 45 public: 46 BShape(); 47 BShape(const BShape ©From); 48 BShape(BMessage *data); 49 virtual ~BShape(); 50 51 virtual status_t Archive(BMessage *into, bool deep = true) const; 52 static BArchivable *Instantiate(BMessage *data); 53 54 void Clear(); 55 BRect Bounds() const; 56 57 status_t AddShape(const BShape *other); 58 59 status_t MoveTo(BPoint point); 60 status_t LineTo(BPoint linePoint); 61 status_t BezierTo(BPoint controlPoints[3]); 62 status_t Close(); 63 64 private: 65 virtual status_t Perform(perform_code d, void *arg); 66 67 virtual void _ReservedShape1(); 68 virtual void _ReservedShape2(); 69 virtual void _ReservedShape3(); 70 virtual void _ReservedShape4(); 71 72 friend class BShapeIterator; 73 friend class BView; 74 friend class BFont; 75 friend class BPrivate::PicturePlayer; 76 friend class BPrivate::ServerLink; 77 78 void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList); 79 void SetData(int32 opCount, int32 ptCount, const uint32 *opList, const BPoint *ptList); 80 void InitData(); 81 bool AllocatePts(int32 count); 82 bool AllocateOps(int32 count); 83 84 uint32 fState; 85 uint32 fBuildingOp; 86 void* fPrivateData; 87 uint32 reserved[4]; 88 }; 89 90 #endif // _SHAPE_H 91