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