xref: /haiku/src/libs/icon/transformer/TransformerFactory.cpp (revision c6c2c0428420c1a7a9b16a843b41ab26903bc5fb)
1fb07ece0SStephan Aßmus /*
2325a6253SAxel Dörfler  * Copyright 2006-2007, Haiku.
3fb07ece0SStephan Aßmus  * Distributed under the terms of the MIT License.
4fb07ece0SStephan Aßmus  *
5fb07ece0SStephan Aßmus  * Authors:
6fb07ece0SStephan Aßmus  *		Stephan Aßmus <superstippi@gmx.de>
7fb07ece0SStephan Aßmus  */
8fb07ece0SStephan Aßmus 
9fb07ece0SStephan Aßmus #include "TransformerFactory.h"
10fb07ece0SStephan Aßmus 
11fb07ece0SStephan Aßmus #include "AffineTransformer.h"
12fb07ece0SStephan Aßmus #include "ContourTransformer.h"
13fb07ece0SStephan Aßmus #include "PerspectiveTransformer.h"
14*c6c2c042SZardshard #include "Shape.h"
15fb07ece0SStephan Aßmus #include "StrokeTransformer.h"
16fb07ece0SStephan Aßmus 
17325a6253SAxel Dörfler #ifdef ICON_O_MATIC
18c16bcdfcSJoachim Seemer #include <Catalog.h>
19325a6253SAxel Dörfler #include <Message.h>
20325a6253SAxel Dörfler #endif
21325a6253SAxel Dörfler 
2225dc253dSIngo Weinhold 
2325dc253dSIngo Weinhold _USING_ICON_NAMESPACE
24325a6253SAxel Dörfler 
25325a6253SAxel Dörfler 
26fb07ece0SStephan Aßmus // TransformerFor
27fb07ece0SStephan Aßmus Transformer*
TransformerFor(uint32 type,VertexSource & source,Shape * shape)28*c6c2c042SZardshard TransformerFactory::TransformerFor(uint32 type, VertexSource& source, Shape* shape)
29fb07ece0SStephan Aßmus {
30fb07ece0SStephan Aßmus 	switch (type) {
31098eaec6SZardshard 		case AFFINE_TRANSFORMER:
32fb07ece0SStephan Aßmus 			return new AffineTransformer(source);
33098eaec6SZardshard 		case PERSPECTIVE_TRANSFORMER:
34*c6c2c042SZardshard 			return new PerspectiveTransformer(source, shape);
35098eaec6SZardshard 		case CONTOUR_TRANSFORMER:
36fb07ece0SStephan Aßmus 			return new ContourTransformer(source);
37098eaec6SZardshard 		case STROKE_TRANSFORMER:
38fb07ece0SStephan Aßmus 			return new StrokeTransformer(source);
39fb07ece0SStephan Aßmus 	}
40fb07ece0SStephan Aßmus 
41fb07ece0SStephan Aßmus 	return NULL;
42fb07ece0SStephan Aßmus }
43fb07ece0SStephan Aßmus 
44fb07ece0SStephan Aßmus // TransformerFor
45fb07ece0SStephan Aßmus Transformer*
TransformerFor(BMessage * message,VertexSource & source,Shape * shape)46*c6c2c042SZardshard TransformerFactory::TransformerFor(BMessage* message, VertexSource& source, Shape* shape)
47fb07ece0SStephan Aßmus {
48fb07ece0SStephan Aßmus 	switch (message->what) {
49fb07ece0SStephan Aßmus 		case AffineTransformer::archive_code:
50fb07ece0SStephan Aßmus 			return new AffineTransformer(source, message);
51fb07ece0SStephan Aßmus 		case PerspectiveTransformer::archive_code:
52*c6c2c042SZardshard 			return new PerspectiveTransformer(source, shape, message);
53fb07ece0SStephan Aßmus 		case ContourTransformer::archive_code:
54fb07ece0SStephan Aßmus 			return new ContourTransformer(source, message);
55fb07ece0SStephan Aßmus 		case StrokeTransformer::archive_code:
56fb07ece0SStephan Aßmus 			return new StrokeTransformer(source, message);
57fb07ece0SStephan Aßmus 	}
58fb07ece0SStephan Aßmus 
59fb07ece0SStephan Aßmus 	return NULL;
60fb07ece0SStephan Aßmus }
61fb07ece0SStephan Aßmus 
62