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" 14fb07ece0SStephan Aßmus #include "StrokeTransformer.h" 15fb07ece0SStephan Aßmus 16325a6253SAxel Dörfler #ifdef ICON_O_MATIC 17c16bcdfcSJoachim Seemer #include <Catalog.h> 18325a6253SAxel Dörfler #include <Message.h> 19325a6253SAxel Dörfler #endif 20325a6253SAxel Dörfler 2125dc253dSIngo Weinhold 2225dc253dSIngo Weinhold _USING_ICON_NAMESPACE 23325a6253SAxel Dörfler 24325a6253SAxel Dörfler 25fb07ece0SStephan Aßmus // TransformerFor 26fb07ece0SStephan Aßmus Transformer* 27fb07ece0SStephan Aßmus TransformerFactory::TransformerFor(uint32 type, VertexSource& source) 28fb07ece0SStephan Aßmus { 29fb07ece0SStephan Aßmus switch (type) { 30*098eaec6SZardshard case AFFINE_TRANSFORMER: 31fb07ece0SStephan Aßmus return new AffineTransformer(source); 32*098eaec6SZardshard case PERSPECTIVE_TRANSFORMER: 33fb07ece0SStephan Aßmus return new PerspectiveTransformer(source); 34*098eaec6SZardshard case CONTOUR_TRANSFORMER: 35fb07ece0SStephan Aßmus return new ContourTransformer(source); 36*098eaec6SZardshard case STROKE_TRANSFORMER: 37fb07ece0SStephan Aßmus return new StrokeTransformer(source); 38fb07ece0SStephan Aßmus } 39fb07ece0SStephan Aßmus 40fb07ece0SStephan Aßmus return NULL; 41fb07ece0SStephan Aßmus } 42fb07ece0SStephan Aßmus 43fb07ece0SStephan Aßmus // TransformerFor 44fb07ece0SStephan Aßmus Transformer* 45fb07ece0SStephan Aßmus TransformerFactory::TransformerFor(BMessage* message, 46fb07ece0SStephan Aßmus VertexSource& source) 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: 52fb07ece0SStephan Aßmus return new PerspectiveTransformer(source, 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