1/* 2 * Copyright 2006-2007, 2023, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan A��mus <superstippi@gmx.de> 7 * Zardshard 8 */ 9#ifndef PATH_TRANSFORMER_H 10#define PATH_TRANSFORMER_H 11 12 13#include "IconBuild.h" 14#include "VertexSource.h" 15 16 17_BEGIN_ICON_NAMESPACE 18 19 20/*! A transformation to a VertexSource. 21 It can add points, move them around, turn them to curves, etc. 22*/ 23class PathTransformer : public VertexSource 24{ 25public: 26 PathTransformer(VertexSource& source) 27 : fSource(&source) {} 28 virtual ~PathTransformer() {} 29 30 // PathTransformer 31 virtual void rewind(unsigned path_id) 32 { fSource->rewind(path_id); } 33 virtual unsigned vertex(double* x, double* y) 34 { return fSource->vertex(x, y); } 35 36 virtual void SetSource(VertexSource& source) 37 { fSource = &source; } 38 39 virtual bool WantsOpenPaths() const 40 { return fSource->WantsOpenPaths(); } 41 virtual double ApproximationScale() const 42 { return fSource->ApproximationScale(); } 43 44protected: 45 VertexSource* fSource; 46}; 47 48 49_END_ICON_NAMESPACE 50 51#endif // PATH_TRANSFORMER_H 52