xref: /haiku/src/libs/icon/transformer/PathTransformer.h (revision e1c4049fed1047bdb957b0529e1921e97ef94770)
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 */
23 class PathTransformer : public VertexSource
24 {
25 public:
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 
44 protected:
45 			VertexSource*		fSource;
46 };
47 
48 
49 _END_ICON_NAMESPACE
50 
51 #endif	// PATH_TRANSFORMER_H
52