|
1086
|
1 /**
|
|
|
2 * Copyright (c) 2006-2012 LOVE Development Team
|
|
|
3 *
|
|
|
4 * This software is provided 'as-is', without any express or implied
|
|
|
5 * warranty. In no event will the authors be held liable for any damages
|
|
|
6 * arising from the use of this software.
|
|
|
7 *
|
|
|
8 * Permission is granted to anyone to use this software for any purpose,
|
|
|
9 * including commercial applications, and to alter it and redistribute it
|
|
|
10 * freely, subject to the following restrictions:
|
|
|
11 *
|
|
|
12 * 1. The origin of this software must not be misrepresented; you must not
|
|
|
13 * claim that you wrote the original software. If you use this software
|
|
|
14 * in a product, an acknowledgment in the product documentation would be
|
|
|
15 * appreciated but is not required.
|
|
|
16 * 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
17 * misrepresented as being the original software.
|
|
|
18 * 3. This notice may not be removed or altered from any source distribution.
|
|
|
19 **/
|
|
|
20
|
|
|
21 #include "Graphics.h"
|
|
|
22
|
|
|
23 namespace love
|
|
|
24 {
|
|
|
25 namespace graphics
|
|
|
26 {
|
|
|
27
|
|
|
28 Graphics::~Graphics()
|
|
|
29 {
|
|
|
30 }
|
|
|
31
|
|
|
32 bool Graphics::getConstant(const char *in, DrawMode &out)
|
|
|
33 {
|
|
|
34 return drawModes.find(in, out);
|
|
|
35 }
|
|
|
36
|
|
|
37 bool Graphics::getConstant(DrawMode in, const char *&out)
|
|
|
38 {
|
|
|
39 return drawModes.find(in, out);
|
|
|
40 }
|
|
|
41
|
|
|
42 bool Graphics::getConstant(const char *in, AlignMode &out)
|
|
|
43 {
|
|
|
44 return alignModes.find(in, out);
|
|
|
45 }
|
|
|
46
|
|
|
47 bool Graphics::getConstant(AlignMode in, const char *&out)
|
|
|
48 {
|
|
|
49 return alignModes.find(in, out);
|
|
|
50 }
|
|
|
51
|
|
|
52 bool Graphics::getConstant(const char *in, BlendMode &out)
|
|
|
53 {
|
|
|
54 return blendModes.find(in, out);
|
|
|
55 }
|
|
|
56
|
|
|
57 bool Graphics::getConstant(BlendMode in, const char *&out)
|
|
|
58 {
|
|
|
59 return blendModes.find(in, out);
|
|
|
60 }
|
|
|
61
|
|
|
62 bool Graphics::getConstant(const char *in, ColorMode &out)
|
|
|
63 {
|
|
|
64 return colorModes.find(in, out);
|
|
|
65 }
|
|
|
66
|
|
|
67 bool Graphics::getConstant(ColorMode in, const char *&out)
|
|
|
68 {
|
|
|
69 return colorModes.find(in, out);
|
|
|
70 }
|
|
|
71
|
|
|
72 bool Graphics::getConstant(const char *in, LineStyle &out)
|
|
|
73 {
|
|
|
74 return lineStyles.find(in, out);
|
|
|
75 }
|
|
|
76
|
|
|
77 bool Graphics::getConstant(LineStyle in, const char *&out)
|
|
|
78 {
|
|
|
79 return lineStyles.find(in, out);
|
|
|
80 }
|
|
|
81
|
|
|
82 bool Graphics::getConstant(const char *in, PointStyle &out)
|
|
|
83 {
|
|
|
84 return pointStyles.find(in, out);
|
|
|
85 }
|
|
|
86
|
|
|
87 bool Graphics::getConstant(PointStyle in, const char *&out)
|
|
|
88 {
|
|
|
89 return pointStyles.find(in, out);
|
|
|
90 }
|
|
|
91
|
|
|
92 bool Graphics::getConstant(const char *in, Support &out)
|
|
|
93 {
|
|
|
94 return support.find(in, out);
|
|
|
95 }
|
|
|
96
|
|
|
97 bool Graphics::getConstant(Support in, const char *&out)
|
|
|
98 {
|
|
|
99 return support.find(in, out);
|
|
|
100 }
|
|
|
101
|
|
|
102 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM>::Entry Graphics::drawModeEntries[] =
|
|
|
103 {
|
|
|
104 { "line", Graphics::DRAW_LINE },
|
|
|
105 { "fill", Graphics::DRAW_FILL },
|
|
|
106 };
|
|
|
107
|
|
|
108 StringMap<Graphics::DrawMode, Graphics::DRAW_MAX_ENUM> Graphics::drawModes(Graphics::drawModeEntries, sizeof(Graphics::drawModeEntries));
|
|
|
109
|
|
|
110 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM>::Entry Graphics::alignModeEntries[] =
|
|
|
111 {
|
|
|
112 { "left", Graphics::ALIGN_LEFT },
|
|
|
113 { "right", Graphics::ALIGN_RIGHT },
|
|
|
114 { "center", Graphics::ALIGN_CENTER },
|
|
|
115 };
|
|
|
116
|
|
|
117 StringMap<Graphics::AlignMode, Graphics::ALIGN_MAX_ENUM> Graphics::alignModes(Graphics::alignModeEntries, sizeof(Graphics::alignModeEntries));
|
|
|
118
|
|
|
119 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] =
|
|
|
120 {
|
|
|
121 { "alpha", Graphics::BLEND_ALPHA },
|
|
|
122 { "additive", Graphics::BLEND_ADDITIVE },
|
|
|
123 { "subtractive", Graphics::BLEND_SUBTRACTIVE },
|
|
|
124 { "multiplicative", Graphics::BLEND_MULTIPLICATIVE },
|
|
|
125 { "premultiplied", Graphics::BLEND_PREMULTIPLIED },
|
|
|
126 };
|
|
|
127
|
|
|
128 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
|
|
|
129
|
|
|
130 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM>::Entry Graphics::colorModeEntries[] =
|
|
|
131 {
|
|
|
132 { "replace", Graphics::COLOR_REPLACE },
|
|
|
133 { "modulate", Graphics::COLOR_MODULATE },
|
|
|
134 { "combine", Graphics::COLOR_COMBINE },
|
|
|
135 };
|
|
|
136
|
|
|
137 StringMap<Graphics::ColorMode, Graphics::COLOR_MAX_ENUM> Graphics::colorModes(Graphics::colorModeEntries, sizeof(Graphics::colorModeEntries));
|
|
|
138
|
|
|
139 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM>::Entry Graphics::lineStyleEntries[] =
|
|
|
140 {
|
|
|
141 { "smooth", Graphics::LINE_SMOOTH },
|
|
|
142 { "rough", Graphics::LINE_ROUGH }
|
|
|
143 };
|
|
|
144
|
|
|
145 StringMap<Graphics::LineStyle, Graphics::LINE_MAX_ENUM> Graphics::lineStyles(Graphics::lineStyleEntries, sizeof(Graphics::lineStyleEntries));
|
|
|
146
|
|
|
147 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM>::Entry Graphics::pointStyleEntries[] =
|
|
|
148 {
|
|
|
149 { "smooth", Graphics::POINT_SMOOTH },
|
|
|
150 { "rough", Graphics::POINT_ROUGH }
|
|
|
151 };
|
|
|
152
|
|
|
153 StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM> Graphics::pointStyles(Graphics::pointStyleEntries, sizeof(Graphics::pointStyleEntries));
|
|
|
154
|
|
|
155 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] =
|
|
|
156 {
|
|
|
157 { "canvas", Graphics::SUPPORT_CANVAS },
|
|
|
158 { "pixeleffect", Graphics::SUPPORT_PIXELEFFECT },
|
|
|
159 { "npot", Graphics::SUPPORT_NPOT },
|
|
|
160 { "subtractive", Graphics::SUPPORT_SUBTRACTIVE },
|
|
|
161 };
|
|
|
162
|
|
|
163 StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries));
|
|
|
164
|
|
|
165 } // graphics
|
|
|
166 } // love
|