1 // Aseprite Document Library 2 // Copyright (c) 2015 David Capello 3 // 4 // This file is released under the terms of the MIT license. 5 // Read LICENSE.txt for more information. 6 7 #ifdef HAVE_CONFIG_H 8 #include "config.h" 9 #endif 10 11 #include "doc/brush_type.h" 12 13 namespace doc { 14 brush_type_to_string_id(BrushType brushType)15std::string brush_type_to_string_id(BrushType brushType) 16 { 17 switch (brushType) { 18 case kCircleBrushType: return "circle"; 19 case kSquareBrushType: return "square"; 20 case kLineBrushType: return "line"; 21 case kImageBrushType: return "image"; 22 } 23 return "unknown"; 24 } 25 string_id_to_brush_type(const std::string & s)26BrushType string_id_to_brush_type(const std::string& s) 27 { 28 if (s == "circle") return kCircleBrushType; 29 if (s == "square") return kSquareBrushType; 30 if (s == "line") return kLineBrushType; 31 if (s == "image") return kImageBrushType; 32 return kFirstBrushType; 33 } 34 35 } // namespace doc 36