xref: /haiku/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.h (revision 16ad15142c48ee36cd6a807a24efc99c88d4310d)
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 
9 
10 #ifndef DOCUMENT_BUILD_H
11 #define DOCUMENT_BUILD_H
12 
13 #include <stdio.h>
14 
15 #include <Rect.h>
16 #include <String.h>
17 
18 #include "IconBuild.h"
19 #include "nanosvg.h"
20 
21 
22 class SVGImporter;
23 
24 _BEGIN_ICON_NAMESPACE
25 	class Icon;
26 	class Transformable;
27 _END_ICON_NAMESPACE
28 
29 _USING_ICON_NAMESPACE
30 
31 
32 class DocumentBuilder {
33  public:
34 
35 								DocumentBuilder(NSVGimage* image);
36 
37 			void				SetTitle(const char* title);
38 			void				SetDimensions(uint32 width, uint32 height, BRect viewBox);
39 
40 
41 			status_t			GetIcon(Icon* icon,
42 										SVGImporter* importer,
43 										const char* fallbackName);
44 
45  private:
46 			status_t			_AddShape(NSVGshape* svgShape,
47 										  bool outline,
48 										  const Transformable& transform,
49 										  Icon* icon);
50 
51 
52 			uint32				fWidth;
53 			uint32				fHeight;
54 			BRect				fViewBox;
55 			BString				fTitle;
56 
57 			NSVGimage*			fSource;
58 };
59 
60 #endif // DOCUMENT_BUILD_H
61