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 "LittleEndianBuffer.h" 13 14 class BPoint; 15 16 17 namespace BPrivate { 18 namespace Icon { 19 20 class VectorPath; 21 22 class PathCommandQueue { 23 public: 24 PathCommandQueue(); 25 virtual ~PathCommandQueue(); 26 27 bool Write(LittleEndianBuffer& buffer, 28 const VectorPath* path, 29 uint8 pointCount); 30 31 bool Read(LittleEndianBuffer& buffer, 32 VectorPath* path, 33 uint8 pointCount); 34 35 private: 36 // writing 37 bool _AppendHLine(float x); 38 bool _AppendVLine(float y); 39 bool _AppendLine(const BPoint& point); 40 bool _AppendCurve(const BPoint& point, 41 const BPoint& pointIn, 42 const BPoint& pointOut); 43 44 bool _AppendCommand(uint8 command); 45 46 // reading 47 bool _ReadCommand(uint8& command); 48 49 LittleEndianBuffer fCommandBuffer; 50 LittleEndianBuffer fPointBuffer; 51 52 uint8 fCommandByte; 53 uint8 fCommandPos; 54 55 uint8 fCommandCount; 56 }; 57 58 } // namespace Icon 59 } // namespace BPrivate 60 61 #endif // PATH_COMMAND_QUEUE_H 62