xref: /haiku/src/libs/icon/flat_icon/PathCommandQueue.h (revision f23596149e0d173463f70629581aa10cc305d32e)
1 /*
2  * Copyright 2006, 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 
9 #ifndef PATH_COMMAND_QUEUE_H
10 #define PATH_COMMAND_QUEUE_H
11 
12 #include "LittleEndianBuffer.h"
13 
14 class BPoint;
15 class VectorPath;
16 
17 class PathCommandQueue {
18  public:
19 								PathCommandQueue();
20 	virtual						~PathCommandQueue();
21 
22 			bool				Write(LittleEndianBuffer& buffer,
23 									  const VectorPath* path,
24 									  uint8 pointCount);
25 
26 			bool				Read(LittleEndianBuffer& buffer,
27 									 VectorPath* path,
28 									 uint8 pointCount);
29 
30  private:
31 	// writing
32 			bool				_AppendHLine(float x);
33 			bool				_AppendVLine(float y);
34 			bool				_AppendLine(const BPoint& point);
35 			bool				_AppendCurve(const BPoint& point,
36 											 const BPoint& pointIn,
37 											 const BPoint& pointOut);
38 
39 			bool				_AppendCommand(uint8 command);
40 
41 	// reading
42 			bool				_ReadCommand(uint8& command);
43 
44 			LittleEndianBuffer	fCommandBuffer;
45 			LittleEndianBuffer	fPointBuffer;
46 
47 			uint8				fCommandByte;
48 			uint8				fCommandPos;
49 
50 			uint8				fCommandCount;
51 };
52 
53 #endif // PATH_COMMAND_QUEUE_H
54