[DEV] update new exml interface (removing visibility of shared_ptr

This commit is contained in:
Edouard DUPIN 2016-04-17 22:42:13 +02:00
parent 67a6da6099
commit f9c000e603
98 changed files with 289 additions and 461 deletions

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -13,9 +13,6 @@
const float esvg::kappa90(0.5522847493f); const float esvg::kappa90(0.5522847493f);
#undef __class__
#define __class__ "PaintState"
esvg::PaintState::PaintState() : esvg::PaintState::PaintState() :
fill(std::pair<etk::Color<float,4>, std::string>(etk::color::black, "")), fill(std::pair<etk::Color<float,4>, std::string>(etk::color::black, "")),
stroke(std::pair<etk::Color<float,4>, std::string>(etk::color::none, "")), stroke(std::pair<etk::Color<float,4>, std::string>(etk::color::none, "")),
@ -43,10 +40,6 @@ void esvg::PaintState::clear() {
} }
#undef __class__
#define __class__ "Base"
esvg::Base::Base(PaintState _parentPaintState) { esvg::Base::Base(PaintState _parentPaintState) {
// copy the parent painting properties ... // copy the parent painting properties ...
m_paint = _parentPaintState; m_paint = _parentPaintState;
@ -86,11 +79,11 @@ std::string extractTransformData(const std::string& _value, const std::string& _
return std::string(_value.begin()+posStart, _value.begin()+posEnd); return std::string(_value.begin()+posStart, _value.begin()+posEnd);
} }
void esvg::Base::parseTransform(const std::shared_ptr<exml::Element>& _element) { void esvg::Base::parseTransform(const exml::Element& _element) {
if (_element == nullptr) { if (_element.exist() == false) {
return; return;
} }
std::string inputString = _element->getAttribute("transform"); std::string inputString = _element.attributes["transform"];
if (inputString.size() == 0) { if (inputString.size() == 0) {
return; return;
} }
@ -179,26 +172,26 @@ void esvg::Base::parseTransform(const std::shared_ptr<exml::Element>& _element)
} }
} }
void esvg::Base::parsePosition(const std::shared_ptr<const exml::Element>& _element, vec2 &_pos, vec2 &_size) { void esvg::Base::parsePosition(const exml::Element& _element, vec2 &_pos, vec2 &_size) {
_pos.setValue(0,0); _pos.setValue(0,0);
_size.setValue(0,0); _size.setValue(0,0);
if (_element == nullptr) { if (_element.exist() == false) {
return; return;
} }
std::string content = _element->getAttribute("x"); std::string content = _element.attributes["x"];
if (content.size()!=0) { if (content.size()!=0) {
_pos.setX(parseLength(content)); _pos.setX(parseLength(content));
} }
content = _element->getAttribute("y"); content = _element.attributes["y"];
if (content.size()!=0) { if (content.size()!=0) {
_pos.setY(parseLength(content)); _pos.setY(parseLength(content));
} }
content = _element->getAttribute("width"); content = _element.attributes["width"];
if (content.size()!=0) { if (content.size()!=0) {
_size.setX(parseLength(content)); _size.setX(parseLength(content));
} }
content = _element->getAttribute("height"); content = _element.attributes["height"];
if (content.size()!=0) { if (content.size()!=0) {
_size.setY(parseLength(content)); _size.setY(parseLength(content));
} }
@ -281,8 +274,8 @@ float esvg::Base::parseLength(const std::string& _dataInput) {
return 0.0f; return 0.0f;
} }
void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _element) { void esvg::Base::parsePaintAttr(const exml::Element& _element) {
if (_element == nullptr) { if (_element.exist() == false) {
return; return;
} }
/* /*
@ -291,27 +284,27 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
*/ */
std::string content; std::string content;
// ---------------- get unique ID ---------------- // ---------------- get unique ID ----------------
m_id = _element->getAttribute("id"); m_id = _element.attributes["id"];
// ---------------- stroke ---------------- // ---------------- stroke ----------------
content = _element->getAttribute("stroke"); content = _element.attributes["stroke"];
if (content == "none") { if (content == "none") {
m_paint.stroke = std::pair<etk::Color<float,4>, std::string>(etk::color::none, ""); m_paint.stroke = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
} else { } else {
if (content.size()!=0) { if (content.size()!=0) {
m_paint.stroke = parseColor(content); m_paint.stroke = parseColor(content);
} }
content = _element->getAttribute("stroke-width"); content = _element.attributes["stroke-width"];
if (content.size()!=0) { if (content.size()!=0) {
m_paint.strokeWidth = parseLength(content); m_paint.strokeWidth = parseLength(content);
} }
content = _element->getAttribute("stroke-opacity"); content = _element.attributes["stroke-opacity"];
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.stroke.first.setA(opacity); m_paint.stroke.first.setA(opacity);
} }
content = _element->getAttribute("stroke-dasharray"); content = _element.attributes["stroke-dasharray"];
if (content.size()!=0) { if (content.size()!=0) {
if (content == "none" ) { if (content == "none" ) {
// OK, Nothing to do ... // OK, Nothing to do ...
@ -319,7 +312,7 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
ESVG_TODO(" 'stroke-dasharray' not implemented ..."); ESVG_TODO(" 'stroke-dasharray' not implemented ...");
} }
} }
content = _element->getAttribute("stroke-linecap"); content = _element.attributes["stroke-linecap"];
if (content.size()!=0) { if (content.size()!=0) {
if (content == "butt" ) { if (content == "butt" ) {
m_paint.lineCap = esvg::cap_butt; m_paint.lineCap = esvg::cap_butt;
@ -332,7 +325,7 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
ESVG_ERROR("not know stroke-linecap value : \"" << content << "\", not in [butt,round,square]"); ESVG_ERROR("not know stroke-linecap value : \"" << content << "\", not in [butt,round,square]");
} }
} }
content = _element->getAttribute("stroke-linejoin"); content = _element.attributes["stroke-linejoin"];
if (content.size()!=0) { if (content.size()!=0) {
if (content == "miter" ) { if (content == "miter" ) {
m_paint.lineJoin = esvg::join_miter; m_paint.lineJoin = esvg::join_miter;
@ -345,27 +338,27 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
ESVG_ERROR("not know stroke-linejoin value : \"" << content << "\", not in [miter,round,bevel]"); ESVG_ERROR("not know stroke-linejoin value : \"" << content << "\", not in [miter,round,bevel]");
} }
} }
content = _element->getAttribute("stroke-miterlimit"); content = _element.attributes["stroke-miterlimit"];
if (content.size()!=0) { if (content.size()!=0) {
float tmp = parseLength(content); float tmp = parseLength(content);
m_paint.miterLimit = std::max(0.0f, tmp); m_paint.miterLimit = std::max(0.0f, tmp);
} }
} }
// ---------------- FILL ---------------- // ---------------- FILL ----------------
content = _element->getAttribute("fill"); content = _element.attributes["fill"];
if (content == "none") { if (content == "none") {
m_paint.fill = std::pair<etk::Color<float,4>, std::string>(etk::color::none, ""); m_paint.fill = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
} else { } else {
if (content.size()!=0) { if (content.size()!=0) {
m_paint.fill = parseColor(content); m_paint.fill = parseColor(content);
} }
content = _element->getAttribute("fill-opacity"); content = _element.attributes["fill-opacity"];
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f); opacity = std::avg(0.0f, opacity, 1.0f);
m_paint.fill.first.setA(opacity); m_paint.fill.first.setA(opacity);
} }
content = _element->getAttribute("fill-rule"); content = _element.attributes["fill-rule"];
if (content.size()!=0) { if (content.size()!=0) {
if (content == "nonzero") { if (content == "nonzero") {
m_paint.flagEvenOdd = false; m_paint.flagEvenOdd = false;
@ -376,7 +369,7 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
} }
} }
// ---------------- opacity ---------------- // ---------------- opacity ----------------
content = _element->getAttribute("opacity"); content = _element.attributes["opacity"];
if (content.size()!=0) { if (content.size()!=0) {
m_paint.opacity = parseLength(content); m_paint.opacity = parseLength(content);
m_paint.opacity = std::avg(0.0f, m_paint.opacity, 1.0f); m_paint.opacity = std::avg(0.0f, m_paint.opacity, 1.0f);
@ -405,10 +398,10 @@ std::pair<etk::Color<float,4>, std::string> esvg::Base::parseColor(const std::st
return localColor; return localColor;
} }
bool esvg::Base::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Base::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
// TODO : UNDERSTAND why nothing is done here ... // TODO : UNDERSTAND why nothing is done here ...
// Parse basic elements (ID...): // Parse basic elements (ID...):
m_id = _element->getAttribute("id"); m_id = _element.attributes["id"];
_sizeMax = vec2(0.0f, 0.0f); _sizeMax = vec2(0.0f, 0.0f);
return false; return false;
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -64,19 +64,19 @@ namespace esvg {
* @param[in] _element standart XML node * @param[in] _element standart XML node
* @return true if no problem arrived * @return true if no problem arrived
*/ */
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level=1); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level=1);
virtual void display(int32_t _spacing) { }; virtual void display(int32_t _spacing) { };
void parseTransform(const std::shared_ptr<exml::Element>& _element); void parseTransform(const exml::Element& _element);
/** /**
* @brief parse x, y, width, height attribute of the xml node * @brief parse x, y, width, height attribute of the xml node
* @param[in] _element XML node * @param[in] _element XML node
* @param[out] _pos parsed position * @param[out] _pos parsed position
* @param[out] _size parsed dimention * @param[out] _size parsed dimention
*/ */
void parsePosition(const std::shared_ptr<const exml::Element>& _element, vec2 &_pos, vec2 &_size); void parsePosition(const exml::Element& _element, vec2 &_pos, vec2 &_size);
/** /**
* @brief parse a lenght of the xml element * @brief parse a lenght of the xml element
* @param[in] _dataInput Data C String with the printed lenght * @param[in] _dataInput Data C String with the printed lenght
@ -88,7 +88,7 @@ namespace esvg {
* @brief parse a Painting attribute of a specific node * @brief parse a Painting attribute of a specific node
* @param[in] _element Basic node of the XML that might be parsed * @param[in] _element Basic node of the XML that might be parsed
*/ */
void parsePaintAttr(const std::shared_ptr<const exml::Element>& _element); void parsePaintAttr(const exml::Element& _element);
/** /**
* @brief parse a color specification from the svg file * @brief parse a color specification from the svg file
* @param[in] _inputData Data C String with the xml definition * @param[in] _inputData Data C String with the xml definition

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Circle"
esvg::Circle::Circle(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Circle::Circle(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -22,10 +19,10 @@ esvg::Circle::~Circle() {
} }
bool esvg::Circle::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Circle::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
m_radius = 0.0; m_radius = 0.0;
m_position.setValue(0,0); m_position.setValue(0,0);
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -34,24 +31,24 @@ bool esvg::Circle::parseXML(const std::shared_ptr<exml::Element>& _element, mat2
// add the property of the parrent modifications ... // add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string content = _element->getAttribute("cx"); std::string content = _element.attributes["cx"];
if (content.size()!=0) { if (content.size()!=0) {
m_position.setX(parseLength(content)); m_position.setX(parseLength(content));
} }
content = _element->getAttribute("cy"); content = _element.attributes["cy"];
if (content.size()!=0) { if (content.size()!=0) {
m_position.setY(parseLength(content)); m_position.setY(parseLength(content));
} }
content = _element->getAttribute("r"); content = _element.attributes["r"];
if (content.size()!=0) { if (content.size()!=0) {
m_radius = parseLength(content); m_radius = parseLength(content);
} else { } else {
ESVG_ERROR("(l "<<_element->getPos()<<") Circle \"r\" is not present"); ESVG_ERROR("(l "<<_element.getPos()<<") Circle \"r\" is not present");
return false; return false;
} }
if (0 > m_radius) { if (0 > m_radius) {
m_radius = 0; m_radius = 0;
ESVG_ERROR("(l "<<_element->getPos()<<") Circle \"r\" is negative"); ESVG_ERROR("(l "<<_element.getPos()<<") Circle \"r\" is negative");
return false; return false;
} }
_sizeMax.setValue(m_position.x() + m_radius, m_position.y() + m_radius); _sizeMax.setValue(m_position.x() + m_radius, m_position.y() + m_radius);

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Circle(PaintState _parentPaintState); Circle(PaintState _parentPaintState);
~Circle(); ~Circle();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/Dimension.h> #include <esvg/Dimension.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "Dimension"
static const float inchToMillimeter = 1.0f/25.4f; static const float inchToMillimeter = 1.0f/25.4f;
static const float footToMillimeter = 1.0f/304.8f; static const float footToMillimeter = 1.0f/304.8f;
static const float meterToMillimeter = 1.0f/1000.0f; static const float meterToMillimeter = 1.0f/1000.0f;
@ -282,10 +279,6 @@ namespace etk {
} }
}; };
#undef __class__
#define __class__ "Dimension1D"
esvg::Dimension1D::Dimension1D() : esvg::Dimension1D::Dimension1D() :
m_data(0.0f), m_data(0.0f),
m_type(esvg::distance_pixel) { m_type(esvg::distance_pixel) {

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Ellipse"
esvg::Ellipse::Ellipse(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Ellipse::Ellipse(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -22,8 +19,8 @@ esvg::Ellipse::~Ellipse() {
} }
bool esvg::Ellipse::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Ellipse::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -35,26 +32,26 @@ bool esvg::Ellipse::parseXML(const std::shared_ptr<exml::Element>& _element, mat
m_c.setValue(0,0); m_c.setValue(0,0);
m_r.setValue(0,0); m_r.setValue(0,0);
std::string content = _element->getAttribute("cx"); std::string content = _element.attributes["cx"];
if (content.size()!=0) { if (content.size()!=0) {
m_c.setX(parseLength(content)); m_c.setX(parseLength(content));
} }
content = _element->getAttribute("cy"); content = _element.attributes["cy"];
if (content.size()!=0) { if (content.size()!=0) {
m_c.setY(parseLength(content)); m_c.setY(parseLength(content));
} }
content = _element->getAttribute("rx"); content = _element.attributes["rx"];
if (content.size()!=0) { if (content.size()!=0) {
m_r.setX(parseLength(content)); m_r.setX(parseLength(content));
} else { } else {
ESVG_ERROR("(l "<<_element->getPos()<<") Ellipse \"rx\" is not present"); ESVG_ERROR("(l "<<_element.getPos()<<") Ellipse \"rx\" is not present");
return false; return false;
} }
content = _element->getAttribute("ry"); content = _element.attributes["ry"];
if (content.size()!=0) { if (content.size()!=0) {
m_r.setY(parseLength(content)); m_r.setY(parseLength(content));
} else { } else {
ESVG_ERROR("(l "<<_element->getPos()<<") Ellipse \"ry\" is not present"); ESVG_ERROR("(l "<<_element.getPos()<<") Ellipse \"ry\" is not present");
return false; return false;
} }
_sizeMax.setValue(m_c.x() + m_r.x(), m_c.y() + m_r.y()); _sizeMax.setValue(m_c.x() + m_r.x(), m_c.y() + m_r.y());

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Ellipse(PaintState _parentPaintState); Ellipse(PaintState _parentPaintState);
~Ellipse(); ~Ellipse();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -20,9 +20,6 @@
#include <esvg/Text.h> #include <esvg/Text.h>
#include <esvg/Group.h> #include <esvg/Group.h>
#undef __class__
#define __class__ "Group"
esvg::Group::Group(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Group::Group(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -31,8 +28,8 @@ esvg::Group::~Group() {
} }
bool esvg::Group::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Group::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
// parse ... // parse ...
@ -51,42 +48,42 @@ bool esvg::Group::parseXML(const std::shared_ptr<exml::Element>& _element, mat2&
_sizeMax.setValue(0,0); _sizeMax.setValue(0,0);
vec2 tmpPos(0,0); vec2 tmpPos(0,0);
// parse all sub node : // parse all sub node :
for(int32_t iii=0; iii<_element->size() ; iii++) { for(const auto it : _element.nodes) {
std::shared_ptr<exml::Element> child = _element->getElement(iii); exml::Element child = _element.toElement();
if (child == nullptr) { if (child.exist() == false) {
// can be a comment ... // can be a comment ...
continue; continue;
} }
std::shared_ptr<esvg::Base> elementParser; std::shared_ptr<esvg::Base> elementParser;
if (child->getValue() == "g") { if (child.getValue() == "g") {
elementParser = std::make_shared<esvg::Group>(m_paint); elementParser = std::make_shared<esvg::Group>(m_paint);
} else if (child->getValue() == "a") { } else if (child.getValue() == "a") {
// TODO ... // TODO ...
} else if (child->getValue() == "path") { } else if (child.getValue() == "path") {
elementParser = std::make_shared<esvg::Path>(m_paint); elementParser = std::make_shared<esvg::Path>(m_paint);
} else if (child->getValue() == "rect") { } else if (child.getValue() == "rect") {
elementParser = std::make_shared<esvg::Rectangle>(m_paint); elementParser = std::make_shared<esvg::Rectangle>(m_paint);
} else if (child->getValue() == "circle") { } else if (child.getValue() == "circle") {
elementParser = std::make_shared<esvg::Circle>(m_paint); elementParser = std::make_shared<esvg::Circle>(m_paint);
} else if (child->getValue() == "ellipse") { } else if (child.getValue() == "ellipse") {
elementParser = std::make_shared<esvg::Ellipse>(m_paint); elementParser = std::make_shared<esvg::Ellipse>(m_paint);
} else if (child->getValue() == "line") { } else if (child.getValue() == "line") {
elementParser = std::make_shared<esvg::Line>(m_paint); elementParser = std::make_shared<esvg::Line>(m_paint);
} else if (child->getValue() == "polyline") { } else if (child.getValue() == "polyline") {
elementParser = std::make_shared<esvg::Polyline>(m_paint); elementParser = std::make_shared<esvg::Polyline>(m_paint);
} else if (child->getValue() == "polygon") { } else if (child.getValue() == "polygon") {
elementParser = std::make_shared<esvg::Polygon>(m_paint); elementParser = std::make_shared<esvg::Polygon>(m_paint);
} else if (child->getValue() == "text") { } else if (child.getValue() == "text") {
elementParser = std::make_shared<esvg::Text>(m_paint); elementParser = std::make_shared<esvg::Text>(m_paint);
} else { } else {
ESVG_ERROR("(l "<<child->getPos()<<") node not suported : \""<<child->getValue()<<"\" must be [g,a,path,rect,circle,ellipse,line,polyline,polygon,text]"); ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [g,a,path,rect,circle,ellipse,line,polyline,polygon,text]");
} }
if (elementParser == nullptr) { if (elementParser == nullptr) {
ESVG_ERROR("(l "<<child->getPos()<<") error on node: \""<<child->getValue()<<"\" allocation error or not supported ..."); ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' allocation error or not supported ...");
continue; continue;
} }
if (elementParser->parseXML(child, m_transformMatrix, tmpPos) == false) { if (elementParser->parseXML(child, m_transformMatrix, tmpPos) == false) {
ESVG_ERROR("(l "<<child->getPos()<<") error on node: \""<<child->getValue()<<"\" Sub Parsing ERROR"); ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' Sub Parsing ERROR");
elementParser.reset(); elementParser.reset();
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Group(PaintState _parentPaintState); Group(PaintState _parentPaintState);
~Group(); ~Group();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t spacing); virtual void display(int32_t spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Line"
esvg::Line::Line(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Line::Line(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
m_startPos.setValue(0,0); m_startPos.setValue(0,0);
m_stopPos.setValue(0,0); m_stopPos.setValue(0,0);
@ -23,10 +20,10 @@ esvg::Line::~Line() {
} }
bool esvg::Line::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Line::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
// line must have a minimum size... // line must have a minimum size...
m_paint.strokeWidth = 1; m_paint.strokeWidth = 1;
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -35,19 +32,19 @@ bool esvg::Line::parseXML(const std::shared_ptr<exml::Element>& _element, mat2&
// add the property of the parrent modifications ... // add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string content = _element->getAttribute("x1"); std::string content = _element.attributes["x1"];
if (content.size() != 0) { if (content.size() != 0) {
m_startPos.setX(parseLength(content)); m_startPos.setX(parseLength(content));
} }
content = _element->getAttribute("y1"); content = _element.attributes["y1"];
if (content.size() != 0) { if (content.size() != 0) {
m_startPos.setY(parseLength(content)); m_startPos.setY(parseLength(content));
} }
content = _element->getAttribute("x2"); content = _element.attributes["x2"];
if (content.size() != 0) { if (content.size() != 0) {
m_stopPos.setX(parseLength(content)); m_stopPos.setX(parseLength(content));
} }
content = _element->getAttribute("y2"); content = _element.attributes["y2"];
if (content.size() != 0) { if (content.size() != 0) {
m_stopPos.setY(parseLength(content)); m_stopPos.setY(parseLength(content));
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Line(PaintState _parentPaintState); Line(PaintState _parentPaintState);
~Line(); ~Line();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -13,9 +13,6 @@
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#include <esvg/esvg.h> #include <esvg/esvg.h>
#undef __class__
#define __class__ "LinearGradient"
esvg::LinearGradient::LinearGradient(PaintState _parentPaintState) : esvg::LinearGradient::LinearGradient(PaintState _parentPaintState) :
esvg::Base(_parentPaintState), esvg::Base(_parentPaintState),
m_pos1(vec2(50,50), esvg::distance_pourcent), m_pos1(vec2(50,50), esvg::distance_pourcent),
@ -30,15 +27,15 @@ esvg::LinearGradient::~LinearGradient() {
} }
bool esvg::LinearGradient::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
// line must have a minimum size... // line must have a minimum size...
//m_paint.strokeWidth = 1; //m_paint.strokeWidth = 1;
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
// ---------------- get unique ID ---------------- // ---------------- get unique ID ----------------
m_id = _element->getAttribute("id"); m_id = _element.attributes["id"];
//parseTransform(_element); //parseTransform(_element);
//parsePaintAttr(_element); //parsePaintAttr(_element);
@ -46,19 +43,19 @@ bool esvg::LinearGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
// add the property of the parrent modifications ... // add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string contentX = _element->getAttribute("x1"); std::string contentX = _element.attributes["x1"];
std::string contentY = _element->getAttribute("y1"); std::string contentY = _element.attributes["y1"];
if ( contentX != "" if ( contentX != ""
&& contentY != "") { && contentY != "") {
m_pos1.set(contentX, contentY); m_pos1.set(contentX, contentY);
} }
contentX = _element->getAttribute("x2"); contentX = _element.attributes["x2"];
contentY = _element->getAttribute("y2"); contentY = _element.attributes["y2"];
if ( contentX != "" if ( contentX != ""
&& contentY != "") { && contentY != "") {
m_pos2.set(contentX, contentY); m_pos2.set(contentX, contentY);
} }
contentX = _element->getAttribute("gradientUnits"); contentX = _element.attributes["gradientUnits"];
if (contentX == "userSpaceOnUse") { if (contentX == "userSpaceOnUse") {
m_unit = gradientUnits_userSpaceOnUse; m_unit = gradientUnits_userSpaceOnUse;
} else { } else {
@ -68,7 +65,7 @@ bool esvg::LinearGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
ESVG_ERROR("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox"); ESVG_ERROR("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox");
} }
} }
contentX = _element->getAttribute("spreadMethod"); contentX = _element.attributes["spreadMethod"];
if (contentX == "reflect") { if (contentX == "reflect") {
m_spread = spreadMethod_reflect; m_spread = spreadMethod_reflect;
} else if (contentX == "repeat") { } else if (contentX == "repeat") {
@ -81,21 +78,21 @@ bool esvg::LinearGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
} }
} }
// note: xlink:href is incompatible with subNode "stop" // note: xlink:href is incompatible with subNode "stop"
m_href = _element->getAttribute("xlink:href"); m_href = _element.attributes["xlink:href"];
if (m_href.size() != 0) { if (m_href.size() != 0) {
m_href = std::string(m_href.begin()+1, m_href.end()); m_href = std::string(m_href.begin()+1, m_href.end());
} }
// parse all sub node : // parse all sub node :
for(int32_t iii=0; iii<_element->size() ; iii++) { for(const auto it : _element.nodes) {
std::shared_ptr<exml::Element> child = _element->getElement(iii); exml::Element child = it.toElement();
if (child == nullptr) { if (child.exist() == false) {
// can be a comment ... // can be a comment ...
continue; continue;
} }
if (child->getValue() == "stop") { if (child.getValue() == "stop") {
float offset = 100; float offset = 100;
etk::Color<float,4> stopColor = etk::color::none; etk::Color<float,4> stopColor = etk::color::none;
std::string content = child->getAttribute("offset"); std::string content = child.attributes["offset"];
if (content.size()!=0) { if (content.size()!=0) {
std::pair<float, enum esvg::distance> tmp = parseLength2(content); std::pair<float, enum esvg::distance> tmp = parseLength2(content);
if (tmp.second == esvg::distance_pixel) { if (tmp.second == esvg::distance_pixel) {
@ -107,26 +104,26 @@ bool esvg::LinearGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
offset = tmp.first; offset = tmp.first;
} }
} }
content = child->getAttribute("stop-color"); content = child.attributes["stop-color"];
if (content.size()!=0) { if (content.size()!=0) {
stopColor = parseColor(content).first; stopColor = parseColor(content).first;
ESVG_VERBOSE(" color : \"" << content << "\" == > " << stopColor); ESVG_VERBOSE(" color : '" << content << "' == > " << stopColor);
} }
content = child->getAttribute("stop-opacity"); content = child.attributes["stop-opacity"];
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f); opacity = std::avg(0.0f, opacity, 1.0f);
stopColor.setA(opacity); stopColor.setA(opacity);
ESVG_VERBOSE(" opacity : \"" << content << "\" == > " << stopColor); ESVG_VERBOSE(" opacity : '" << content << "' == > " << stopColor);
} }
m_data.push_back(std::pair<float, etk::Color<float,4>>(offset, stopColor)); m_data.push_back(std::pair<float, etk::Color<float,4>>(offset, stopColor));
} else { } else {
ESVG_ERROR("(l " << child->getPos() << ") node not suported : \"" << child->getValue() << "\" must be [stop]"); ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [stop]");
} }
} }
if (m_data.size() != 0) { if (m_data.size() != 0) {
if (m_href != "") { if (m_href != "") {
ESVG_ERROR("(l " << _element->getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href"); ESVG_ERROR("(l " << _element.getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href");
m_href = ""; m_href = "";
} }
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -26,7 +26,7 @@ namespace esvg {
public: public:
LinearGradient(PaintState _parentPaintState); LinearGradient(PaintState _parentPaintState);
~LinearGradient(); ~LinearGradient();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
public: public:

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/PointList.h> #include <esvg/render/PointList.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Path"
esvg::Path::Path(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Path::Path(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -81,8 +78,8 @@ std::string cleanBadSpaces(const std::string& _input) {
return out; return out;
} }
bool esvg::Path::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Path::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -92,9 +89,9 @@ bool esvg::Path::parseXML(const std::shared_ptr<exml::Element>& _element, mat2&
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string elementXML1 = _element->getAttribute("d"); std::string elementXML1 = _element.attributes["d"];
if (elementXML1.size() == 0) { if (elementXML1.size() == 0) {
ESVG_WARNING("(l "<<_element->getPos()<<") path: missing 'd' attribute or empty"); ESVG_WARNING("(l "<<_element.getPos()<<") path: missing 'd' attribute or empty");
return false; return false;
} }
ESVG_VERBOSE("Parse Path : \"" << elementXML1 << "\""); ESVG_VERBOSE("Parse Path : \"" << elementXML1 << "\"");

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Path(PaintState _parentPaintState); Path(PaintState _parentPaintState);
~Path(); ~Path();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Polygon"
esvg::Polygon::Polygon(PaintState parentPaintState) : esvg::Base(parentPaintState) { esvg::Polygon::Polygon(PaintState parentPaintState) : esvg::Base(parentPaintState) {
} }
@ -22,8 +19,8 @@ esvg::Polygon::~Polygon() {
} }
bool esvg::Polygon::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Polygon::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -36,7 +33,7 @@ bool esvg::Polygon::parseXML(const std::shared_ptr<exml::Element>& _element, mat
ESVG_VERBOSE("parsed P2. trans: " << m_transformMatrix); ESVG_VERBOSE("parsed P2. trans: " << m_transformMatrix);
const std::string sss1 = _element->getAttribute("points"); const std::string sss1 = _element.attributes["points"];
if (sss1.size() == 0) { if (sss1.size() == 0) {
ESVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute"); ESVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute");
return false; return false;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -24,7 +24,7 @@ namespace esvg {
public: public:
Polygon(PaintState parentPaintState); Polygon(PaintState parentPaintState);
~Polygon(); ~Polygon();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Polyline"
esvg::Polyline::Polyline(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Polyline::Polyline(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -22,10 +19,10 @@ esvg::Polyline::~Polyline() {
} }
bool esvg::Polyline::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Polyline::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
// line must have a minimum size... // line must have a minimum size...
m_paint.strokeWidth = 1; m_paint.strokeWidth = 1;
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
parseTransform(_element); parseTransform(_element);
@ -34,9 +31,9 @@ bool esvg::Polyline::parseXML(const std::shared_ptr<exml::Element>& _element, ma
// add the property of the parrent modifications ... // add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string sss1 = _element->getAttribute("points"); std::string sss1 = _element.attributes["points"];
if (sss1.size() == 0) { if (sss1.size() == 0) {
ESVG_ERROR("(l "<<_element->getPos()<<") polyline: missing points attribute"); ESVG_ERROR("(l "<<_element.getPos()<<") polyline: missing points attribute");
return false; return false;
} }
_sizeMax.setValue(0,0); _sizeMax.setValue(0,0);

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -17,7 +17,7 @@ namespace esvg {
public: public:
Polyline(PaintState _parentPaintState); Polyline(PaintState _parentPaintState);
~Polyline(); ~Polyline();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -13,9 +13,6 @@
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#include <esvg/esvg.h> #include <esvg/esvg.h>
#undef __class__
#define __class__ "RadialGradient"
esvg::RadialGradient::RadialGradient(PaintState _parentPaintState) : esvg::RadialGradient::RadialGradient(PaintState _parentPaintState) :
esvg::Base(_parentPaintState), esvg::Base(_parentPaintState),
m_center(vec2(50,50), esvg::distance_pourcent), m_center(vec2(50,50), esvg::distance_pourcent),
@ -31,15 +28,15 @@ esvg::RadialGradient::~RadialGradient() {
} }
bool esvg::RadialGradient::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
// line must have a minimum size... // line must have a minimum size...
//m_paint.strokeWidth = 1; //m_paint.strokeWidth = 1;
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
// ---------------- get unique ID ---------------- // ---------------- get unique ID ----------------
m_id = _element->getAttribute("id"); m_id = _element.attributes["id"];
//parseTransform(_element); //parseTransform(_element);
//parsePaintAttr(_element); //parsePaintAttr(_element);
@ -47,23 +44,23 @@ bool esvg::RadialGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
// add the property of the parrent modifications ... // add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans; m_transformMatrix *= _parentTrans;
std::string contentX = _element->getAttribute("cx"); std::string contentX = _element.attributes["cx"];
std::string contentY = _element->getAttribute("cy"); std::string contentY = _element.attributes["cy"];
if ( contentX != "" if ( contentX != ""
&& contentY != "") { && contentY != "") {
m_center.set(contentX, contentY); m_center.set(contentX, contentY);
} }
contentX = _element->getAttribute("r"); contentX = _element.attributes["r"];
if (contentX != "") { if (contentX != "") {
m_radius.set(contentX); m_radius.set(contentX);
} }
contentX = _element->getAttribute("fx"); contentX = _element.attributes["fx"];
contentY = _element->getAttribute("fy"); contentY = _element.attributes["fy"];
if ( contentX != "" if ( contentX != ""
&& contentY != "") { && contentY != "") {
m_focal.set(contentX, contentY); m_focal.set(contentX, contentY);
} }
contentX = _element->getAttribute("gradientUnits"); contentX = _element.attributes["gradientUnits"];
if (contentX == "userSpaceOnUse") { if (contentX == "userSpaceOnUse") {
m_unit = gradientUnits_userSpaceOnUse; m_unit = gradientUnits_userSpaceOnUse;
} else { } else {
@ -73,7 +70,7 @@ bool esvg::RadialGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
ESVG_ERROR("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox"); ESVG_ERROR("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox");
} }
} }
contentX = _element->getAttribute("spreadMethod"); contentX = _element.attributes["spreadMethod"];
if (contentX == "reflect") { if (contentX == "reflect") {
m_spread = spreadMethod_reflect; m_spread = spreadMethod_reflect;
} else if (contentX == "repeat") { } else if (contentX == "repeat") {
@ -86,21 +83,21 @@ bool esvg::RadialGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
} }
} }
// note: xlink:href is incompatible with subNode "stop" // note: xlink:href is incompatible with subNode "stop"
m_href = _element->getAttribute("xlink:href"); m_href = _element.attributes["xlink:href"];
if (m_href.size() != 0) { if (m_href.size() != 0) {
m_href = std::string(m_href.begin()+1, m_href.end()); m_href = std::string(m_href.begin()+1, m_href.end());
} }
// parse all sub node : // parse all sub node :
for(int32_t iii=0; iii<_element->size() ; iii++) { for(auto it : _element.nodes) {
std::shared_ptr<exml::Element> child = _element->getElement(iii); exml::Element child = it.toElement();
if (child == nullptr) { if (child.exist() == false) {
// can be a comment ... // can be a comment ...
continue; continue;
} }
if (child->getValue() == "stop") { if (child.getValue() == "stop") {
float offset = 100; float offset = 100;
etk::Color<float,4> stopColor = etk::color::none; etk::Color<float,4> stopColor = etk::color::none;
std::string content = child->getAttribute("offset"); std::string content = child.attributes["offset"];
if (content.size()!=0) { if (content.size()!=0) {
std::pair<float, enum esvg::distance> tmp = parseLength2(content); std::pair<float, enum esvg::distance> tmp = parseLength2(content);
if (tmp.second == esvg::distance_pixel) { if (tmp.second == esvg::distance_pixel) {
@ -112,26 +109,26 @@ bool esvg::RadialGradient::parseXML(const std::shared_ptr<exml::Element>& _eleme
offset = tmp.first; offset = tmp.first;
} }
} }
content = child->getAttribute("stop-color"); content = child.attributes["stop-color"];
if (content.size()!=0) { if (content.size()!=0) {
stopColor = parseColor(content).first; stopColor = parseColor(content).first;
ESVG_VERBOSE(" color : \"" << content << "\" == > " << stopColor); ESVG_VERBOSE(" color : \"" << content << "\" == > " << stopColor);
} }
content = child->getAttribute("stop-opacity"); content = child.attributes["stop-opacity"];
if (content.size()!=0) { if (content.size()!=0) {
float opacity = parseLength(content); float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f); opacity = std::avg(0.0f, opacity, 1.0f);
stopColor.setA(opacity); stopColor.setA(opacity);
ESVG_VERBOSE(" opacity : \"" << content << "\" == > " << stopColor); ESVG_VERBOSE(" opacity : '" << content << "' == > " << stopColor);
} }
m_data.push_back(std::pair<float, etk::Color<float,4>>(offset, stopColor)); m_data.push_back(std::pair<float, etk::Color<float,4>>(offset, stopColor));
} else { } else {
ESVG_ERROR("(l " << child->getPos() << ") node not suported : \"" << child->getValue() << "\" must be [stop]"); ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [stop]");
} }
} }
if (m_data.size() != 0) { if (m_data.size() != 0) {
if (m_href != "") { if (m_href != "") {
ESVG_ERROR("(l " << _element->getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href"); ESVG_ERROR("(l " << _element.getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href");
m_href = ""; m_href = "";
} }
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -27,7 +27,7 @@ namespace esvg {
public: public:
RadialGradient(PaintState _parentPaintState); RadialGradient(PaintState _parentPaintState);
~RadialGradient(); ~RadialGradient();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
public: public:

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -11,10 +11,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#undef __class__
#define __class__ "Rectangle"
esvg::Rectangle::Rectangle(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Rectangle::Rectangle(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
m_position.setValue(0,0); m_position.setValue(0,0);
m_size.setValue(0,0); m_size.setValue(0,0);
@ -25,8 +21,8 @@ esvg::Rectangle::~Rectangle() {
} }
bool esvg::Rectangle::parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Rectangle::parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
if (_element == nullptr) { if (_element.exist() == false) {
return false; return false;
} }
m_position.setValue(0.0f, 0.0f); m_position.setValue(0.0f, 0.0f);
@ -41,11 +37,11 @@ bool esvg::Rectangle::parseXML(const std::shared_ptr<exml::Element>& _element, m
parsePosition(_element, m_position, m_size); parsePosition(_element, m_position, m_size);
std::string content = _element->getAttribute("rx"); std::string content = _element.attributes["rx"];
if (content.size()!=0) { if (content.size()!=0) {
m_roundedCorner.setX(parseLength(content)); m_roundedCorner.setX(parseLength(content));
} }
content = _element->getAttribute("ry"); content = _element.attributes["ry"];
if (content.size()!=0) { if (content.size()!=0) {
m_roundedCorner.setY(parseLength(content)); m_roundedCorner.setY(parseLength(content));
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -18,7 +18,7 @@ namespace esvg {
public: public:
Rectangle(PaintState _parentPaintState); Rectangle(PaintState _parentPaintState);
~Rectangle(); ~Rectangle();
virtual bool parseXML(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parseXML(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level); virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level);
}; };

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/Renderer.h> #include <esvg/Renderer.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#undef __class__
#define __class__ "Renderer"
esvg::Renderer::Renderer(const ivec2& _size, esvg::Document* _document, bool _visualDebug) : esvg::Renderer::Renderer(const ivec2& _size, esvg::Document* _document, bool _visualDebug) :
#ifdef DEBUG #ifdef DEBUG
m_visualDebug(_visualDebug), m_visualDebug(_visualDebug),

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/debug.h> #include <esvg/debug.h>
#include <esvg/Text.h> #include <esvg/Text.h>
#undef __class__
#define __class__ "Text"
esvg::Text::Text(PaintState _parentPaintState) : esvg::Base(_parentPaintState) { esvg::Text::Text(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
} }
@ -20,7 +17,7 @@ esvg::Text::~Text() {
} }
bool esvg::Text::parse(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax) { bool esvg::Text::parse(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax) {
_sizeMax.setValue(0,0); _sizeMax.setValue(0,0);
ESVG_ERROR("NOT IMPLEMENTED"); ESVG_ERROR("NOT IMPLEMENTED");
return false; return false;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -14,7 +14,7 @@ namespace esvg {
public: public:
Text(PaintState _parentPaintState); Text(PaintState _parentPaintState);
~Text(); ~Text();
virtual bool parse(const std::shared_ptr<exml::Element>& _element, mat2& _parentTrans, vec2& _sizeMax); virtual bool parse(const exml::Element& _element, mat2& _parentTrans, vec2& _sizeMax);
virtual void display(int32_t _spacing); virtual void display(int32_t _spacing);
}; };
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -21,10 +21,6 @@
#include <esvg/LinearGradient.h> #include <esvg/LinearGradient.h>
#include <esvg/RadialGradient.h> #include <esvg/RadialGradient.h>
#undef __class__
#define __class__ "Document"
esvg::Document::Document() { esvg::Document::Document() {
m_fileName = ""; m_fileName = "";
m_version = "0.0"; m_version = "0.0";
@ -162,14 +158,14 @@ bool esvg::Document::parse(const std::string& _data) {
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
if (doc.size() == 0) { if (doc.nodes.size() == 0) {
ESVG_ERROR("(l ?) No nodes in the SVG file ... \"" << m_fileName << "\""); ESVG_ERROR("(l ?) No nodes in the SVG file ... '" << m_fileName << "'");
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
std::shared_ptr<exml::Element> root = doc.getNamed("svg" ); exml::Element root = doc.nodes["svg"];
if (root == nullptr) { if (root.exist() == false) {
ESVG_ERROR("(l ?) main node not find: \"svg\" in \"" << m_fileName << "\""); ESVG_ERROR("(l ?) main node not find: 'svg' in '" << m_fileName << "'");
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
@ -191,14 +187,14 @@ bool esvg::Document::load(const std::string& _file) {
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
if (doc.size() == 0) { if (doc.nodes.size() == 0) {
ESVG_ERROR("(l ?) No nodes in the SVG file ... \"" << m_fileName << "\""); ESVG_ERROR("(l ?) No nodes in the SVG file ... '" << m_fileName << "'");
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
std::shared_ptr<exml::Element> root = doc.getNamed("svg"); exml::Element root = doc.nodes["svg"];
if (root == nullptr) { if (root.exist() == false) {
ESVG_ERROR("(l ?) main node not find: \"svg\" in \"" << m_fileName << "\""); ESVG_ERROR("(l ?) main node not find: 'svg' in '" << m_fileName << "'");
m_loadOK = false; m_loadOK = false;
return m_loadOK; return m_loadOK;
} }
@ -211,16 +207,16 @@ bool esvg::Document::store(const std::string& _file) {
return false; return false;
} }
bool esvg::Document::cleanStyleProperty(const std::shared_ptr<exml::Element>& _root) { bool esvg::Document::cleanStyleProperty(const exml::Element& _root) {
// for each nodes: // for each nodes:
for(int32_t iii=0; iii< _root->size(); iii++) { for(auto it: _root.nodes) {
std::shared_ptr<exml::Element> child = _root->getElement(iii); exml::Element child = it.toElement();
if (child == nullptr) { if (child.exist() == false) {
continue; continue;
} }
// get attribute style: // get attribute style:
if (child->existAttribute("style") == true) { if (child.attributes.exist("style") == true) {
std::string content = child->getAttribute("style"); std::string content = child.attributes["style"];
if (content.size() != 0) { if (content.size() != 0) {
std::vector<std::string> listStyle = etk::split(content, ';'); std::vector<std::string> listStyle = etk::split(content, ';');
for (auto &it : listStyle) { for (auto &it : listStyle) {
@ -230,11 +226,11 @@ bool esvg::Document::cleanStyleProperty(const std::shared_ptr<exml::Element>& _r
continue; continue;
} }
// TODO : Check if the attibute already exist ... // TODO : Check if the attibute already exist ...
child->setAttribute(value[0], value[1]); child.attributes.set(value[0], value[1]);
} }
} }
// remove attribute style: // remove attribute style:
child->removeAttribute("style"); child.attributes.remove("style");
} }
// sub-parsing ... // sub-parsing ...
cleanStyleProperty(child); cleanStyleProperty(child);
@ -242,9 +238,9 @@ bool esvg::Document::cleanStyleProperty(const std::shared_ptr<exml::Element>& _r
return true; return true;
} }
bool esvg::Document::parseXMLData(const std::shared_ptr<exml::Element>& _root, bool _isReference) { bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference) {
// get the svg version : // get the svg version :
m_version = _root->getAttribute("version"); m_version = _root.attributes["version"];
// parse ... // parse ...
vec2 pos(0,0); vec2 pos(0,0);
if (_isReference == false) { if (_isReference == false) {
@ -258,75 +254,75 @@ bool esvg::Document::parseXMLData(const std::shared_ptr<exml::Element>& _root, b
vec2 maxSize(0,0); vec2 maxSize(0,0);
vec2 size(0,0); vec2 size(0,0);
// parse all sub node: // parse all sub node:
for(int32_t iii=0; iii< _root->size(); iii++) { for(auto it : _root.nodes) {
std::shared_ptr<exml::Element> child = _root->getElement(iii); exml::Element child = it.toElement();
if (child == nullptr) { if (child.exist() == false) {
// comment can be here... // comment can be here...
continue; continue;
} }
std::shared_ptr<esvg::Base> elementParser; std::shared_ptr<esvg::Base> elementParser;
if (child->getValue() == "g") { if (child.getValue() == "g") {
elementParser = std::make_shared<esvg::Group>(m_paint); elementParser = std::make_shared<esvg::Group>(m_paint);
} else if (child->getValue() == "a") { } else if (child.getValue() == "a") {
ESVG_INFO("Note : 'a' balise is parsed like a g balise ..."); ESVG_INFO("Note : 'a' balise is parsed like a g balise ...");
elementParser = std::make_shared<esvg::Group>(m_paint); elementParser = std::make_shared<esvg::Group>(m_paint);
} else if (child->getValue() == "title") { } else if (child.getValue() == "title") {
m_title = "TODO : set the title here ..."; m_title = "TODO : set the title here ...";
continue; continue;
} else if (child->getValue() == "path") { } else if (child.getValue() == "path") {
elementParser = std::make_shared<esvg::Path>(m_paint); elementParser = std::make_shared<esvg::Path>(m_paint);
} else if (child->getValue() == "rect") { } else if (child.getValue() == "rect") {
elementParser = std::make_shared<esvg::Rectangle>(m_paint); elementParser = std::make_shared<esvg::Rectangle>(m_paint);
} else if (child->getValue() == "circle") { } else if (child.getValue() == "circle") {
elementParser = std::make_shared<esvg::Circle>(m_paint); elementParser = std::make_shared<esvg::Circle>(m_paint);
} else if (child->getValue() == "ellipse") { } else if (child.getValue() == "ellipse") {
elementParser = std::make_shared<esvg::Ellipse>(m_paint); elementParser = std::make_shared<esvg::Ellipse>(m_paint);
} else if (child->getValue() == "line") { } else if (child.getValue() == "line") {
elementParser = std::make_shared<esvg::Line>(m_paint); elementParser = std::make_shared<esvg::Line>(m_paint);
} else if (child->getValue() == "polyline") { } else if (child.getValue() == "polyline") {
elementParser = std::make_shared<esvg::Polyline>(m_paint); elementParser = std::make_shared<esvg::Polyline>(m_paint);
} else if (child->getValue() == "polygon") { } else if (child.getValue() == "polygon") {
elementParser = std::make_shared<esvg::Polygon>(m_paint); elementParser = std::make_shared<esvg::Polygon>(m_paint);
} else if (child->getValue() == "text") { } else if (child.getValue() == "text") {
elementParser = std::make_shared<esvg::Text>(m_paint); elementParser = std::make_shared<esvg::Text>(m_paint);
} else if (child->getValue() == "radialGradient") { } else if (child.getValue() == "radialGradient") {
if (_isReference == false) { if (_isReference == false) {
ESVG_ERROR("'" << child->getValue() << "' node must not be defined outside a defs Section"); ESVG_ERROR("'" << child.getValue() << "' node must not be defined outside a defs Section");
continue; continue;
} else { } else {
elementParser = std::make_shared<esvg::RadialGradient>(m_paint); elementParser = std::make_shared<esvg::RadialGradient>(m_paint);
} }
} else if (child->getValue() == "linearGradient") { } else if (child.getValue() == "linearGradient") {
if (_isReference == false) { if (_isReference == false) {
ESVG_ERROR("'" << child->getValue() << "' node must not be defined outside a defs Section"); ESVG_ERROR("'" << child.getValue() << "' node must not be defined outside a defs Section");
continue; continue;
} else { } else {
elementParser = std::make_shared<esvg::LinearGradient>(m_paint); elementParser = std::make_shared<esvg::LinearGradient>(m_paint);
} }
} else if (child->getValue() == "defs") { } else if (child.getValue() == "defs") {
if (_isReference == true) { if (_isReference == true) {
ESVG_ERROR("'" << child->getValue() << "' node must not be defined in a defs Section"); ESVG_ERROR("'" << child.getValue() << "' node must not be defined in a defs Section");
continue; continue;
} else { } else {
bool retRefs = parseXMLData(child, true); bool retRefs = parseXMLData(child, true);
// TODO : Use retRefs ... // TODO : Use retRefs ...
continue; continue;
} }
} else if (child->getValue() == "sodipodi:namedview") { } else if (child.getValue() == "sodipodi:namedview") {
// Node ignore : generaly inkscape data // Node ignore : generaly inkscape data
continue; continue;
} else if (child->getValue() == "metadata") { } else if (child.getValue() == "metadata") {
// Node ignore : generaly inkscape data // Node ignore : generaly inkscape data
continue; continue;
} else { } else {
ESVG_ERROR("(l "<<child->getPos()<<") node not suported : \""<<child->getValue()<<"\" must be [title,g,a,path,rect,circle,ellipse,line,polyline,polygon,text,metadata]"); ESVG_ERROR("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [title,g,a,path,rect,circle,ellipse,line,polyline,polygon,text,metadata]");
} }
if (elementParser == nullptr) { if (elementParser == nullptr) {
ESVG_ERROR("(l "<<child->getPos()<<") error on node: \""<<child->getValue()<<"\" allocation error or not supported ..."); ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' allocation error or not supported ...");
continue; continue;
} }
if (elementParser->parseXML(child, m_transformMatrix, size) == false) { if (elementParser->parseXML(child, m_transformMatrix, size) == false) {
ESVG_ERROR("(l "<<child->getPos()<<") error on node: \""<<child->getValue()<<"\" Sub Parsing ERROR"); ESVG_ERROR("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' Sub Parsing ERROR");
elementParser.reset(); elementParser.reset();
continue; continue;
} }
@ -343,7 +339,8 @@ bool esvg::Document::parseXMLData(const std::shared_ptr<exml::Element>& _root, b
m_refList.push_back(elementParser); m_refList.push_back(elementParser);
} }
} }
if (m_size.x() == 0 || m_size.y()==0) { if ( m_size.x() == 0
|| m_size.y()==0) {
m_size.setValue((int32_t)maxSize.x(), (int32_t)maxSize.y()); m_size.setValue((int32_t)maxSize.x(), (int32_t)maxSize.y());
} else { } else {
m_size.setValue((int32_t)m_size.x(), (int32_t)m_size.y()); m_size.setValue((int32_t)m_size.x(), (int32_t)m_size.y());

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -60,8 +60,8 @@ namespace esvg {
/** /**
* @brief change all style in a xml atribute * @brief change all style in a xml atribute
*/ */
virtual bool cleanStyleProperty(const std::shared_ptr<exml::Element>& _root); virtual bool cleanStyleProperty(const exml::Element& _root);
virtual bool parseXMLData(const std::shared_ptr<exml::Element>& _root, bool _isReference = false); virtual bool parseXMLData(const exml::Element& _root, bool _isReference = false);
public: public:
bool isLoadOk() { bool isLoadOk() {
return m_loadOK; return m_loadOK;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -12,9 +12,6 @@
#include <esvg/RadialGradient.h> #include <esvg/RadialGradient.h>
#include <esvg/esvg.h> #include <esvg/esvg.h>
#undef __class__
#define __class__ "render::DynamicColorSpecial"
esvg::render::DynamicColorSpecial::DynamicColorSpecial(const std::string& _link, const mat2& _mtx) : esvg::render::DynamicColorSpecial::DynamicColorSpecial(const std::string& _link, const mat2& _mtx) :
m_linear(true), m_linear(true),
m_colorName(_link), m_colorName(_link),
@ -444,9 +441,6 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
} }
} }
#undef __class__
#define __class__ "render:DynamicColor"
std::shared_ptr<esvg::render::DynamicColor> esvg::render::createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx) { std::shared_ptr<esvg::render::DynamicColor> esvg::render::createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2& _mtx) {
// Check if need to create a color: // Check if need to create a color:
if ( _color.first.a() == 0x00 if ( _color.first.a() == 0x00

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::Element"
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::render::path _obj) { std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::render::path _obj) {
switch (_obj) { switch (_obj) {
case esvg::render::path_stop: case esvg::render::path_stop:

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementBezierCurveTo"
esvg::render::ElementBezierCurveTo::ElementBezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos): esvg::render::ElementBezierCurveTo::ElementBezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos):
Element(esvg::render::path_bezierCurveTo, _relative) { Element(esvg::render::path_bezierCurveTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementBezierSmoothCurveTo"
esvg::render::ElementBezierSmoothCurveTo::ElementBezierSmoothCurveTo(bool _relative, const vec2& _pos): esvg::render::ElementBezierSmoothCurveTo::ElementBezierSmoothCurveTo(bool _relative, const vec2& _pos):
Element(esvg::render::path_bezierSmoothCurveTo, _relative) { Element(esvg::render::path_bezierSmoothCurveTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementClose"
esvg::render::ElementClose::ElementClose(bool _relative): esvg::render::ElementClose::ElementClose(bool _relative):
Element(esvg::render::path_close, _relative) { Element(esvg::render::path_close, _relative) {

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementCurveTo"
esvg::render::ElementCurveTo::ElementCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos): esvg::render::ElementCurveTo::ElementCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos):
Element(esvg::render::path_curveTo, _relative) { Element(esvg::render::path_curveTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -6,7 +6,6 @@
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
#include <etk/types.h> #include <etk/types.h>
#include <etk/math/Vector2D.h> #include <etk/math/Vector2D.h>
#include <esvg/render/Element.h> #include <esvg/render/Element.h>

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementElliptic"
esvg::render::ElementElliptic::ElementElliptic(bool _relative, esvg::render::ElementElliptic::ElementElliptic(bool _relative,
const vec2& _radius, // in m_vec1 const vec2& _radius, // in m_vec1
float _angle, float _angle,

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementLineTo"
esvg::render::ElementLineTo::ElementLineTo(bool _relative, const vec2& _pos): esvg::render::ElementLineTo::ElementLineTo(bool _relative, const vec2& _pos):
Element(esvg::render::path_lineTo, _relative) { Element(esvg::render::path_lineTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementLineToH"
esvg::render::ElementLineToH::ElementLineToH(bool _relative, float _posX): esvg::render::ElementLineToH::ElementLineToH(bool _relative, float _posX):
Element(esvg::render::path_lineToH, _relative) { Element(esvg::render::path_lineToH, _relative) {
m_pos = vec2(_posX, 0.0f); m_pos = vec2(_posX, 0.0f);

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementLineToV"
esvg::render::ElementLineToV::ElementLineToV(bool _relative, float _posY): esvg::render::ElementLineToV::ElementLineToV(bool _relative, float _posY):
Element(esvg::render::path_lineToV, _relative) { Element(esvg::render::path_lineToV, _relative) {
m_pos = vec2(0.0f, _posY); m_pos = vec2(0.0f, _posY);

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementMoveTo"
esvg::render::ElementMoveTo::ElementMoveTo(bool _relative, const vec2& _pos): esvg::render::ElementMoveTo::ElementMoveTo(bool _relative, const vec2& _pos):
Element(esvg::render::path_moveTo, _relative) { Element(esvg::render::path_moveTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementSmoothCurveTo"
esvg::render::ElementSmoothCurveTo::ElementSmoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos): esvg::render::ElementSmoothCurveTo::ElementSmoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos):
Element(esvg::render::path_smoothCurveTo, _relative) { Element(esvg::render::path_smoothCurveTo, _relative) {
m_pos = _pos; m_pos = _pos;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::ElementStop"
esvg::render::ElementStop::ElementStop(): esvg::render::ElementStop::ElementStop():
Element(esvg::render::path_stop) { Element(esvg::render::path_stop) {

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Path.h> #include <esvg/render/Path.h>
#include <esvg/render/Element.h> #include <esvg/render/Element.h>
#undef __class__
#define __class__ "rerder::Path"
void esvg::render::Path::clear() { void esvg::render::Path::clear() {
m_listElement.clear(); m_listElement.clear();
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Point.h> #include <esvg/render/Point.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::Point"
void esvg::render::Point::setEndPath() { void esvg::render::Point::setEndPath() {
if (m_type == esvg::render::Point::type_interpolation) { if (m_type == esvg::render::Point::type_interpolation) {
ESVG_WARNING("Request stop path of an interpolate Point"); ESVG_WARNING("Request stop path of an interpolate Point");

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Scanline.h> #include <esvg/render/Scanline.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::Scanline"
esvg::render::Scanline::Scanline(size_t _size) { esvg::render::Scanline::Scanline(size_t _size) {
float tmp(0); float tmp(0);
m_data.resize(_size, tmp); m_data.resize(_size, tmp);

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,9 +9,6 @@
#include <esvg/render/Segment.h> #include <esvg/render/Segment.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "rerder::Segment"
esvg::render::Segment::Segment(const vec2& _p0, const vec2& _p1) { esvg::render::Segment::Segment(const vec2& _p0, const vec2& _p1) {
// segment register all time the lower at P0n then we need to register the sens of the path // segment register all time the lower at P0n then we need to register the sens of the path
p0 = _p0; p0 = _p0;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -10,11 +10,6 @@
#include <esvg/debug.h> #include <esvg/debug.h>
#include <etk/math/Matrix2.h> #include <etk/math/Matrix2.h>
#undef __class__
#define __class__ "rerder::SegmentList"
esvg::render::SegmentList::SegmentList() { esvg::render::SegmentList::SegmentList() {
} }

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
@ -9,10 +9,6 @@
#include <esvg/render/Weight.h> #include <esvg/render/Weight.h>
#include <esvg/debug.h> #include <esvg/debug.h>
#undef __class__
#define __class__ "render::Weight"
esvg::render::Weight::Weight() : esvg::render::Weight::Weight() :
m_size(0,0) { m_size(0,0) {

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <etk/etk.h> #include <etk/etk.h>
#undef __class__
#define __class__ "esvg::test"
bool g_visualDebug = false; bool g_visualDebug = false;

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestLine"
TEST(TestCap, butt) { TEST(TestCap, butt) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestCircle"
TEST(TestCircle, fill) { TEST(TestCircle, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestColor"
TEST(TestColor, blending) { TEST(TestColor, blending) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestEllipse"
TEST(TestEllipse, fill) { TEST(TestEllipse, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestGradientLinear"
TEST(TestGradientLinear, horizontal) { TEST(TestGradientLinear, horizontal) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
"<svg height='100' width='100'>\n" "<svg height='100' width='100'>\n"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestGradientRadial"
TEST(TestGradientRadial, circle) { TEST(TestGradientRadial, circle) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
"<svg height='100' width='100'>\n" "<svg height='100' width='100'>\n"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,8 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestJoin"
// ------------------------------------------------------ Miter test ----------------------------------------------------- // ------------------------------------------------------ Miter test -----------------------------------------------------
TEST(TestJoin, miterRight1) { TEST(TestJoin, miterRight1) {

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestLine"
TEST(TestLine, stroke) { TEST(TestLine, stroke) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestPath"
TEST(TestPath, fill) { TEST(TestPath, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestPolygon"
TEST(TestPolygon, fill) { TEST(TestPolygon, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestLine"
TEST(TestPolyLine, fill) { TEST(TestPolyLine, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestRectangle"
TEST(TestRectangle, fill) { TEST(TestRectangle, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>" "<svg height='100' width='100'>"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -10,9 +10,6 @@
#include <esvg/esvg.h> #include <esvg/esvg.h>
#include "main.h" #include "main.h"
#undef __class__
#define __class__ "TestRectangle"
TEST(TestExtern, worddown) { TEST(TestExtern, worddown) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n" std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
"<!-- Created with Inkscape (http://www.inkscape.org/) -->\n" "<!-- Created with Inkscape (http://www.inkscape.org/) -->\n"

View File

@ -1,4 +1,4 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* *
* @copyright 2014, Edouard DUPIN, all right reserved * @copyright 2014, Edouard DUPIN, all right reserved
@ -11,9 +11,6 @@
#include <etk/etk.h> #include <etk/etk.h>
#include <esvg/esvg.h> #include <esvg/esvg.h>
#undef __class__
#define __class__ "converter"
static void usage() { static void usage() {
TEST_PRINT(etk::getApplicationName() << " - help : "); TEST_PRINT(etk::getApplicationName() << " - help : ");
TEST_PRINT(" " << etk::getApplicationName() << " [options]"); TEST_PRINT(" " << etk::getApplicationName() << " [options]");