1 /* 2 * Copyright 2006-2007, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef TRANSFORMER_H 9 #define TRANSFORMER_H 10 11 12 #ifdef ICON_O_MATIC 13 # include "IconObject.h" 14 #else 15 # include <Message.h> 16 # include <SupportDefs.h> 17 #endif 18 19 #include "IconBuild.h" 20 21 22 _BEGIN_ICON_NAMESPACE 23 24 25 class VertexSource { 26 public: 27 VertexSource(); 28 virtual ~VertexSource(); 29 30 virtual void rewind(unsigned path_id) = 0; 31 virtual unsigned vertex(double* x, double* y) = 0; 32 33 /*! Determines whether open paths should be closed or left open. */ 34 virtual bool WantsOpenPaths() const = 0; 35 virtual double ApproximationScale() const = 0; 36 }; 37 38 39 #ifdef ICON_O_MATIC 40 class Transformer : public VertexSource, 41 public IconObject { 42 #else 43 class Transformer : public VertexSource { 44 #endif 45 public: 46 Transformer(VertexSource& source, 47 const char* name); 48 Transformer(VertexSource& source, 49 BMessage* archive); 50 51 virtual ~Transformer(); 52 53 // Transformer 54 virtual Transformer* Clone(VertexSource& source) const = 0; 55 56 virtual void rewind(unsigned path_id); 57 virtual unsigned vertex(double* x, double* y); 58 59 virtual void SetSource(VertexSource& source); 60 61 virtual bool WantsOpenPaths() const; 62 virtual double ApproximationScale() const; 63 64 protected: 65 VertexSource& fSource; 66 }; 67 68 69 _END_ICON_NAMESPACE 70 71 72 #endif // TRANSFORMER_H 73