xref: /haiku/src/libs/icon/transformer/Transformer.h (revision b028e77473189065f2baefc6f5e10d451cf591e2)
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 <SupportDefs.h>
16 #endif
17 
18 
19 namespace BPrivate {
20 namespace Icon {
21 
22 class VertexSource {
23  public:
24 								VertexSource();
25 	virtual						~VertexSource();
26 
27     virtual	void				rewind(unsigned path_id) = 0;
28     virtual	unsigned			vertex(double* x, double* y) = 0;
29 
30 	virtual	bool				WantsOpenPaths() const = 0;
31 	virtual	double				ApproximationScale() const = 0;
32 };
33 
34 
35 #ifdef ICON_O_MATIC
36 class Transformer : public VertexSource,
37 					public IconObject {
38 #else
39 class Transformer : public VertexSource {
40 #endif
41  public:
42 								Transformer(VertexSource& source,
43 											const char* name);
44 #ifdef ICON_O_MATIC
45 								Transformer(VertexSource& source,
46 											BMessage* archive);
47 #endif
48 	virtual						~Transformer();
49 
50 	// Transformer
51 	virtual	Transformer*		Clone(VertexSource& source) const = 0;
52 
53 	virtual	void				rewind(unsigned path_id);
54     virtual	unsigned			vertex(double* x, double* y);
55 
56 	virtual	void				SetSource(VertexSource& source);
57 
58 	virtual	bool				WantsOpenPaths() const;
59 	virtual	double				ApproximationScale() const;
60 
61  protected:
62 			VertexSource&		fSource;
63 };
64 
65 }	// namespace Icon
66 }	// namespace BPrivate
67 
68 #endif	// TRANSFORMER_H
69