summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
index ef3c119..d0fa9f9 100644
--- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
+++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
@@ -6,6 +6,7 @@
#include <Swiften/Parser/PayloadParsers/WhiteboardParser.h>
#include <Swiften/Whiteboard/Elements/WhiteboardLineElement.h>
+#include <Swiften/Whiteboard/Elements/Color.h>
#include <boost/optional.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -23,6 +24,19 @@ namespace Swift {
int x2 = std::atoi(attributes.getAttributeValue("x2").get_value_or("0").c_str());
int y2 = std::atoi(attributes.getAttributeValue("y2").get_value_or("0").c_str());
WhiteboardLineElement::ref whiteboardElement = boost::make_shared<WhiteboardLineElement>(x1, y1, x2, y2);
+ Color color(attributes.getAttributeValue("stroke").get_value_or("#00000"));
+
+ std::string opacity = attributes.getAttributeValue("opacity").get_value_or("1");
+ if (opacity.find('.') != std::string::npos) {
+ opacity = opacity.substr(opacity.find('.')+1, 2);
+ color.setAlpha(std::atoi(opacity.c_str())*255/100);
+ }
+
+ whiteboardElement->setColor(color);
+
+ int penWidth = std::atoi(attributes.getAttributeValue("stroke-width").get_value_or("1").c_str());
+ whiteboardElement->setPenWidth(penWidth);
+
getPayloadInternal()->setElement(whiteboardElement);
}
}