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 9 #include "TransformerFactory.h" 10 11 #include "AffineTransformer.h" 12 #include "ContourTransformer.h" 13 #include "PerspectiveTransformer.h" 14 #include "StrokeTransformer.h" 15 16 #ifdef ICON_O_MATIC 17 #include <Catalog.h> 18 #include <Message.h> 19 #endif 20 21 22 _USING_ICON_NAMESPACE 23 24 25 // TransformerFor 26 Transformer* 27 TransformerFactory::TransformerFor(uint32 type, VertexSource& source) 28 { 29 switch (type) { 30 case AFFINE_TRANSFORMER: 31 return new AffineTransformer(source); 32 case PERSPECTIVE_TRANSFORMER: 33 return new PerspectiveTransformer(source); 34 case CONTOUR_TRANSFORMER: 35 return new ContourTransformer(source); 36 case STROKE_TRANSFORMER: 37 return new StrokeTransformer(source); 38 } 39 40 return NULL; 41 } 42 43 // TransformerFor 44 Transformer* 45 TransformerFactory::TransformerFor(BMessage* message, 46 VertexSource& source) 47 { 48 switch (message->what) { 49 case AffineTransformer::archive_code: 50 return new AffineTransformer(source, message); 51 case PerspectiveTransformer::archive_code: 52 return new PerspectiveTransformer(source, message); 53 case ContourTransformer::archive_code: 54 return new ContourTransformer(source, message); 55 case StrokeTransformer::archive_code: 56 return new StrokeTransformer(source, message); 57 } 58 59 return NULL; 60 } 61 62