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