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