1 /* 2 * Copyright 2006-2007, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef FLAT_ICON_IMPORTER_H 9 #define FLAT_ICON_IMPORTER_H 10 11 12 #ifdef ICON_O_MATIC 13 # include "Importer.h" 14 #else 15 # include <SupportDefs.h> 16 #endif 17 18 #include "Container.h" 19 #include "IconBuild.h" 20 21 22 class BMessage; 23 class BPositionIO; 24 25 26 _BEGIN_ICON_NAMESPACE 27 28 29 class Icon; 30 class LittleEndianBuffer; 31 class PathContainer; 32 class Shape; 33 class Style; 34 class VectorPath; 35 36 #ifdef ICON_O_MATIC 37 class FlatIconImporter : public Importer { 38 #else 39 class FlatIconImporter { 40 #endif 41 public: 42 FlatIconImporter(); 43 virtual ~FlatIconImporter(); 44 45 // FlatIconImporter 46 status_t Import(Icon* icon, 47 BPositionIO* stream); 48 49 status_t Import(Icon* icon, 50 uint8* buffer, size_t size); 51 52 private: 53 status_t _ParseSections(LittleEndianBuffer& buffer, 54 Icon* icon); 55 56 status_t _ParseStyles(LittleEndianBuffer& buffer, 57 Container<Style>* styles); 58 status_t _ParsePaths(LittleEndianBuffer& buffer, 59 Container<VectorPath>* paths); 60 Shape* _ReadPathSourceShape( 61 LittleEndianBuffer& buffer, 62 Container<Style>* styles, 63 Container<VectorPath>* paths); 64 status_t _ParseShapes(LittleEndianBuffer& buffer, 65 Container<Style>* styles, 66 Container<VectorPath>* paths, 67 Container<Shape>* shapes); 68 }; 69 70 71 _END_ICON_NAMESPACE 72 73 74 #endif // FLAT_ICON_IMPORTER_H 75