2006-02-05 01:11:57 +03:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2006-2007, Haiku, Inc. All rights reserved.
|
2006-02-05 01:11:57 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _SHAPE_H
|
|
|
|
#define _SHAPE_H
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <Archivable.h>
|
|
|
|
|
2007-10-16 00:13:55 +04:00
|
|
|
class BPoint;
|
|
|
|
class BRect;
|
|
|
|
class BShape;
|
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class ServerLink;
|
2007-08-16 18:40:03 +04:00
|
|
|
class PicturePlayer;
|
2005-06-15 01:28:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
class BShapeIterator {
|
|
|
|
public:
|
2009-08-27 15:12:41 +04:00
|
|
|
BShapeIterator();
|
|
|
|
virtual ~BShapeIterator();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
virtual status_t IterateMoveTo(BPoint* point);
|
|
|
|
virtual status_t IterateLineTo(int32 lineCount,
|
|
|
|
BPoint* linePts);
|
|
|
|
virtual status_t IterateBezierTo(int32 bezierCount,
|
|
|
|
BPoint* bezierPts);
|
|
|
|
virtual status_t IterateClose();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t Iterate(BShape* shape);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-27 15:12:41 +04:00
|
|
|
virtual void _ReservedShapeIterator1();
|
|
|
|
virtual void _ReservedShapeIterator2();
|
|
|
|
virtual void _ReservedShapeIterator3();
|
|
|
|
virtual void _ReservedShapeIterator4();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
uint32 reserved[4];
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BShape : public BArchivable {
|
|
|
|
public:
|
2009-08-27 15:12:41 +04:00
|
|
|
BShape();
|
|
|
|
BShape(const BShape& other);
|
|
|
|
BShape(BMessage* archive);
|
|
|
|
virtual ~BShape();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
|
|
|
virtual status_t Archive(BMessage* archive,
|
|
|
|
bool deep = true) const;
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
void Clear();
|
|
|
|
BRect Bounds() const;
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t AddShape(const BShape* other);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
status_t MoveTo(BPoint point);
|
|
|
|
status_t LineTo(BPoint linePoint);
|
|
|
|
status_t BezierTo(BPoint controlPoints[3]);
|
|
|
|
status_t Close();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-27 15:12:41 +04:00
|
|
|
// FBC padding
|
|
|
|
virtual status_t Perform(perform_code code, void* data);
|
2007-10-16 00:13:55 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
virtual void _ReservedShape1();
|
|
|
|
virtual void _ReservedShape2();
|
|
|
|
virtual void _ReservedShape3();
|
|
|
|
virtual void _ReservedShape4();
|
2007-10-16 00:13:55 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
private:
|
2007-10-16 00:13:55 +04:00
|
|
|
friend class BShapeIterator;
|
|
|
|
friend class BView;
|
|
|
|
friend class BFont;
|
|
|
|
friend class BPrivate::PicturePlayer;
|
|
|
|
friend class BPrivate::ServerLink;
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
void GetData(int32* opCount, int32* ptCount,
|
|
|
|
uint32** opList, BPoint** ptList);
|
|
|
|
void SetData(int32 opCount, int32 ptCount,
|
|
|
|
const uint32* opList,
|
|
|
|
const BPoint* ptList);
|
|
|
|
void InitData();
|
|
|
|
bool AllocatePts(int32 count);
|
|
|
|
bool AllocateOps(int32 count);
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32 fState;
|
|
|
|
uint32 fBuildingOp;
|
|
|
|
void* fPrivateData;
|
2007-10-16 00:13:55 +04:00
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
uint32 reserved[4];
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
#endif // _SHAPE_H
|