summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/transform.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/transform.cc b/src/transform.cc
index e841ef0..01bd808 100644
--- a/src/transform.cc
+++ b/src/transform.cc
@@ -227,6 +227,27 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti
if (v.type == Value::VECTOR) {
for (int i = 0; i < 4; i++)
node->m[16+i] = i < v.vec.size() ? v.vec[i]->num : 1.0;
+ } else if (v.type == Value::STRING) {
+ double alpha = 1.0;
+ QString colorname = v.text;
+ if (v.text.contains(",")) {
+ QStringList chunks = v.text.split(",");
+ colorname = chunks[0];
+ bool parseok;
+ alpha = chunks[1].toDouble(&parseok);
+ if (!parseok) alpha=1.0;
+ }
+ QColor color;
+ color.setNamedColor(colorname);
+ if (color.isValid()) {
+ node->m[16+0] = color.redF();
+ node->m[16+1] = color.greenF();
+ node->m[16+2] = color.blueF();
+ node->m[16+3] = alpha;
+ } else {
+ PRINTF_NOCACHE("WARNING: Color name \"%s\" unknown. Please see",v.text.toUtf8().data());
+ PRINTF_NOCACHE("WARNING: http://en.wikipedia.org/wiki/Web_colors");
+ }
}
}
contact: Jan Huwald // Impressum