xref: /haiku/src/libs/icon/flat_icon/FlatIconFormat.h (revision 25dc253d6ab28ce204fa4de2d3e7a27d167fc817)
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_FORMAT_H
9 #define FLAT_ICON_FORMAT_H
10 
11 
12 #include <SupportDefs.h>
13 
14 #include "IconBuild.h"
15 
16 
17 _BEGIN_ICON_NAMESPACE
18 
19 
20 extern const uint32 FLAT_ICON_MAGIC;
21 
22 extern const char* kVectorAttrNodeName;
23 extern const char* kVectorAttrMimeName;
24 
25 enum {
26 	STYLE_TYPE_SOLID_COLOR			= 1,
27 	STYLE_TYPE_GRADIENT				= 2,
28 	STYLE_TYPE_SOLID_COLOR_NO_ALPHA	= 3,
29 	STYLE_TYPE_SOLID_GRAY			= 4,
30 	STYLE_TYPE_SOLID_GRAY_NO_ALPHA	= 5,
31 
32 	SHAPE_TYPE_PATH_SOURCE			= 10,
33 
34 	TRANSFORMER_TYPE_AFFINE			= 20,
35 	TRANSFORMER_TYPE_CONTOUR		= 21,
36 	TRANSFORMER_TYPE_PERSPECTIVE	= 22,
37 	TRANSFORMER_TYPE_STROKE			= 23,
38 };
39 
40 enum {
41 	GRADIENT_FLAG_TRANSFORM			= 1 << 1,
42 	GRADIENT_FLAG_NO_ALPHA			= 1 << 2,
43 	GRADIENT_FLAG_16_BIT_COLORS		= 1 << 3, // not yet used
44 	GRADIENT_FLAG_GRAYS				= 1 << 4,
45 };
46 
47 enum {
48 	PATH_FLAG_CLOSED				= 1 << 1,
49 	PATH_FLAG_USES_COMMANDS			= 1 << 2,
50 	PATH_FLAG_NO_CURVES				= 1 << 3,
51 };
52 
53 enum {
54 	PATH_COMMAND_H_LINE				= 0,
55 	PATH_COMMAND_V_LINE				= 1,
56 	PATH_COMMAND_LINE				= 2,
57 	PATH_COMMAND_CURVE				= 3,
58 };
59 
60 enum {
61 	SHAPE_FLAG_TRANSFORM			= 1 << 1,
62 	SHAPE_FLAG_HINTING				= 1 << 2,
63 	SHAPE_FLAG_LOD_SCALE			= 1 << 3,
64 	SHAPE_FLAG_HAS_TRANSFORMERS		= 1 << 4,
65 	SHAPE_FLAG_TRANSLATION			= 1 << 5,
66 };
67 
68 // utility functions
69 
70 class LittleEndianBuffer;
71 
72 bool read_coord(LittleEndianBuffer& buffer, float& coord);
73 bool write_coord(LittleEndianBuffer& buffer, float coord);
74 
75 bool read_float_24(LittleEndianBuffer& buffer, float& value);
76 bool write_float_24(LittleEndianBuffer& buffer, float value);
77 
78 
79 _END_ICON_NAMESPACE
80 
81 
82 #endif	// FLAT_ICON_FORMAT_H
83