swfmill 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +23 -0
- data/.swfmill +240 -0
- data/LICENSE +340 -0
- data/README.rdoc +37 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/ext/.gitignore +5 -0
- data/ext/extconf.rb +86 -0
- data/ext/swfmill/.gitignore +27 -0
- data/ext/swfmill/AUTHORS +9 -0
- data/ext/swfmill/COPYING +340 -0
- data/ext/swfmill/Makefile.am +14 -0
- data/ext/swfmill/Makefile.in +635 -0
- data/ext/swfmill/NEWS +189 -0
- data/ext/swfmill/README +170 -0
- data/ext/swfmill/TODO +33 -0
- data/ext/swfmill/aclocal.m4 +7712 -0
- data/ext/swfmill/autogen.sh +7 -0
- data/ext/swfmill/compile +142 -0
- data/ext/swfmill/config.guess +1516 -0
- data/ext/swfmill/config.sub +1626 -0
- data/ext/swfmill/configure +21868 -0
- data/ext/swfmill/configure.ac +55 -0
- data/ext/swfmill/depcomp +589 -0
- data/ext/swfmill/install-sh +519 -0
- data/ext/swfmill/ltmain.sh +6964 -0
- data/ext/swfmill/missing +367 -0
- data/ext/swfmill/src/Geom.cpp +107 -0
- data/ext/swfmill/src/Geom.h +100 -0
- data/ext/swfmill/src/Makefile.am +86 -0
- data/ext/swfmill/src/Makefile.in +1025 -0
- data/ext/swfmill/src/SWF.h +11941 -0
- data/ext/swfmill/src/SWFAction.cpp +41 -0
- data/ext/swfmill/src/SWFAction.h +19 -0
- data/ext/swfmill/src/SWFBasic.h +7 -0
- data/ext/swfmill/src/SWFFile.cpp +406 -0
- data/ext/swfmill/src/SWFFile.h +34 -0
- data/ext/swfmill/src/SWFFilter.cpp +25 -0
- data/ext/swfmill/src/SWFFilter.h +15 -0
- data/ext/swfmill/src/SWFGlyphList.cpp +262 -0
- data/ext/swfmill/src/SWFGlyphList.h +34 -0
- data/ext/swfmill/src/SWFIdItem.h +85 -0
- data/ext/swfmill/src/SWFIdItems.h +16 -0
- data/ext/swfmill/src/SWFItem.cpp +235 -0
- data/ext/swfmill/src/SWFItem.h +60 -0
- data/ext/swfmill/src/SWFList.h +179 -0
- data/ext/swfmill/src/SWFReader.cpp +352 -0
- data/ext/swfmill/src/SWFReader.h +73 -0
- data/ext/swfmill/src/SWFShapeItem.cpp +220 -0
- data/ext/swfmill/src/SWFShapeItem.h +45 -0
- data/ext/swfmill/src/SWFShapeMaker.cpp +401 -0
- data/ext/swfmill/src/SWFShapeMaker.h +128 -0
- data/ext/swfmill/src/SWFTag.cpp +49 -0
- data/ext/swfmill/src/SWFTag.h +20 -0
- data/ext/swfmill/src/SWFTrait.cpp +35 -0
- data/ext/swfmill/src/SWFTrait.h +22 -0
- data/ext/swfmill/src/SWFWriter.cpp +312 -0
- data/ext/swfmill/src/SWFWriter.h +84 -0
- data/ext/swfmill/src/base64.c +110 -0
- data/ext/swfmill/src/base64.h +15 -0
- data/ext/swfmill/src/codegen/Makefile.am +15 -0
- data/ext/swfmill/src/codegen/Makefile.in +346 -0
- data/ext/swfmill/src/codegen/basic.xsl +45 -0
- data/ext/swfmill/src/codegen/basics.xsl +235 -0
- data/ext/swfmill/src/codegen/dumper.xsl +109 -0
- data/ext/swfmill/src/codegen/header.xsl +131 -0
- data/ext/swfmill/src/codegen/mk.xsl +26 -0
- data/ext/swfmill/src/codegen/parser.xsl +196 -0
- data/ext/swfmill/src/codegen/parsexml.xsl +312 -0
- data/ext/swfmill/src/codegen/size.xsl +189 -0
- data/ext/swfmill/src/codegen/source.xml +2197 -0
- data/ext/swfmill/src/codegen/writer.xsl +190 -0
- data/ext/swfmill/src/codegen/writexml.xsl +138 -0
- data/ext/swfmill/src/swfmill.cpp +482 -0
- data/ext/swfmill/src/swft/Makefile.am +55 -0
- data/ext/swfmill/src/swft/Makefile.in +717 -0
- data/ext/swfmill/src/swft/Parser.cpp +76 -0
- data/ext/swfmill/src/swft/Parser.h +37 -0
- data/ext/swfmill/src/swft/SVGAttributeParser.cpp +78 -0
- data/ext/swfmill/src/swft/SVGAttributeParser.h +35 -0
- data/ext/swfmill/src/swft/SVGColor.cpp +116 -0
- data/ext/swfmill/src/swft/SVGColor.h +37 -0
- data/ext/swfmill/src/swft/SVGColors.h +167 -0
- data/ext/swfmill/src/swft/SVGGradient.cpp +258 -0
- data/ext/swfmill/src/swft/SVGGradient.h +81 -0
- data/ext/swfmill/src/swft/SVGPathParser.cpp +155 -0
- data/ext/swfmill/src/swft/SVGPathParser.h +126 -0
- data/ext/swfmill/src/swft/SVGPointsParser.cpp +51 -0
- data/ext/swfmill/src/swft/SVGPointsParser.h +25 -0
- data/ext/swfmill/src/swft/SVGStyle.cpp +181 -0
- data/ext/swfmill/src/swft/SVGStyle.h +80 -0
- data/ext/swfmill/src/swft/SVGTransformParser.cpp +72 -0
- data/ext/swfmill/src/swft/SVGTransformParser.h +32 -0
- data/ext/swfmill/src/swft/readpng.c +305 -0
- data/ext/swfmill/src/swft/readpng.h +92 -0
- data/ext/swfmill/src/swft/swft.cpp +251 -0
- data/ext/swfmill/src/swft/swft.h +64 -0
- data/ext/swfmill/src/swft/swft_document.cpp +57 -0
- data/ext/swfmill/src/swft/swft_import.cpp +38 -0
- data/ext/swfmill/src/swft/swft_import_binary.cpp +82 -0
- data/ext/swfmill/src/swft/swft_import_jpeg.cpp +255 -0
- data/ext/swfmill/src/swft/swft_import_mp3.cpp +268 -0
- data/ext/swfmill/src/swft/swft_import_png.cpp +231 -0
- data/ext/swfmill/src/swft/swft_import_ttf.cpp +519 -0
- data/ext/swfmill/src/swft/swft_import_wav.cpp +255 -0
- data/ext/swfmill/src/swft/swft_path.cpp +178 -0
- data/ext/swfmill/src/xslt/Makefile.am +51 -0
- data/ext/swfmill/src/xslt/Makefile.in +536 -0
- data/ext/swfmill/src/xslt/README +19 -0
- data/ext/swfmill/src/xslt/assemble.xsl +38 -0
- data/ext/swfmill/src/xslt/simple-deprecated.xslt +62 -0
- data/ext/swfmill/src/xslt/simple-elements.xslt +627 -0
- data/ext/swfmill/src/xslt/simple-import.xslt +565 -0
- data/ext/swfmill/src/xslt/simple-svg.xslt +383 -0
- data/ext/swfmill/src/xslt/simple-tools.xslt +255 -0
- data/ext/swfmill/src/xslt/simple.cpp +1686 -0
- data/ext/swfmill/src/xslt/simple.xml +7 -0
- data/ext/swfmill/src/xslt/xslt.h +7 -0
- data/ext/swfmill/test/Makefile.am +1 -0
- data/ext/swfmill/test/Makefile.in +490 -0
- data/ext/swfmill/test/xml/Makefile.am +20 -0
- data/ext/swfmill/test/xml/Makefile.in +353 -0
- data/ext/swfmill/test/xml/test-xml +21 -0
- data/ext/swfmill_ext.cc +375 -0
- data/lib/swfmill.rb +30 -0
- data/spec/data/swfmill-banner1.swf +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/swfmill_spec.rb +125 -0
- metadata +206 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
#include "Parser.h"
|
2
|
+
#include <cstring>
|
3
|
+
|
4
|
+
namespace SWF {
|
5
|
+
|
6
|
+
Parser::Parser(const char begin, const char end, const char parameter) {
|
7
|
+
expectedDelimiter = begin;
|
8
|
+
otherDelimiter = end;
|
9
|
+
parameterDelimiter = parameter;
|
10
|
+
}
|
11
|
+
|
12
|
+
Parser::~Parser() {
|
13
|
+
}
|
14
|
+
|
15
|
+
void Parser::swapDelimiters() {
|
16
|
+
char tmp = otherDelimiter;
|
17
|
+
otherDelimiter = expectedDelimiter;
|
18
|
+
expectedDelimiter = tmp;
|
19
|
+
}
|
20
|
+
|
21
|
+
bool Parser::isWhitespace(const char c) {
|
22
|
+
return (c == 0 || c == '\n' || c == '\r' || c == '\t' || c == ' ');
|
23
|
+
}
|
24
|
+
|
25
|
+
void Parser::doParse(const char* str) {
|
26
|
+
string tmp;
|
27
|
+
|
28
|
+
insideParams = false;
|
29
|
+
params.clear();
|
30
|
+
|
31
|
+
for (size_t i = 0; i < strlen(str); i++) {
|
32
|
+
if(str[i] == expectedDelimiter) {
|
33
|
+
handleDelimiter(tmp);
|
34
|
+
} else if(str[i] == otherDelimiter) {
|
35
|
+
cerr << "WARNING: Unexpected delimiter while parsing" << endl;
|
36
|
+
} else {
|
37
|
+
if(tmp.length() > 0 && (str[i] == parameterDelimiter || isWhitespace(str[i]))) {
|
38
|
+
trimString(tmp);
|
39
|
+
params.push_back(tmp);
|
40
|
+
tmp.clear();
|
41
|
+
} else {
|
42
|
+
tmp += str[i];
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
if (tmp.length() > 0) {
|
48
|
+
//cerr << "WARNING: Reached end of line while parsing" << endl;
|
49
|
+
handleDelimiter(tmp);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
void Parser::handleDelimiter(string& tmp) {
|
54
|
+
trimString(tmp);
|
55
|
+
|
56
|
+
if(insideParams) {
|
57
|
+
if(tmp.length() > 0) {
|
58
|
+
params.push_back(tmp);
|
59
|
+
}
|
60
|
+
handleData(outside, params);
|
61
|
+
params.clear();
|
62
|
+
} else {
|
63
|
+
outside = tmp;
|
64
|
+
}
|
65
|
+
|
66
|
+
insideParams = !insideParams;
|
67
|
+
tmp.clear();
|
68
|
+
swapDelimiters();
|
69
|
+
}
|
70
|
+
|
71
|
+
void Parser::trimString(string& s) {
|
72
|
+
s.erase(0, s.find_first_not_of(" \t\r\n"));
|
73
|
+
s.erase(s.find_last_not_of(" \t\r\n") + 1);
|
74
|
+
}
|
75
|
+
|
76
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#ifndef PARSER_H
|
2
|
+
#define PARSER_H
|
3
|
+
|
4
|
+
#include <iostream>
|
5
|
+
#include <string>
|
6
|
+
#include <vector>
|
7
|
+
|
8
|
+
using namespace std;
|
9
|
+
|
10
|
+
namespace SWF {
|
11
|
+
|
12
|
+
class Parser {
|
13
|
+
public:
|
14
|
+
Parser(const char begin, const char end, const char parameter = 0);
|
15
|
+
virtual ~Parser();
|
16
|
+
|
17
|
+
protected:
|
18
|
+
virtual void handleData(const string& outside, const vector<string>& inside) = 0;
|
19
|
+
void doParse(const char* str);
|
20
|
+
void trimString(string& s);
|
21
|
+
|
22
|
+
private:
|
23
|
+
void handleDelimiter(string& tmp);
|
24
|
+
void swapDelimiters();
|
25
|
+
bool isWhitespace(const char c);
|
26
|
+
|
27
|
+
char expectedDelimiter;
|
28
|
+
char otherDelimiter;
|
29
|
+
char parameterDelimiter;
|
30
|
+
bool insideParams;
|
31
|
+
vector<string> params;
|
32
|
+
string outside;
|
33
|
+
};
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
#endif
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#include "SVGAttributeParser.h"
|
2
|
+
|
3
|
+
#define DPI 90.0
|
4
|
+
|
5
|
+
using namespace std;
|
6
|
+
|
7
|
+
namespace SWF {
|
8
|
+
|
9
|
+
void AttributeParser::parseNode(xmlNodePtr node) {
|
10
|
+
for(xmlAttrPtr attr = node->properties; attr != NULL; attr = attr->next) {
|
11
|
+
xmlChar *tmp = xmlGetProp(node, attr->name);
|
12
|
+
if(tmp) {
|
13
|
+
attributes[(char *)attr->name] = (char *)tmp;
|
14
|
+
xmlFree(tmp);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
xmlChar *tmp = xmlGetProp(node, (const xmlChar *)"style");
|
19
|
+
if(tmp) {
|
20
|
+
doParse((char *)tmp);
|
21
|
+
xmlFree(tmp);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
double AttributeParser::getDouble(const char* attribute, double defaultValue, double value100) {
|
27
|
+
const char *tmp = getString(attribute);
|
28
|
+
if(tmp) {
|
29
|
+
string tmpStr = tmp;
|
30
|
+
|
31
|
+
char *tailPtr;
|
32
|
+
double value = strtod(tmpStr.c_str(), &tailPtr);
|
33
|
+
|
34
|
+
string unit = tailPtr;
|
35
|
+
trimString(unit);
|
36
|
+
|
37
|
+
if(unit == "in") {
|
38
|
+
value *= DPI;
|
39
|
+
} else if(unit == "cm") {
|
40
|
+
value *= DPI / 2.54;
|
41
|
+
} else if(unit == "mm") {
|
42
|
+
value *= DPI / 25.4;
|
43
|
+
} else if(unit == "pt") {
|
44
|
+
value *= DPI / 72.0;
|
45
|
+
} else if(unit == "pc") {
|
46
|
+
value *= DPI / 72.0 * 12.0;
|
47
|
+
} else if(unit == "%") {
|
48
|
+
value *= value100 / 100;
|
49
|
+
}
|
50
|
+
|
51
|
+
return value;
|
52
|
+
} else {
|
53
|
+
return defaultValue;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
const char *AttributeParser::getString(const char* attribute) {
|
58
|
+
map<string, string>::iterator iter = attributes.find(attribute);
|
59
|
+
if(iter != attributes.end()) {
|
60
|
+
return (*iter).second.c_str();
|
61
|
+
} else {
|
62
|
+
return NULL;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
const char *AttributeParser::operator[](const char* attribute) {
|
67
|
+
return getString(attribute);
|
68
|
+
}
|
69
|
+
|
70
|
+
map<string, string> &AttributeParser::getAttributes() {
|
71
|
+
return attributes;
|
72
|
+
}
|
73
|
+
|
74
|
+
void AttributeParser::handleData(const string& attrib, const vector<string>& value) {
|
75
|
+
attributes[attrib] = value[0];
|
76
|
+
}
|
77
|
+
|
78
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#ifndef SVG_ATTRIBUTE_PARSER_H
|
2
|
+
#define SVG_ATTRIBUTE_PARSER_H
|
3
|
+
|
4
|
+
#include <string>
|
5
|
+
#include <map>
|
6
|
+
#include <iostream>
|
7
|
+
#include <libxml/tree.h>
|
8
|
+
#include "Parser.h"
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
namespace SWF {
|
13
|
+
|
14
|
+
class AttributeParser : public Parser {
|
15
|
+
public:
|
16
|
+
AttributeParser() :
|
17
|
+
Parser(':', ';') {
|
18
|
+
}
|
19
|
+
|
20
|
+
void parseNode(xmlNodePtr node);
|
21
|
+
std::map<std::string, std::string>& getAttributes();
|
22
|
+
|
23
|
+
double getDouble(const char* attribute, double defaultValue = 0,
|
24
|
+
double value100 = 1);
|
25
|
+
const char* getString(const char* attribute);
|
26
|
+
const char* operator[](const char* attribute);
|
27
|
+
|
28
|
+
private:
|
29
|
+
std::map<std::string, std::string> attributes;
|
30
|
+
void handleData(const std::string& attrib, const std::vector<std::string>& value);
|
31
|
+
};
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
#endif
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#include "SVGColor.h"
|
2
|
+
#include "SVGColors.h"
|
3
|
+
|
4
|
+
#define TMP_STRLEN 0xFF
|
5
|
+
|
6
|
+
using namespace std;
|
7
|
+
|
8
|
+
namespace SWF {
|
9
|
+
|
10
|
+
SVGColor::SVGColor() {
|
11
|
+
r = 0;
|
12
|
+
g = 0;
|
13
|
+
b = 0;
|
14
|
+
a = 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
SVGColor::SVGColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a) {
|
18
|
+
setColor(_r, _g, _b, _a);
|
19
|
+
}
|
20
|
+
|
21
|
+
void SVGColor::setColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a) {
|
22
|
+
r = _r;
|
23
|
+
g = _g;
|
24
|
+
b = _b;
|
25
|
+
a = _a;
|
26
|
+
}
|
27
|
+
|
28
|
+
void SVGColor::setAlpha(unsigned char _a) {
|
29
|
+
a = _a;
|
30
|
+
}
|
31
|
+
|
32
|
+
void SVGColor::setAlpha(double _a) {
|
33
|
+
a = (unsigned char)(_a * 255.0);
|
34
|
+
}
|
35
|
+
|
36
|
+
bool SVGColor::parse(string &color) {
|
37
|
+
if(color == "none" || color == "") {
|
38
|
+
return false;
|
39
|
+
} else {
|
40
|
+
if(color[0] == '#') {
|
41
|
+
if(color.length() == 4) {
|
42
|
+
int c[3];
|
43
|
+
|
44
|
+
for(int i = 0; i < 3; i++)
|
45
|
+
sscanf(color.substr(1 + i, 1).c_str(), "%x", &c[i]);
|
46
|
+
|
47
|
+
r = (c[0] << 4) + c[0];
|
48
|
+
g = (c[1] << 4) + c[1];
|
49
|
+
b = (c[2] << 4) + c[2];
|
50
|
+
a = 255;
|
51
|
+
} else if (color.length() == 7) {
|
52
|
+
int c[3];
|
53
|
+
|
54
|
+
for(int i = 0; i < 3; i++)
|
55
|
+
sscanf(color.substr(1 + i*2, 2).c_str(), "%x", &c[i]);
|
56
|
+
|
57
|
+
r = c[0];
|
58
|
+
g = c[1];
|
59
|
+
b = c[2];
|
60
|
+
a = 255;
|
61
|
+
} else {
|
62
|
+
cerr << "WARNING: can't parse color" << endl;
|
63
|
+
return false;
|
64
|
+
}
|
65
|
+
} else if(color.substr(0, 3) == "rgb") {
|
66
|
+
double pR, pG, pB;
|
67
|
+
if(sscanf(color.c_str(), "rgb(%lf%%,%lf%%,%lf%%)", &pR, &pG, &pB) == 3) {
|
68
|
+
r = (unsigned char)(pR / 100.0 * 255.0);
|
69
|
+
g = (unsigned char)(pG / 100.0 * 255.0);
|
70
|
+
b = (unsigned char)(pB / 100.0 * 255.0);
|
71
|
+
a = 255;
|
72
|
+
} else if(sscanf(color.c_str(), "rgb(%hhu,%hhu,%hhu)", &r, &g, &b) == 3) {
|
73
|
+
a = 255;
|
74
|
+
return true;
|
75
|
+
} else {
|
76
|
+
cerr << "WARNING: can't parse rgb color" << endl;
|
77
|
+
return false;
|
78
|
+
}
|
79
|
+
} else {
|
80
|
+
for(int i = 0; i < SVG_COLOR_COUNT; i++) {
|
81
|
+
if(svgColors[i].name == color) {
|
82
|
+
r = svgColors[i].r;
|
83
|
+
g = svgColors[i].g;
|
84
|
+
b = svgColors[i].b;
|
85
|
+
a = 255;
|
86
|
+
return true;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
cerr << "WARNING: color name not found (" << color << ")" << endl;
|
90
|
+
return false;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
|
96
|
+
bool SVGColor::parse(const char *color) {
|
97
|
+
string tmp(color);
|
98
|
+
return parse(tmp);
|
99
|
+
}
|
100
|
+
|
101
|
+
void SVGColor::writeXML(xmlNodePtr parent) {
|
102
|
+
xmlNodePtr node;
|
103
|
+
char tmp[TMP_STRLEN];
|
104
|
+
|
105
|
+
node = xmlNewChild(parent, NULL, (const xmlChar *)"Color", NULL);
|
106
|
+
snprintf(tmp, TMP_STRLEN, "%i", r);
|
107
|
+
xmlSetProp(node, (const xmlChar *)"red", (const xmlChar *)&tmp);
|
108
|
+
snprintf(tmp, TMP_STRLEN, "%i", g);
|
109
|
+
xmlSetProp(node, (const xmlChar *)"green", (const xmlChar *)&tmp);
|
110
|
+
snprintf(tmp, TMP_STRLEN, "%i", b);
|
111
|
+
xmlSetProp(node, (const xmlChar *)"blue", (const xmlChar *)&tmp);
|
112
|
+
snprintf(tmp, TMP_STRLEN, "%i", a);
|
113
|
+
xmlSetProp(node, (const xmlChar *)"alpha", (const xmlChar *)&tmp);
|
114
|
+
}
|
115
|
+
|
116
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#ifndef SVG_COLOR_H
|
2
|
+
#define SVG_COLOR_H
|
3
|
+
|
4
|
+
#include <string>
|
5
|
+
#include <map>
|
6
|
+
#include <iostream>
|
7
|
+
#include <libxml/tree.h>
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
namespace SWF {
|
12
|
+
|
13
|
+
class SVGColor {
|
14
|
+
public:
|
15
|
+
SVGColor();
|
16
|
+
SVGColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a = 255);
|
17
|
+
|
18
|
+
void initColors();
|
19
|
+
|
20
|
+
void setColor(unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a = 255);
|
21
|
+
void setAlpha(unsigned char _a);
|
22
|
+
void setAlpha(double _a);
|
23
|
+
bool parse(std::string &color);
|
24
|
+
bool parse(const char *color);
|
25
|
+
|
26
|
+
void writeXML(xmlNodePtr parent);
|
27
|
+
|
28
|
+
private:
|
29
|
+
unsigned char r;
|
30
|
+
unsigned char g;
|
31
|
+
unsigned char b;
|
32
|
+
unsigned char a;
|
33
|
+
};
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
#endif
|
@@ -0,0 +1,167 @@
|
|
1
|
+
#ifndef SVG_COLORS_H
|
2
|
+
#define SVG_COLORS_H
|
3
|
+
|
4
|
+
#include <string>
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
struct ColorStruct {
|
9
|
+
std::string name;
|
10
|
+
unsigned char r;
|
11
|
+
unsigned char g;
|
12
|
+
unsigned char b;
|
13
|
+
};
|
14
|
+
|
15
|
+
ColorStruct svgColors[] = {
|
16
|
+
{"aliceblue", 240, 248, 255},
|
17
|
+
{"antiquewhite", 250, 235, 215},
|
18
|
+
{"aqua", 0, 255, 255},
|
19
|
+
{"aquamarine", 127, 255, 212},
|
20
|
+
{"azure", 240, 255, 255},
|
21
|
+
{"beige", 245, 245, 220},
|
22
|
+
{"bisque", 255, 228, 196},
|
23
|
+
{"black", 0, 0, 0},
|
24
|
+
{"blanchedalmond", 255, 235, 205},
|
25
|
+
{"blue", 0, 0, 255},
|
26
|
+
{"blueviolet", 138, 43, 226},
|
27
|
+
{"brown", 165, 42, 42},
|
28
|
+
{"burlywood", 222, 184, 135},
|
29
|
+
{"cadetblue", 95, 158, 160},
|
30
|
+
{"chartreuse", 127, 255, 0},
|
31
|
+
{"chocolate", 210, 105, 30},
|
32
|
+
{"coral", 255, 127, 80},
|
33
|
+
{"cornflowerblue", 100, 149, 237},
|
34
|
+
{"cornsilk", 255, 248, 220},
|
35
|
+
{"crimson", 220, 20, 60},
|
36
|
+
{"cyan", 0, 255, 255},
|
37
|
+
{"darkblue", 0, 0, 139},
|
38
|
+
{"darkcyan", 0, 139, 139},
|
39
|
+
{"darkgoldenrod", 184, 134, 11},
|
40
|
+
{"darkgray", 169, 169, 169},
|
41
|
+
{"darkgreen", 0, 100, 0},
|
42
|
+
{"darkgrey", 169, 169, 169},
|
43
|
+
{"darkkhaki", 189, 183, 107},
|
44
|
+
{"darkmagenta", 139, 0, 139},
|
45
|
+
{"darkolivegreen", 85, 107, 47},
|
46
|
+
{"darkorange", 255, 140, 0},
|
47
|
+
{"darkorchid", 153, 50, 204},
|
48
|
+
{"darkred", 139, 0, 0},
|
49
|
+
{"darksalmon", 233, 150, 122},
|
50
|
+
{"darkseagreen", 143, 188, 143},
|
51
|
+
{"darkslateblue", 72, 61, 139},
|
52
|
+
{"darkslategray", 47, 79, 79},
|
53
|
+
{"darkslategrey", 47, 79, 79},
|
54
|
+
{"darkturquoise", 0, 206, 209},
|
55
|
+
{"darkviolet", 148, 0, 211},
|
56
|
+
{"deeppink", 255, 20, 147},
|
57
|
+
{"deepskyblue", 0, 191, 255},
|
58
|
+
{"dimgray", 105, 105, 105},
|
59
|
+
{"dimgrey", 105, 105, 105},
|
60
|
+
{"dodgerblue", 30, 144, 255},
|
61
|
+
{"firebrick", 178, 34, 34},
|
62
|
+
{"floralwhite", 255, 250, 240},
|
63
|
+
{"forestgreen", 34, 139, 34},
|
64
|
+
{"fuchsia", 255, 0, 255},
|
65
|
+
{"gainsboro", 220, 220, 220},
|
66
|
+
{"ghostwhite", 248, 248, 255},
|
67
|
+
{"gold", 255, 215, 0},
|
68
|
+
{"goldenrod", 218, 165, 32},
|
69
|
+
{"gray", 128, 128, 128},
|
70
|
+
{"green", 0, 128, 0},
|
71
|
+
{"greenyellow", 173, 255, 47},
|
72
|
+
{"grey", 128, 128, 128},
|
73
|
+
{"honeydew", 240, 255, 240},
|
74
|
+
{"hotpink", 255, 105, 180},
|
75
|
+
{"indianred", 205, 92, 92},
|
76
|
+
{"indigo", 75, 0, 130},
|
77
|
+
{"ivory", 255, 255, 240},
|
78
|
+
{"khaki", 240, 230, 140},
|
79
|
+
{"lavender", 230, 230, 250},
|
80
|
+
{"lavenderblush", 255, 240, 245},
|
81
|
+
{"lawngreen", 124, 252, 0},
|
82
|
+
{"lemonchiffon", 255, 250, 205},
|
83
|
+
{"lightblue", 173, 216, 230},
|
84
|
+
{"lightcoral", 240, 128, 128},
|
85
|
+
{"lightcyan", 224, 255, 255},
|
86
|
+
{"lightgoldenrodyellow", 250, 250, 210},
|
87
|
+
{"lightgray", 211, 211, 211},
|
88
|
+
{"lightgreen", 144, 238, 144},
|
89
|
+
{"lightgrey", 211, 211, 211},
|
90
|
+
{"lightpink", 255, 182, 193},
|
91
|
+
{"lightsalmon", 255, 160, 122},
|
92
|
+
{"lightseagreen", 32, 178, 170},
|
93
|
+
{"lightskyblue", 135, 206, 250},
|
94
|
+
{"lightslategray", 119, 136, 153},
|
95
|
+
{"lightslategrey", 119, 136, 153},
|
96
|
+
{"lightsteelblue", 176, 196, 222},
|
97
|
+
{"lightyellow", 255, 255, 224},
|
98
|
+
{"lime", 0, 255, 0},
|
99
|
+
{"limegreen", 50, 205, 50},
|
100
|
+
{"linen", 250, 240, 230},
|
101
|
+
{"magenta", 255, 0, 255},
|
102
|
+
{"maroon", 128, 0, 0},
|
103
|
+
{"mediumaquamarine", 102, 205, 170},
|
104
|
+
{"mediumblue", 0, 0, 205},
|
105
|
+
{"mediumorchid", 186, 85, 211},
|
106
|
+
{"mediumpurple", 147, 112, 219},
|
107
|
+
{"mediumseagreen", 60, 179, 113},
|
108
|
+
{"mediumslateblue", 123, 104, 238},
|
109
|
+
{"mediumspringgreen", 0, 250, 154},
|
110
|
+
{"mediumturquoise", 72, 209, 204},
|
111
|
+
{"mediumvioletred", 199, 21, 133},
|
112
|
+
{"midnightblue", 25, 25, 112},
|
113
|
+
{"mintcream", 245, 255, 250},
|
114
|
+
{"mistyrose", 255, 228, 225},
|
115
|
+
{"moccasin", 255, 228, 181},
|
116
|
+
{"navajowhite", 255, 222, 173},
|
117
|
+
{"navy", 0, 0, 128},
|
118
|
+
{"oldlace", 253, 245, 230},
|
119
|
+
{"olive", 128, 128, 0},
|
120
|
+
{"olivedrab", 107, 142, 35},
|
121
|
+
{"orange", 255, 165, 0},
|
122
|
+
{"orangered", 255, 69, 0},
|
123
|
+
{"orchid", 218, 112, 214},
|
124
|
+
{"palegoldenrod", 238, 232, 170},
|
125
|
+
{"palegreen", 152, 251, 152},
|
126
|
+
{"paleturquoise", 175, 238, 238},
|
127
|
+
{"palevioletred", 219, 112, 147},
|
128
|
+
{"papayawhip", 255, 239, 213},
|
129
|
+
{"peachpuff", 255, 218, 185},
|
130
|
+
{"peru", 205, 133, 63},
|
131
|
+
{"pink", 255, 192, 203},
|
132
|
+
{"plum", 221, 160, 221},
|
133
|
+
{"powderblue", 176, 224, 230},
|
134
|
+
{"purple", 128, 0, 128},
|
135
|
+
{"red", 255, 0, 0},
|
136
|
+
{"rosybrown", 188, 143, 143},
|
137
|
+
{"royalblue", 65, 105, 225},
|
138
|
+
{"saddlebrown", 139, 69, 19},
|
139
|
+
{"salmon", 250, 128, 114},
|
140
|
+
{"sandybrown", 244, 164, 96},
|
141
|
+
{"seagreen", 46, 139, 87},
|
142
|
+
{"seashell", 255, 245, 238},
|
143
|
+
{"sienna", 160, 82, 45},
|
144
|
+
{"silver", 192, 192, 192},
|
145
|
+
{"skyblue", 135, 206, 235},
|
146
|
+
{"slateblue", 106, 90, 205},
|
147
|
+
{"slategray", 112, 128, 144},
|
148
|
+
{"slategrey", 112, 128, 144},
|
149
|
+
{"snow", 255, 250, 250},
|
150
|
+
{"springgreen", 0, 255, 127},
|
151
|
+
{"steelblue", 70, 130, 180},
|
152
|
+
{"tan", 210, 180, 140},
|
153
|
+
{"teal", 0, 128, 128},
|
154
|
+
{"thistle", 216, 191, 216},
|
155
|
+
{"tomato", 255, 99, 71},
|
156
|
+
{"turquoise", 64, 224, 208},
|
157
|
+
{"violet", 238, 130, 238},
|
158
|
+
{"wheat", 245, 222, 179},
|
159
|
+
{"white", 255, 255, 255},
|
160
|
+
{"whitesmoke", 245, 245, 245},
|
161
|
+
{"yellow", 255, 255, 0},
|
162
|
+
{"yellowgreen", 154, 205, 50}
|
163
|
+
};
|
164
|
+
|
165
|
+
#define SVG_COLOR_COUNT (sizeof(svgColors) / sizeof(ColorStruct))
|
166
|
+
|
167
|
+
#endif
|