1/*
2 * Copyright 2006-2007, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan A��mus <superstippi@gmx.de>
7 */
8#ifndef PATH_COMMAND_QUEUE_H
9#define PATH_COMMAND_QUEUE_H
10
11
12#include "IconBuild.h"
13#include "LittleEndianBuffer.h"
14
15
16class BPoint;
17
18
19_BEGIN_ICON_NAMESPACE
20
21
22class VectorPath;
23
24class PathCommandQueue {
25 public:
26								PathCommandQueue();
27	virtual						~PathCommandQueue();
28
29			bool				Write(LittleEndianBuffer& buffer,
30									  const VectorPath* path,
31									  uint8 pointCount);
32
33			bool				Read(LittleEndianBuffer& buffer,
34									 VectorPath* path,
35									 uint8 pointCount);
36
37 private:
38	// writing
39			bool				_AppendHLine(float x);
40			bool				_AppendVLine(float y);
41			bool				_AppendLine(const BPoint& point);
42			bool				_AppendCurve(const BPoint& point,
43											 const BPoint& pointIn,
44											 const BPoint& pointOut);
45
46			bool				_AppendCommand(uint8 command);
47
48	// reading
49			bool				_ReadCommand(uint8& command);
50
51			LittleEndianBuffer	fCommandBuffer;
52			LittleEndianBuffer	fPointBuffer;
53
54			uint8				fCommandByte;
55			uint8				fCommandPos;
56
57			uint8				fCommandCount;
58};
59
60
61_END_ICON_NAMESPACE
62
63
64#endif	// PATH_COMMAND_QUEUE_H
65