[DEV] continue removing stl
This commit is contained in:
parent
7563abcf5a
commit
8553ffec06
@ -12,8 +12,8 @@
|
|||||||
const float esvg::kappa90(0.5522847493f);
|
const float esvg::kappa90(0.5522847493f);
|
||||||
|
|
||||||
esvg::PaintState::PaintState() :
|
esvg::PaintState::PaintState() :
|
||||||
fill(std::pair<etk::Color<float,4>, std::string>(etk::color::black, "")),
|
fill(etk::Pair<etk::Color<float,4>, etk::String>(etk::color::black, "")),
|
||||||
stroke(std::pair<etk::Color<float,4>, std::string>(etk::color::none, "")),
|
stroke(etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "")),
|
||||||
strokeWidth(1.0f),
|
strokeWidth(1.0f),
|
||||||
flagEvenOdd(false),
|
flagEvenOdd(false),
|
||||||
lineCap(esvg::cap_butt),
|
lineCap(esvg::cap_butt),
|
||||||
@ -25,8 +25,8 @@ esvg::PaintState::PaintState() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void esvg::PaintState::clear() {
|
void esvg::PaintState::clear() {
|
||||||
fill = std::pair<etk::Color<float,4>, std::string>(etk::color::black, "");
|
fill = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::black, "");
|
||||||
stroke = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
|
stroke = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "");
|
||||||
strokeWidth = 1.0;
|
strokeWidth = 1.0;
|
||||||
viewPort.first.setValue(0.0f,0.0f);
|
viewPort.first.setValue(0.0f,0.0f);
|
||||||
viewPort.first.setValue(0.0f,0.0f);
|
viewPort.first.setValue(0.0f,0.0f);
|
||||||
@ -43,9 +43,9 @@ esvg::Base::Base(PaintState _parentPaintState) {
|
|||||||
m_paint = _parentPaintState;
|
m_paint = _parentPaintState;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string extractTransformData(const std::string& _value, const std::string& _base) {
|
etk::String extractTransformData(const etk::String& _value, const etk::String& _base) {
|
||||||
size_t posStart = _value.find(_base);
|
size_t posStart = _value.find(_base);
|
||||||
if (posStart == std::string::npos) {
|
if (posStart == etk::String::npos) {
|
||||||
// Not find element is a normal case ...
|
// Not find element is a normal case ...
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -69,31 +69,31 @@ std::string extractTransformData(const std::string& _value, const std::string& _
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
size_t posEnd = _value.find(')', posStart);
|
size_t posEnd = _value.find(')', posStart);
|
||||||
if (posEnd == std::string::npos) {
|
if (posEnd == etk::String::npos) {
|
||||||
ESVG_ERROR("Missing element ')' in '" << _value << "' for " << _base);
|
ESVG_ERROR("Missing element ')' in '" << _value << "' for " << _base);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE("Find : '" << std::string(_value.begin()+posStart, _value.begin()+posEnd) << "' for " << _base);
|
ESVG_VERBOSE("Find : '" << etk::String(_value.begin()+posStart, _value.begin()+posEnd) << "' for " << _base);
|
||||||
return std::string(_value.begin()+posStart, _value.begin()+posEnd);
|
return etk::String(_value.begin()+posStart, _value.begin()+posEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Base::parseTransform(const exml::Element& _element) {
|
void esvg::Base::parseTransform(const exml::Element& _element) {
|
||||||
if (_element.exist() == false) {
|
if (_element.exist() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string inputString = _element.attributes["transform"];
|
etk::String inputString = _element.attributes["transform"];
|
||||||
if (inputString.size() == 0) {
|
if (inputString.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE("find transform : \"" << inputString << "\"");
|
ESVG_VERBOSE("find transform : \"" << inputString << "\"");
|
||||||
for (int32_t iii=0; iii<inputString.size(); iii++) {
|
for (size_t iii=0; iii<inputString.size(); iii++) {
|
||||||
if (inputString[iii] == ',') {
|
if (inputString[iii] == ',') {
|
||||||
inputString[iii] = ' ';
|
inputString[iii] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE("find transform : \"" << inputString << "\"");
|
ESVG_VERBOSE("find transform : \"" << inputString << "\"");
|
||||||
// need to find elements in order ...
|
// need to find elements in order ...
|
||||||
std::string data = extractTransformData(inputString, "matrix");
|
etk::String data = extractTransformData(inputString, "matrix");
|
||||||
if (data.size() != 0) {
|
if (data.size() != 0) {
|
||||||
double matrix[6];
|
double matrix[6];
|
||||||
if (sscanf(data.c_str(), "%lf %lf %lf %lf %lf %lf", &matrix[0], &matrix[1], &matrix[2], &matrix[3], &matrix[4], &matrix[5]) == 6) {
|
if (sscanf(data.c_str(), "%lf %lf %lf %lf %lf %lf", &matrix[0], &matrix[1], &matrix[2], &matrix[3], &matrix[4], &matrix[5]) == 6) {
|
||||||
@ -177,7 +177,7 @@ void esvg::Base::parsePosition(const exml::Element& _element, vec2 &_pos, vec2 &
|
|||||||
if (_element.exist() == false) {
|
if (_element.exist() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string content = _element.attributes["x"];
|
etk::String content = _element.attributes["x"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
_pos.setX(parseLength(content));
|
_pos.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -196,10 +196,10 @@ void esvg::Base::parsePosition(const exml::Element& _element, vec2 &_pos, vec2 &
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::pair<float, enum esvg::distance> esvg::Base::parseLength2(const std::string& _dataInput) {
|
etk::Pair<float, enum esvg::distance> esvg::Base::parseLength2(const etk::String& _dataInput) {
|
||||||
ESVG_VERBOSE(" lenght : '" << _dataInput << "'");
|
ESVG_VERBOSE(" lenght : '" << _dataInput << "'");
|
||||||
float n = stof(_dataInput);
|
float n = _dataInput.to<float>();
|
||||||
std::string unit;
|
etk::String unit;
|
||||||
for (int32_t iii=0; iii<_dataInput.size(); ++iii) {
|
for (int32_t iii=0; iii<_dataInput.size(); ++iii) {
|
||||||
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|
||||||
|| _dataInput[iii]=='+'
|
|| _dataInput[iii]=='+'
|
||||||
@ -207,46 +207,46 @@ std::pair<float, enum esvg::distance> esvg::Base::parseLength2(const std::string
|
|||||||
|| _dataInput[iii]=='.') {
|
|| _dataInput[iii]=='.') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
unit = std::string(_dataInput, iii);
|
unit = etk::String(_dataInput, iii);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE(" lenght : '" << n << "' => unit=" << unit);
|
ESVG_VERBOSE(" lenght : '" << n << "' => unit=" << unit);
|
||||||
// note : ";" is for the parsing of the style elements ...
|
// note : ";" is for the parsing of the style elements ...
|
||||||
if(unit.size() == 0) {
|
if(unit.size() == 0) {
|
||||||
return std::make_pair(n, esvg::distance_pixel);
|
return etk::makePair(n, esvg::distance_pixel);
|
||||||
} else if (unit[0] == '%') { // xxx %
|
} else if (unit[0] == '%') { // xxx %
|
||||||
return std::make_pair(n, esvg::distance_pourcent);
|
return etk::makePair(n, esvg::distance_pourcent);
|
||||||
} else if ( unit[0] == 'e'
|
} else if ( unit[0] == 'e'
|
||||||
&& unit[1] == 'm') { // xxx em
|
&& unit[1] == 'm') { // xxx em
|
||||||
return std::make_pair(n, esvg::distance_element);
|
return etk::makePair(n, esvg::distance_element);
|
||||||
} else if ( unit[0] == 'e'
|
} else if ( unit[0] == 'e'
|
||||||
&& unit[1] == 'x') { // xxx ex
|
&& unit[1] == 'x') { // xxx ex
|
||||||
return std::make_pair(n, esvg::distance_ex);
|
return etk::makePair(n, esvg::distance_ex);
|
||||||
} else if ( unit[0] == 'p'
|
} else if ( unit[0] == 'p'
|
||||||
&& unit[1] == 'x') { // xxx px
|
&& unit[1] == 'x') { // xxx px
|
||||||
return std::make_pair(n, esvg::distance_pixel);
|
return etk::makePair(n, esvg::distance_pixel);
|
||||||
} else if ( unit[0] == 'p'
|
} else if ( unit[0] == 'p'
|
||||||
&& unit[1] == 't') { // xxx pt
|
&& unit[1] == 't') { // xxx pt
|
||||||
return std::make_pair(n, esvg::distance_point);
|
return etk::makePair(n, esvg::distance_point);
|
||||||
} else if ( unit[0] == 'p'
|
} else if ( unit[0] == 'p'
|
||||||
&& unit[1] == 'c') { // xxx pc
|
&& unit[1] == 'c') { // xxx pc
|
||||||
return std::make_pair(n, esvg::distance_pc);
|
return etk::makePair(n, esvg::distance_pc);
|
||||||
} else if ( unit[0] == 'm'
|
} else if ( unit[0] == 'm'
|
||||||
&& unit[1] == 'm') { // xxx mm
|
&& unit[1] == 'm') { // xxx mm
|
||||||
return std::make_pair(n, esvg::distance_millimeter);
|
return etk::makePair(n, esvg::distance_millimeter);
|
||||||
} else if ( unit[0] == 'c'
|
} else if ( unit[0] == 'c'
|
||||||
&& unit[1] == 'm') { // xxx cm
|
&& unit[1] == 'm') { // xxx cm
|
||||||
return std::make_pair(n, esvg::distance_centimeter);
|
return etk::makePair(n, esvg::distance_centimeter);
|
||||||
} else if ( unit[0] == 'i'
|
} else if ( unit[0] == 'i'
|
||||||
&& unit[1] == 'n') { // xxx in
|
&& unit[1] == 'n') { // xxx in
|
||||||
return std::make_pair(n, esvg::distance_inch);
|
return etk::makePair(n, esvg::distance_inch);
|
||||||
}
|
}
|
||||||
return std::make_pair(0.0f, esvg::distance_pixel);
|
return etk::makePair(0.0f, esvg::distance_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float esvg::Base::parseLength(const std::string& _dataInput) {
|
float esvg::Base::parseLength(const etk::String& _dataInput) {
|
||||||
std::pair<float, enum esvg::distance> value = parseLength2(_dataInput);
|
etk::Pair<float, enum esvg::distance> value = parseLength2(_dataInput);
|
||||||
ESVG_VERBOSE(" lenght : '" << value.first << "' => unit=" << value.second);
|
ESVG_VERBOSE(" lenght : '" << value.first << "' => unit=" << value.second);
|
||||||
float font_size = 20.0f;
|
float font_size = 20.0f;
|
||||||
switch (value.second) {
|
switch (value.second) {
|
||||||
@ -280,13 +280,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
|
|||||||
bool fillNone = false;
|
bool fillNone = false;
|
||||||
bool strokeNone = false;
|
bool strokeNone = false;
|
||||||
*/
|
*/
|
||||||
std::string content;
|
etk::String content;
|
||||||
// ---------------- get unique ID ----------------
|
// ---------------- get unique ID ----------------
|
||||||
m_id = _element.attributes["id"];
|
m_id = _element.attributes["id"];
|
||||||
// ---------------- stroke ----------------
|
// ---------------- stroke ----------------
|
||||||
content = _element.attributes["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 = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "");
|
||||||
} else {
|
} else {
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_paint.stroke = parseColor(content);
|
m_paint.stroke = parseColor(content);
|
||||||
@ -298,7 +298,7 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
|
|||||||
content = _element.attributes["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 = etk::avg(0.0f, opacity, 1.0f);
|
||||||
m_paint.stroke.first.setA(opacity);
|
m_paint.stroke.first.setA(opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,13 +339,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
|
|||||||
content = _element.attributes["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 = etk::max(0.0f, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ---------------- FILL ----------------
|
// ---------------- FILL ----------------
|
||||||
content = _element.attributes["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 = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "");
|
||||||
} else {
|
} else {
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_paint.fill = parseColor(content);
|
m_paint.fill = parseColor(content);
|
||||||
@ -353,7 +353,7 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
|
|||||||
content = _element.attributes["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 = etk::avg(0.0f, opacity, 1.0f);
|
||||||
m_paint.fill.first.setA(opacity);
|
m_paint.fill.first.setA(opacity);
|
||||||
}
|
}
|
||||||
content = _element.attributes["fill-rule"];
|
content = _element.attributes["fill-rule"];
|
||||||
@ -370,13 +370,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
|
|||||||
content = _element.attributes["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 = etk::avg(0.0f, m_paint.opacity, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<etk::Color<float,4>, std::string> esvg::Base::parseColor(const std::string& _inputData) {
|
etk::Pair<etk::Color<float,4>, etk::String> esvg::Base::parseColor(const etk::String& _inputData) {
|
||||||
std::pair<etk::Color<float,4>, std::string> localColor(etk::color::white, "");
|
etk::Pair<etk::Color<float,4>, etk::String> localColor(etk::color::white, "");
|
||||||
|
|
||||||
if( _inputData.size() > 4
|
if( _inputData.size() > 4
|
||||||
&& _inputData[0] == 'u'
|
&& _inputData[0] == 'u'
|
||||||
@ -384,13 +384,13 @@ std::pair<etk::Color<float,4>, std::string> esvg::Base::parseColor(const std::st
|
|||||||
&& _inputData[2] == 'l'
|
&& _inputData[2] == 'l'
|
||||||
&& _inputData[3] == '(') {
|
&& _inputData[3] == '(') {
|
||||||
if (_inputData[4] == '#') {
|
if (_inputData[4] == '#') {
|
||||||
std::string color(_inputData.begin() + 5, _inputData.end()-1);
|
etk::String color(_inputData.begin() + 5, _inputData.end()-1);
|
||||||
localColor = std::pair<etk::Color<float,4>, std::string>(etk::color::none, color);
|
localColor = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, color);
|
||||||
} else {
|
} else {
|
||||||
ESVG_ERROR("Problem in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
|
ESVG_ERROR("Problem in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
localColor = std::pair<etk::Color<float,4>, std::string>(_inputData, "");
|
localColor = etk::Pair<etk::Color<float,4>, etk::String>(_inputData, "");
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE("Parse color : \"" << _inputData << "\" == > " << localColor.first << " " << localColor.second);
|
ESVG_VERBOSE("Parse color : \"" << _inputData << "\" == > " << localColor.first << " " << localColor.second);
|
||||||
return localColor;
|
return localColor;
|
||||||
@ -419,17 +419,17 @@ void esvg::Base::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const std::string& esvg::Base::getId() const {
|
const etk::String& esvg::Base::getId() const {
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Base::setId(const std::string& _newId) {
|
void esvg::Base::setId(const etk::String& _newId) {
|
||||||
// TODO : Check if it is UNIQUE ...
|
// TODO : Check if it is UNIQUE ...
|
||||||
m_id = _newId;
|
m_id = _newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Base::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Base::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <etk/math/Vector2D.hpp>
|
#include <etk/math/Vector2D.hpp>
|
||||||
#include <etk/math/Matrix2x3.hpp>
|
#include <etk/math/Matrix2x3.hpp>
|
||||||
#include <etk/Color.hpp>
|
#include <etk/Color.hpp>
|
||||||
@ -38,14 +38,14 @@ namespace esvg {
|
|||||||
PaintState();
|
PaintState();
|
||||||
void clear();
|
void clear();
|
||||||
public:
|
public:
|
||||||
std::pair<etk::Color<float,4>, std::string> fill;
|
etk::Pair<etk::Color<float,4>, etk::String> fill;
|
||||||
std::pair<etk::Color<float,4>, std::string> stroke;
|
etk::Pair<etk::Color<float,4>, etk::String> stroke;
|
||||||
float strokeWidth;
|
float strokeWidth;
|
||||||
bool flagEvenOdd; //!< Fill rules
|
bool flagEvenOdd; //!< Fill rules
|
||||||
enum esvg::cap lineCap;
|
enum esvg::cap lineCap;
|
||||||
enum esvg::join lineJoin;
|
enum esvg::join lineJoin;
|
||||||
float miterLimit;
|
float miterLimit;
|
||||||
std::pair<vec2, vec2> viewPort; //!< min pos, max pos
|
etk::Pair<vec2, vec2> viewPort; //!< min pos, max pos
|
||||||
float opacity;
|
float opacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace esvg {
|
|||||||
* @param[in] _basicTrans Parant transformation of the environement
|
* @param[in] _basicTrans Parant transformation of the environement
|
||||||
* @param[in] _level Level of the tree
|
* @param[in] _level Level of the tree
|
||||||
*/
|
*/
|
||||||
virtual void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
virtual void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -99,8 +99,8 @@ namespace esvg {
|
|||||||
* @param[in] _dataInput Data C String with the printed lenght
|
* @param[in] _dataInput Data C String with the printed lenght
|
||||||
* @return standard number of pixels
|
* @return standard number of pixels
|
||||||
*/
|
*/
|
||||||
float parseLength(const std::string& _dataInput);
|
float parseLength(const etk::String& _dataInput);
|
||||||
std::pair<float, enum esvg::distance> parseLength2(const std::string& _dataInput);
|
etk::Pair<float, enum esvg::distance> parseLength2(const etk::String& _dataInput);
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
@ -111,19 +111,19 @@ namespace esvg {
|
|||||||
* @param[in] _inputData Data C String with the xml definition
|
* @param[in] _inputData Data C String with the xml definition
|
||||||
* @return The parsed color (color used and the link if needed)
|
* @return The parsed color (color used and the link if needed)
|
||||||
*/
|
*/
|
||||||
std::pair<etk::Color<float,4>, std::string> parseColor(const std::string& _inputData);
|
etk::Pair<etk::Color<float,4>, etk::String> parseColor(const etk::String& _inputData);
|
||||||
protected:
|
protected:
|
||||||
std::string m_id; //!< unique ID of the element.
|
etk::String m_id; //!< unique ID of the element.
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get the ID of the Element
|
* @brief Get the ID of the Element
|
||||||
* @return UniqueId in the svg file
|
* @return UniqueId in the svg file
|
||||||
*/
|
*/
|
||||||
const std::string& getId() const;
|
const etk::String& getId() const;
|
||||||
/**
|
/**
|
||||||
* @brief Set the ID of the Element
|
* @brief Set the ID of the Element
|
||||||
* @param[in] _newId New Id of the element
|
* @param[in] _newId New Id of the element
|
||||||
*/
|
*/
|
||||||
void setId(const std::string& _newId);
|
void setId(const etk::String& _newId);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ bool esvg::Circle::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
std::string content = _element.attributes["cx"];
|
etk::String content = _element.attributes["cx"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_position.setX(parseLength(content));
|
m_position.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Circle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Circle::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -156,11 +156,11 @@ void esvg::Circle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -33,7 +33,7 @@ esvg::Dimension::Dimension(const vec2& _size, enum esvg::distance _type) :
|
|||||||
set(_size, _type);
|
set(_size, _type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Dimension::set(std::string _config) {
|
void esvg::Dimension::set(etk::String _config) {
|
||||||
m_data.setValue(0,0);
|
m_data.setValue(0,0);
|
||||||
m_type = esvg::distance_pixel;
|
m_type = esvg::distance_pixel;
|
||||||
enum distance type = esvg::distance_pixel;
|
enum distance type = esvg::distance_pixel;
|
||||||
@ -71,7 +71,7 @@ void esvg::Dimension::set(std::string _config) {
|
|||||||
ESVG_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
|
ESVG_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum esvg::distance parseType(std::string& _config) {
|
static enum esvg::distance parseType(etk::String& _config) {
|
||||||
enum esvg::distance type = esvg::distance_pixel;
|
enum esvg::distance type = esvg::distance_pixel;
|
||||||
if (etk::end_with(_config, "%", false) == true) {
|
if (etk::end_with(_config, "%", false) == true) {
|
||||||
type = esvg::distance_pourcent;
|
type = esvg::distance_pourcent;
|
||||||
@ -105,7 +105,7 @@ static enum esvg::distance parseType(std::string& _config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Dimension::set(std::string _configX, std::string _configY) {
|
void esvg::Dimension::set(etk::String _configX, etk::String _configY) {
|
||||||
m_data.setValue(0,0);
|
m_data.setValue(0,0);
|
||||||
m_type = esvg::distance_pixel;
|
m_type = esvg::distance_pixel;
|
||||||
enum distance type = esvg::distance_pixel;
|
enum distance type = esvg::distance_pixel;
|
||||||
@ -125,8 +125,8 @@ esvg::Dimension::~Dimension() {
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
esvg::Dimension::operator std::string() const {
|
esvg::Dimension::operator etk::String() const {
|
||||||
std::string str;
|
etk::String str;
|
||||||
str = getValue();
|
str = getValue();
|
||||||
switch(getType()) {
|
switch(getType()) {
|
||||||
case esvg::distance_pourcent:
|
case esvg::distance_pourcent:
|
||||||
@ -214,7 +214,7 @@ vec2 esvg::Dimension::getPixel(const vec2& _upperSize) const {
|
|||||||
return vec2(128.0f, 128.0f);
|
return vec2(128.0f, 128.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::distance _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::distance _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case esvg::distance_pourcent:
|
case esvg::distance_pourcent:
|
||||||
_os << "%";
|
_os << "%";
|
||||||
@ -256,24 +256,24 @@ std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::distance _obj) {
|
|||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, const esvg::Dimension& _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, const esvg::Dimension& _obj) {
|
||||||
_os << _obj.getValue() << _obj.getType();
|
_os << _obj.getValue() << _obj.getType();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<esvg::Dimension>(const esvg::Dimension& _obj) {
|
template<> etk::String toString<esvg::Dimension>(const esvg::Dimension& _obj) {
|
||||||
return _obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
template<> std::u32string to_u32string<esvg::Dimension>(const esvg::Dimension& _obj) {
|
template<> etk::UString toUString<esvg::Dimension>(const esvg::Dimension& _obj) {
|
||||||
return etk::to_u32string(etk::to_string(_obj));
|
return etk::toUString(etk::toString(_obj));
|
||||||
}
|
}
|
||||||
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const std::string& _value) {
|
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const etk::String& _value) {
|
||||||
_variableRet = esvg::Dimension(_value);
|
_variableRet = esvg::Dimension(_value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const std::u32string& _value) {
|
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const etk::UString& _value) {
|
||||||
return from_string(_variableRet, etk::to_string(_value));
|
return from_string(_variableRet, etk::toString(_value));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ esvg::Dimension1D::Dimension1D(float _size, enum esvg::distance _type) :
|
|||||||
set(_size, _type);
|
set(_size, _type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Dimension1D::set(std::string _config) {
|
void esvg::Dimension1D::set(etk::String _config) {
|
||||||
m_data = 0;
|
m_data = 0;
|
||||||
m_type = esvg::distance_pixel;
|
m_type = esvg::distance_pixel;
|
||||||
enum distance type = esvg::distance_pixel;
|
enum distance type = esvg::distance_pixel;
|
||||||
@ -330,8 +330,8 @@ esvg::Dimension1D::~Dimension1D() {
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
esvg::Dimension1D::operator std::string() const {
|
esvg::Dimension1D::operator etk::String() const {
|
||||||
std::string str;
|
etk::String str;
|
||||||
str = getValue();
|
str = getValue();
|
||||||
switch(getType()) {
|
switch(getType()) {
|
||||||
case esvg::distance_pourcent:
|
case esvg::distance_pourcent:
|
||||||
@ -419,24 +419,24 @@ float esvg::Dimension1D::getPixel(float _upperSize) const {
|
|||||||
return 128.0f;
|
return 128.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, const esvg::Dimension1D& _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, const esvg::Dimension1D& _obj) {
|
||||||
_os << _obj.getValue() << _obj.getType();
|
_os << _obj.getValue() << _obj.getType();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<esvg::Dimension1D>(const esvg::Dimension1D& _obj) {
|
template<> etk::String toString<esvg::Dimension1D>(const esvg::Dimension1D& _obj) {
|
||||||
return _obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
template<> std::u32string to_u32string<esvg::Dimension1D>(const esvg::Dimension1D& _obj) {
|
template<> etk::UString toUString<esvg::Dimension1D>(const esvg::Dimension1D& _obj) {
|
||||||
return etk::to_u32string(etk::to_string(_obj));
|
return etk::toUString(etk::toString(_obj));
|
||||||
}
|
}
|
||||||
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const std::string& _value) {
|
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const etk::String& _value) {
|
||||||
_variableRet = esvg::Dimension1D(_value);
|
_variableRet = esvg::Dimension1D(_value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const std::u32string& _value) {
|
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const etk::UString& _value) {
|
||||||
return from_string(_variableRet, etk::to_string(_value));
|
return from_string(_variableRet, etk::toString(_value));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ namespace esvg {
|
|||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param[in] _config dimension configuration.
|
* @param[in] _config dimension configuration.
|
||||||
*/
|
*/
|
||||||
Dimension(const std::string& _config) :
|
Dimension(const etk::String& _config) :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(esvg::distance_pixel) {
|
m_type(esvg::distance_pixel) {
|
||||||
set(_config);
|
set(_config);
|
||||||
@ -56,7 +56,7 @@ namespace esvg {
|
|||||||
* @param[in] _configX dimension X configuration.
|
* @param[in] _configX dimension X configuration.
|
||||||
* @param[in] _configY dimension Y configuration.
|
* @param[in] _configY dimension Y configuration.
|
||||||
*/
|
*/
|
||||||
Dimension(const std::string& _configX, const std::string& _configY) :
|
Dimension(const etk::String& _configX, const etk::String& _configY) :
|
||||||
m_data(0,0),
|
m_data(0,0),
|
||||||
m_type(esvg::distance_pixel) {
|
m_type(esvg::distance_pixel) {
|
||||||
set(_configX, _configY);
|
set(_configX, _configY);
|
||||||
@ -69,7 +69,7 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief string cast :
|
* @brief string cast :
|
||||||
*/
|
*/
|
||||||
operator std::string() const;
|
operator etk::String() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current dimention.
|
* @brief get the current dimention.
|
||||||
@ -97,13 +97,13 @@ namespace esvg {
|
|||||||
* @brief set the current dimention in requested type
|
* @brief set the current dimention in requested type
|
||||||
* @param[in] _config dimension configuration.
|
* @param[in] _config dimension configuration.
|
||||||
*/
|
*/
|
||||||
void set(std::string _config);
|
void set(etk::String _config);
|
||||||
/**
|
/**
|
||||||
* @brief set the current dimention in requested type
|
* @brief set the current dimention in requested type
|
||||||
* @param[in] _configX dimension X configuration.
|
* @param[in] _configX dimension X configuration.
|
||||||
* @param[in] _configY dimension Y configuration.
|
* @param[in] _configY dimension Y configuration.
|
||||||
*/
|
*/
|
||||||
void set(std::string _configX, std::string _configY);
|
void set(etk::String _configX, etk::String _configY);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief get the current dimention in pixel
|
* @brief get the current dimention in pixel
|
||||||
@ -142,8 +142,8 @@ namespace esvg {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::distance _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::distance _obj);
|
||||||
std::ostream& operator <<(std::ostream& _os, const esvg::Dimension& _obj);
|
etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension& _obj);
|
||||||
/**
|
/**
|
||||||
* @brief in the dimention class we store the data as the more usefull unit (pixel)
|
* @brief in the dimention class we store the data as the more usefull unit (pixel)
|
||||||
* but one case need to be dynamic the %, then when requested in % the register the % value
|
* but one case need to be dynamic the %, then when requested in % the register the % value
|
||||||
@ -167,7 +167,7 @@ namespace esvg {
|
|||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param[in] _config dimension configuration.
|
* @param[in] _config dimension configuration.
|
||||||
*/
|
*/
|
||||||
Dimension1D(const std::string& _config) :
|
Dimension1D(const etk::String& _config) :
|
||||||
m_data(0.0f),
|
m_data(0.0f),
|
||||||
m_type(esvg::distance_pixel) {
|
m_type(esvg::distance_pixel) {
|
||||||
set(_config);
|
set(_config);
|
||||||
@ -180,7 +180,7 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief string cast :
|
* @brief string cast :
|
||||||
*/
|
*/
|
||||||
operator std::string() const;
|
operator etk::String() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current dimention.
|
* @brief get the current dimention.
|
||||||
@ -208,7 +208,7 @@ namespace esvg {
|
|||||||
* @brief set the current dimention in requested type
|
* @brief set the current dimention in requested type
|
||||||
* @param[in] _config dimension configuration.
|
* @param[in] _config dimension configuration.
|
||||||
*/
|
*/
|
||||||
void set(std::string _config);
|
void set(etk::String _config);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief get the current dimention in pixel
|
* @brief get the current dimention in pixel
|
||||||
@ -247,6 +247,6 @@ namespace esvg {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::ostream& operator <<(std::ostream& _os, const esvg::Dimension1D& _obj);
|
etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension1D& _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ bool esvg::Ellipse::parseXML(const exml::Element& _element, mat2x3& _parentTrans
|
|||||||
m_c.setValue(0,0);
|
m_c.setValue(0,0);
|
||||||
m_r.setValue(0,0);
|
m_r.setValue(0,0);
|
||||||
|
|
||||||
std::string content = _element.attributes["cx"];
|
etk::String content = _element.attributes["cx"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_c.setX(parseLength(content));
|
m_c.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Ellipse::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Ellipse::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -162,11 +162,11 @@ void esvg::Ellipse::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -85,10 +85,10 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
|
|||||||
elementParser.reset();
|
elementParser.reset();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_sizeMax.setValue(std::max(_sizeMax.x(), tmpPos.x()),
|
_sizeMax.setValue(etk::max(_sizeMax.x(), tmpPos.x()),
|
||||||
std::max(_sizeMax.y(), tmpPos.y()));
|
etk::max(_sizeMax.y(), tmpPos.y()));
|
||||||
// add element in the system
|
// add element in the system
|
||||||
m_subElementList.push_back(elementParser);
|
m_subElementList.pushBack(elementParser);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Group::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Group::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <esvg/Base.hpp>
|
#include <esvg/Base.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Group : public esvg::Base {
|
class Group : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub elements ...
|
etk::Vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub elements ...
|
||||||
public:
|
public:
|
||||||
Group(PaintState _parentPaintState);
|
Group(PaintState _parentPaintState);
|
||||||
~Group();
|
~Group();
|
||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t spacing) override;
|
void display(int32_t spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -30,7 +30,7 @@ bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
std::string content = _element.attributes["x1"];
|
etk::String content = _element.attributes["x1"];
|
||||||
if (content.size() != 0) {
|
if (content.size() != 0) {
|
||||||
m_startPos.setX(parseLength(content));
|
m_startPos.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -46,8 +46,8 @@ bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
|
|||||||
if (content.size() != 0) {
|
if (content.size() != 0) {
|
||||||
m_stopPos.setY(parseLength(content));
|
m_stopPos.setY(parseLength(content));
|
||||||
}
|
}
|
||||||
_sizeMax.setValue(std::max(m_startPos.x(), m_stopPos.x()),
|
_sizeMax.setValue(etk::max(m_startPos.x(), m_stopPos.x()),
|
||||||
std::max(m_startPos.y(), m_stopPos.y()));
|
etk::max(m_startPos.y(), m_stopPos.y()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Line::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Line::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -129,11 +129,11 @@ void esvg::Line::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -41,8 +41,8 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
std::string contentX = _element.attributes["x1"];
|
etk::String contentX = _element.attributes["x1"];
|
||||||
std::string contentY = _element.attributes["y1"];
|
etk::String contentY = _element.attributes["y1"];
|
||||||
if ( contentX != ""
|
if ( contentX != ""
|
||||||
&& contentY != "") {
|
&& contentY != "") {
|
||||||
m_pos1.set(contentX, contentY);
|
m_pos1.set(contentX, contentY);
|
||||||
@ -78,7 +78,7 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
// note: xlink:href is incompatible with subNode "stop"
|
// note: xlink:href is incompatible with subNode "stop"
|
||||||
m_href = _element.attributes["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 = etk::String(m_href.begin()+1, m_href.end());
|
||||||
}
|
}
|
||||||
// parse all sub node :
|
// parse all sub node :
|
||||||
for(const auto it : _element.nodes) {
|
for(const auto it : _element.nodes) {
|
||||||
@ -90,9 +90,9 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
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.attributes["offset"];
|
etk::String content = child.attributes["offset"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
std::pair<float, enum esvg::distance> tmp = parseLength2(content);
|
etk::Pair<float, enum esvg::distance> tmp = parseLength2(content);
|
||||||
if (tmp.second == esvg::distance_pixel) {
|
if (tmp.second == esvg::distance_pixel) {
|
||||||
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
|
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
|
||||||
offset = tmp.first*100.0f;
|
offset = tmp.first*100.0f;
|
||||||
@ -110,11 +110,11 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
content = child.attributes["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 = etk::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.pushBack(etk::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]");
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ const esvg::Dimension& esvg::LinearGradient::getPosition2() {
|
|||||||
return m_pos2;
|
return m_pos2;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::pair<float, etk::Color<float,4>>>& esvg::LinearGradient::getColors(esvg::Document* _document) {
|
const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& esvg::LinearGradient::getColors(esvg::Document* _document) {
|
||||||
if (m_href == "") {
|
if (m_href == "") {
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ namespace esvg {
|
|||||||
enum gradientUnits m_unit;
|
enum gradientUnits m_unit;
|
||||||
enum spreadMethod m_spread;
|
enum spreadMethod m_spread;
|
||||||
private:
|
private:
|
||||||
std::string m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
|
etk::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
|
||||||
std::vector<std::pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
|
etk::Vector<etk::Pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
|
||||||
public:
|
public:
|
||||||
LinearGradient(PaintState _parentPaintState);
|
LinearGradient(PaintState _parentPaintState);
|
||||||
~LinearGradient();
|
~LinearGradient();
|
||||||
@ -30,7 +30,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
const esvg::Dimension& getPosition1();
|
const esvg::Dimension& getPosition1();
|
||||||
const esvg::Dimension& getPosition2();
|
const esvg::Dimension& getPosition2();
|
||||||
const std::vector<std::pair<float, etk::Color<float,4>>>& getColors(esvg::Document* _document);
|
const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& getColors(esvg::Document* _document);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ esvg::Path::~Path() {
|
|||||||
|
|
||||||
|
|
||||||
// return the next char position ... (after 'X' or NULL)
|
// return the next char position ... (after 'X' or NULL)
|
||||||
const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _outputList) {
|
const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _outputList) {
|
||||||
if (*_input == '\0') {
|
if (*_input == '\0') {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _out
|
|||||||
while( sscanf(&_input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|
while( sscanf(&_input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|
||||||
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
|
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
|
||||||
ESVG_VERBOSE("Find element : " << element);
|
ESVG_VERBOSE("Find element : " << element);
|
||||||
_outputList.push_back(element);
|
_outputList.pushBack(element);
|
||||||
iii += nbElementRead;
|
iii += nbElementRead;
|
||||||
}
|
}
|
||||||
outputPointer = &_input[iii];
|
outputPointer = &_input[iii];
|
||||||
@ -56,8 +56,8 @@ const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _out
|
|||||||
//outputPointer++;
|
//outputPointer++;
|
||||||
return outputPointer;
|
return outputPointer;
|
||||||
}
|
}
|
||||||
std::string cleanBadSpaces(const std::string& _input) {
|
etk::String cleanBadSpaces(const etk::String& _input) {
|
||||||
std::string out;
|
etk::String out;
|
||||||
bool haveSpace = false;
|
bool haveSpace = false;
|
||||||
for (auto &it : _input) {
|
for (auto &it : _input) {
|
||||||
if ( it == ' '
|
if ( it == ' '
|
||||||
@ -87,7 +87,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
|
|||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
|
|
||||||
std::string elementXML1 = _element.attributes["d"];
|
etk::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;
|
||||||
@ -95,7 +95,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
|
|||||||
ESVG_VERBOSE("Parse Path : \"" << elementXML1 << "\"");
|
ESVG_VERBOSE("Parse Path : \"" << elementXML1 << "\"");
|
||||||
|
|
||||||
char command;
|
char command;
|
||||||
std::vector<float> listDot;
|
etk::Vector<float> listDot;
|
||||||
elementXML1 = cleanBadSpaces(elementXML1);
|
elementXML1 = cleanBadSpaces(elementXML1);
|
||||||
const char* elementXML = elementXML1.c_str();
|
const char* elementXML = elementXML1.c_str();
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Path::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Path::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -339,11 +339,11 @@ void esvg::Path::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = m_listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = m_listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -31,7 +31,7 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
|
|||||||
|
|
||||||
ESVG_VERBOSE("parsed P2. trans: " << m_transformMatrix);
|
ESVG_VERBOSE("parsed P2. trans: " << m_transformMatrix);
|
||||||
|
|
||||||
const std::string sss1 = _element.attributes["points"];
|
const etk::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;
|
||||||
@ -43,10 +43,10 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
|
|||||||
vec2 pos(0,0);
|
vec2 pos(0,0);
|
||||||
int32_t n;
|
int32_t n;
|
||||||
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
||||||
m_listPoint.push_back(pos);
|
m_listPoint.pushBack(pos);
|
||||||
sss += n;
|
sss += n;
|
||||||
_sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
|
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
|
||||||
std::max(_sizeMax.y(), pos.y()));
|
etk::max(_sizeMax.y(), pos.y()));
|
||||||
if(sss[0] == ' ' || sss[0] == ',') {
|
if(sss[0] == ' ' || sss[0] == ',') {
|
||||||
sss++;
|
sss++;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Polygon::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Polygon::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -143,11 +143,11 @@ void esvg::Polygon::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <esvg/Base.hpp>
|
#include <esvg/Base.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
/*
|
/*
|
||||||
@ -17,7 +17,7 @@ namespace esvg {
|
|||||||
*/
|
*/
|
||||||
class Polygon : public esvg::Base {
|
class Polygon : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
std::vector<vec2 > m_listPoint; //!< list of all point of the polygone
|
etk::Vector<vec2 > m_listPoint; //!< list of all point of the polygone
|
||||||
//enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
|
//enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
|
||||||
public:
|
public:
|
||||||
Polygon(PaintState parentPaintState);
|
Polygon(PaintState parentPaintState);
|
||||||
@ -25,7 +25,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -29,7 +29,7 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
std::string sss1 = _element.attributes["points"];
|
etk::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;
|
||||||
@ -41,9 +41,9 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
|
|||||||
vec2 pos;
|
vec2 pos;
|
||||||
int32_t n;
|
int32_t n;
|
||||||
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
||||||
m_listPoint.push_back(pos);
|
m_listPoint.pushBack(pos);
|
||||||
_sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
|
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
|
||||||
std::max(_sizeMax.y(), pos.y()));
|
etk::max(_sizeMax.y(), pos.y()));
|
||||||
sss += n;
|
sss += n;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@ -127,7 +127,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Polyline::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Polyline::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -140,10 +140,10 @@ void esvg::Polyline::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <esvg/Base.hpp>
|
#include <esvg/Base.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Polyline : public esvg::Base {
|
class Polyline : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
std::vector<vec2 > m_listPoint; //!< list of all point of the polyline
|
etk::Vector<vec2 > m_listPoint; //!< list of all point of the polyline
|
||||||
public:
|
public:
|
||||||
Polyline(PaintState _parentPaintState);
|
Polyline(PaintState _parentPaintState);
|
||||||
~Polyline();
|
~Polyline();
|
||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -42,8 +42,8 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
std::string contentX = _element.attributes["cx"];
|
etk::String contentX = _element.attributes["cx"];
|
||||||
std::string contentY = _element.attributes["cy"];
|
etk::String contentY = _element.attributes["cy"];
|
||||||
if ( contentX != ""
|
if ( contentX != ""
|
||||||
&& contentY != "") {
|
&& contentY != "") {
|
||||||
m_center.set(contentX, contentY);
|
m_center.set(contentX, contentY);
|
||||||
@ -83,7 +83,7 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
// note: xlink:href is incompatible with subNode "stop"
|
// note: xlink:href is incompatible with subNode "stop"
|
||||||
m_href = _element.attributes["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 = etk::String(m_href.begin()+1, m_href.end());
|
||||||
}
|
}
|
||||||
// parse all sub node :
|
// parse all sub node :
|
||||||
for(auto it : _element.nodes) {
|
for(auto it : _element.nodes) {
|
||||||
@ -95,9 +95,9 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
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.attributes["offset"];
|
etk::String content = child.attributes["offset"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
std::pair<float, enum esvg::distance> tmp = parseLength2(content);
|
etk::Pair<float, enum esvg::distance> tmp = parseLength2(content);
|
||||||
if (tmp.second == esvg::distance_pixel) {
|
if (tmp.second == esvg::distance_pixel) {
|
||||||
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
|
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
|
||||||
offset = tmp.first*100.0f;
|
offset = tmp.first*100.0f;
|
||||||
@ -115,11 +115,11 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
|
|||||||
content = child.attributes["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 = etk::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.pushBack(etk::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]");
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ const esvg::Dimension1D& esvg::RadialGradient::getRadius() {
|
|||||||
return m_radius;
|
return m_radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::pair<float, etk::Color<float,4>>>& esvg::RadialGradient::getColors(esvg::Document* _document) {
|
const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& esvg::RadialGradient::getColors(esvg::Document* _document) {
|
||||||
if (m_href == "") {
|
if (m_href == "") {
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ namespace esvg {
|
|||||||
enum gradientUnits m_unit;
|
enum gradientUnits m_unit;
|
||||||
enum spreadMethod m_spread;
|
enum spreadMethod m_spread;
|
||||||
private:
|
private:
|
||||||
std::string m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
|
etk::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
|
||||||
std::vector<std::pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
|
etk::Vector<etk::Pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
|
||||||
public:
|
public:
|
||||||
RadialGradient(PaintState _parentPaintState);
|
RadialGradient(PaintState _parentPaintState);
|
||||||
~RadialGradient();
|
~RadialGradient();
|
||||||
@ -32,7 +32,7 @@ namespace esvg {
|
|||||||
const esvg::Dimension& getCenter();
|
const esvg::Dimension& getCenter();
|
||||||
const esvg::Dimension& getFocal();
|
const esvg::Dimension& getFocal();
|
||||||
const esvg::Dimension1D& getRadius();
|
const esvg::Dimension1D& getRadius();
|
||||||
const std::vector<std::pair<float, etk::Color<float,4>>>& getColors(esvg::Document* _document);
|
const etk::Vector<etk::Pair<float, etk::Color<float,4>>>& getColors(esvg::Document* _document);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ bool esvg::Rectangle::parseXML(const exml::Element& _element, mat2x3& _parentTra
|
|||||||
|
|
||||||
parsePosition(_element, m_position, m_size);
|
parsePosition(_element, m_position, m_size);
|
||||||
|
|
||||||
std::string content = _element.attributes["rx"];
|
etk::String content = _element.attributes["rx"];
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_roundedCorner.setX(parseLength(content));
|
m_roundedCorner.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Rectangle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Rectangle::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
@ -157,10 +157,10 @@ void esvg::Rectangle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
|||||||
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
|
||||||
listPoints.applyMatrix(mtx);
|
listPoints.applyMatrix(mtx);
|
||||||
for (auto &it : listPoints.m_data) {
|
for (auto &it : listPoints.m_data) {
|
||||||
std::vector<vec2> listPoint;
|
etk::Vector<vec2> listPoint;
|
||||||
for (auto &itDot : it) {
|
for (auto &itDot : it) {
|
||||||
listPoint.push_back(itDot.m_pos);
|
listPoint.pushBack(itDot.m_pos);
|
||||||
}
|
}
|
||||||
_out.push_back(listPoint);
|
_out.pushBack(listPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace esvg {
|
|||||||
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
|
||||||
void display(int32_t _spacing) override;
|
void display(int32_t _spacing) override;
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -58,11 +58,11 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
|||||||
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
|
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
|
||||||
float _opacity) {
|
float _opacity) {
|
||||||
if (_colorFill != nullptr) {
|
if (_colorFill != nullptr) {
|
||||||
//_colorFill->setViewPort(std::pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
//_colorFill->setViewPort(etk::Pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
||||||
_colorFill->generate(m_document);
|
_colorFill->generate(m_document);
|
||||||
}
|
}
|
||||||
if (_colorStroke != nullptr) {
|
if (_colorStroke != nullptr) {
|
||||||
//_colorStroke->setViewPort(std::pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
//_colorStroke->setViewPort(etk::Pair<vec2, vec2>(vec2(0,0), vec2(sizeX, sizeY)));
|
||||||
_colorStroke->generate(m_document);
|
_colorStroke->generate(m_document);
|
||||||
}
|
}
|
||||||
// all together
|
// all together
|
||||||
@ -123,7 +123,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
|||||||
false);
|
false);
|
||||||
/*
|
/*
|
||||||
mat2x3 m_matrix;
|
mat2x3 m_matrix;
|
||||||
std::pair<vec2, vec2> m_viewPort;
|
etk::Pair<vec2, vec2> m_viewPort;
|
||||||
vec2 m_pos1;
|
vec2 m_pos1;
|
||||||
vec2 m_pos2;
|
vec2 m_pos2;
|
||||||
*/
|
*/
|
||||||
@ -141,25 +141,25 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
|||||||
// for each lines:
|
// for each lines:
|
||||||
for (int32_t yyy=0; yyy<dynamicSize.y(); ++yyy) {
|
for (int32_t yyy=0; yyy<dynamicSize.y(); ++yyy) {
|
||||||
// Reduce the number of lines in the subsampling parsing:
|
// Reduce the number of lines in the subsampling parsing:
|
||||||
std::vector<esvg::render::Segment> availlableSegmentPixel;
|
etk::Vector<esvg::render::Segment> availlableSegmentPixel;
|
||||||
for (auto &it : _listSegment.m_data) {
|
for (auto &it : _listSegment.m_data) {
|
||||||
if ( it.p0.y() * m_factor <= float(yyy+1)
|
if ( it.p0.y() * m_factor <= float(yyy+1)
|
||||||
&& it.p1.y() * m_factor >= float(yyy)) {
|
&& it.p1.y() * m_factor >= float(yyy)) {
|
||||||
availlableSegmentPixel.push_back(it);
|
availlableSegmentPixel.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//find all the segment that cross the middle of the line of the center of the pixel line:
|
//find all the segment that cross the middle of the line of the center of the pixel line:
|
||||||
float subSamplingCenterPos = yyy + 0.5f;
|
float subSamplingCenterPos = yyy + 0.5f;
|
||||||
std::vector<esvg::render::Segment> availlableSegment;
|
etk::Vector<esvg::render::Segment> availlableSegment;
|
||||||
// find in the subList ...
|
// find in the subList ...
|
||||||
for (auto &it : availlableSegmentPixel) {
|
for (auto &it : availlableSegmentPixel) {
|
||||||
if ( it.p0.y() * m_factor <= subSamplingCenterPos
|
if ( it.p0.y() * m_factor <= subSamplingCenterPos
|
||||||
&& it.p1.y() * m_factor >= subSamplingCenterPos ) {
|
&& it.p1.y() * m_factor >= subSamplingCenterPos ) {
|
||||||
availlableSegment.push_back(it);
|
availlableSegment.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// x position, angle
|
// x position, angle
|
||||||
std::vector<std::pair<float, float>> listPosition;
|
etk::Vector<etk::Pair<float, float>> listPosition;
|
||||||
for (auto &it : availlableSegment) {
|
for (auto &it : availlableSegment) {
|
||||||
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
|
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
|
||||||
// x = coefficent*y+bbb;
|
// x = coefficent*y+bbb;
|
||||||
@ -181,29 +181,29 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
|||||||
// for each colomn:
|
// for each colomn:
|
||||||
for (int32_t xxx=0; xxx<dynamicSize.x(); ++xxx) {
|
for (int32_t xxx=0; xxx<dynamicSize.x(); ++xxx) {
|
||||||
// Reduce the number of lines in the subsampling parsing:
|
// Reduce the number of lines in the subsampling parsing:
|
||||||
std::vector<esvg::render::Segment> availlableSegmentPixel;
|
etk::Vector<esvg::render::Segment> availlableSegmentPixel;
|
||||||
for (auto &it : _listSegment.m_data) {
|
for (auto &it : _listSegment.m_data) {
|
||||||
if ( ( it.p0.x() * m_factor <= float(xxx+1)
|
if ( ( it.p0.x() * m_factor <= float(xxx+1)
|
||||||
&& it.p1.x() * m_factor >= float(xxx) )
|
&& it.p1.x() * m_factor >= float(xxx) )
|
||||||
|| ( it.p0.x() * m_factor >= float(xxx+1)
|
|| ( it.p0.x() * m_factor >= float(xxx+1)
|
||||||
&& it.p1.x() * m_factor <= float(xxx) ) ) {
|
&& it.p1.x() * m_factor <= float(xxx) ) ) {
|
||||||
availlableSegmentPixel.push_back(it);
|
availlableSegmentPixel.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//find all the segment that cross the middle of the line of the center of the pixel line:
|
//find all the segment that cross the middle of the line of the center of the pixel line:
|
||||||
float subSamplingCenterPos = xxx + 0.5f;
|
float subSamplingCenterPos = xxx + 0.5f;
|
||||||
std::vector<esvg::render::Segment> availlableSegment;
|
etk::Vector<esvg::render::Segment> availlableSegment;
|
||||||
// find in the subList ...
|
// find in the subList ...
|
||||||
for (auto &it : availlableSegmentPixel) {
|
for (auto &it : availlableSegmentPixel) {
|
||||||
if ( ( it.p0.x() * m_factor <= subSamplingCenterPos
|
if ( ( it.p0.x() * m_factor <= subSamplingCenterPos
|
||||||
&& it.p1.x() * m_factor >= subSamplingCenterPos)
|
&& it.p1.x() * m_factor >= subSamplingCenterPos)
|
||||||
|| ( it.p0.x() * m_factor >= subSamplingCenterPos
|
|| ( it.p0.x() * m_factor >= subSamplingCenterPos
|
||||||
&& it.p1.x() * m_factor <= subSamplingCenterPos) ) {
|
&& it.p1.x() * m_factor <= subSamplingCenterPos) ) {
|
||||||
availlableSegment.push_back(it);
|
availlableSegment.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// x position, angle
|
// x position, angle
|
||||||
std::vector<std::pair<float, float>> listPosition;
|
etk::Vector<etk::Pair<float, float>> listPosition;
|
||||||
for (auto &it : availlableSegment) {
|
for (auto &it : availlableSegment) {
|
||||||
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
|
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
|
||||||
// x = coefficent*y+bbb;
|
// x = coefficent*y+bbb;
|
||||||
@ -229,7 +229,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void esvg::Renderer::writePPM(const std::string& _fileName) {
|
void esvg::Renderer::writePPM(const etk::String& _fileName) {
|
||||||
if (m_buffer.size() == 0) {
|
if (m_buffer.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ extern "C" {
|
|||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
void esvg::Renderer::writeBMP(const std::string& _fileName) {
|
void esvg::Renderer::writeBMP(const etk::String& _fileName) {
|
||||||
if (m_buffer.size() == 0) {
|
if (m_buffer.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ const ivec2& esvg::Renderer::getSize() const {
|
|||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<etk::Color<float,4>> esvg::Renderer::getData() {
|
etk::Vector<etk::Color<float,4>> esvg::Renderer::getData() {
|
||||||
return m_buffer;
|
return m_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ std::vector<etk::Color<float,4>> esvg::Renderer::getData() {
|
|||||||
|
|
||||||
|
|
||||||
void esvg::Renderer::setInterpolationRecurtionMax(int32_t _value) {
|
void esvg::Renderer::setInterpolationRecurtionMax(int32_t _value) {
|
||||||
m_interpolationRecurtionMax = std::avg(1, _value, 200);
|
m_interpolationRecurtionMax = etk::avg(1, _value, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t esvg::Renderer::getInterpolationRecurtionMax() const {
|
int32_t esvg::Renderer::getInterpolationRecurtionMax() const {
|
||||||
@ -401,7 +401,7 @@ int32_t esvg::Renderer::getInterpolationRecurtionMax() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Renderer::setInterpolationThreshold(float _value) {
|
void esvg::Renderer::setInterpolationThreshold(float _value) {
|
||||||
m_interpolationThreshold = std::avg(0.0f, _value, 20000.0f);
|
m_interpolationThreshold = etk::avg(0.0f, _value, 20000.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float esvg::Renderer::getInterpolationThreshold() const {
|
float esvg::Renderer::getInterpolationThreshold() const {
|
||||||
@ -409,7 +409,7 @@ float esvg::Renderer::getInterpolationThreshold() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void esvg::Renderer::setNumberSubScanLine(int32_t _value) {
|
void esvg::Renderer::setNumberSubScanLine(int32_t _value) {
|
||||||
m_nbSubScanLine = std::avg(1, _value, 200);
|
m_nbSubScanLine = etk::avg(1, _value, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t esvg::Renderer::getNumberSubScanLine() const {
|
int32_t esvg::Renderer::getNumberSubScanLine() const {
|
||||||
|
@ -28,9 +28,9 @@ namespace esvg {
|
|||||||
void setSize(const ivec2& _size);
|
void setSize(const ivec2& _size);
|
||||||
const ivec2& getSize() const;
|
const ivec2& getSize() const;
|
||||||
protected:
|
protected:
|
||||||
std::vector<etk::Color<float,4>> m_buffer;
|
etk::Vector<etk::Color<float,4>> m_buffer;
|
||||||
public:
|
public:
|
||||||
std::vector<etk::Color<float,4>> getData();
|
etk::Vector<etk::Color<float,4>> getData();
|
||||||
protected:
|
protected:
|
||||||
int32_t m_interpolationRecurtionMax;
|
int32_t m_interpolationRecurtionMax;
|
||||||
public:
|
public:
|
||||||
@ -47,8 +47,8 @@ namespace esvg {
|
|||||||
void setNumberSubScanLine(int32_t _value);
|
void setNumberSubScanLine(int32_t _value);
|
||||||
int32_t getNumberSubScanLine() const;
|
int32_t getNumberSubScanLine() const;
|
||||||
public:
|
public:
|
||||||
void writePPM(const std::string& _fileName);
|
void writePPM(const etk::String& _fileName);
|
||||||
void writeBMP(const std::string& _fileName);
|
void writeBMP(const etk::String& _fileName);
|
||||||
protected:
|
protected:
|
||||||
etk::Color<float,4> mergeColor(etk::Color<float,4> _base, etk::Color<float,4> _integration);
|
etk::Color<float,4> mergeColor(etk::Color<float,4> _base, etk::Color<float,4> _integration);
|
||||||
public:
|
public:
|
||||||
@ -59,7 +59,7 @@ namespace esvg {
|
|||||||
float _opacity);
|
float _opacity);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void addDebugSegment(const esvg::render::SegmentList& _listSegment);
|
void addDebugSegment(const esvg::render::SegmentList& _listSegment);
|
||||||
void addDebug(const std::vector<std::pair<vec2,vec2>>& _info);
|
void addDebug(const etk::Vector<etk::Pair<vec2,vec2>>& _info);
|
||||||
#endif
|
#endif
|
||||||
protected:
|
protected:
|
||||||
esvg::Document* m_document;
|
esvg::Document* m_document;
|
||||||
|
@ -13,7 +13,7 @@ static const char* values[] = {
|
|||||||
"square"
|
"square"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::cap _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::cap _obj) {
|
||||||
_os << values[_obj];
|
_os << values[_obj];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::cap _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::cap _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ void esvg::Document::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FOR TEST only ...
|
// FOR TEST only ...
|
||||||
void esvg::Document::generateAnImage(const std::string& _fileName, bool _visualDebug) {
|
void esvg::Document::generateAnImage(const etk::String& _fileName, bool _visualDebug) {
|
||||||
generateAnImage(m_size, _fileName, _visualDebug);
|
generateAnImage(m_size, _fileName, _visualDebug);
|
||||||
}
|
}
|
||||||
void esvg::Document::generateAnImage(const ivec2& _size, const std::string& _fileName, bool _visualDebug) {
|
void esvg::Document::generateAnImage(const ivec2& _size, const etk::String& _fileName, bool _visualDebug) {
|
||||||
ivec2 sizeRender = _size;
|
ivec2 sizeRender = _size;
|
||||||
if (sizeRender.x() <= 0) {
|
if (sizeRender.x() <= 0) {
|
||||||
sizeRender.setX(m_size.x());
|
sizeRender.setX(m_size.x());
|
||||||
@ -88,7 +88,7 @@ void esvg::Document::generateAnImage(const ivec2& _size, const std::string& _fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<etk::Color<float,4>> esvg::Document::renderImageFloatRGBA(ivec2& _size) {
|
etk::Vector<etk::Color<float,4>> esvg::Document::renderImageFloatRGBA(ivec2& _size) {
|
||||||
if (_size.x() <= 0) {
|
if (_size.x() <= 0) {
|
||||||
_size.setX(m_size.x());
|
_size.setX(m_size.x());
|
||||||
}
|
}
|
||||||
@ -106,10 +106,10 @@ std::vector<etk::Color<float,4>> esvg::Document::renderImageFloatRGBA(ivec2& _si
|
|||||||
return renderedElement->getData();
|
return renderedElement->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _size) {
|
etk::Vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _size) {
|
||||||
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
||||||
// Reduce scope:
|
// Reduce scope:
|
||||||
std::vector<etk::Color<float,3>> out;
|
etk::Vector<etk::Color<float,3>> out;
|
||||||
out.resize(data.size());
|
out.resize(data.size());
|
||||||
for (size_t iii=0; iii<data.size(); ++iii) {
|
for (size_t iii=0; iii<data.size(); ++iii) {
|
||||||
out[iii] = data[iii];
|
out[iii] = data[iii];
|
||||||
@ -117,10 +117,10 @@ std::vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _siz
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _size) {
|
etk::Vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _size) {
|
||||||
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
||||||
// Reduce scope:
|
// Reduce scope:
|
||||||
std::vector<etk::Color<uint8_t,4>> out;
|
etk::Vector<etk::Color<uint8_t,4>> out;
|
||||||
out.resize(data.size());
|
out.resize(data.size());
|
||||||
for (size_t iii=0; iii<data.size(); ++iii) {
|
for (size_t iii=0; iii<data.size(); ++iii) {
|
||||||
out[iii] = data[iii];
|
out[iii] = data[iii];
|
||||||
@ -128,10 +128,10 @@ std::vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _siz
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<etk::Color<uint8_t,3>> esvg::Document::renderImageU8RGB(ivec2& _size) {
|
etk::Vector<etk::Color<uint8_t,3>> esvg::Document::renderImageU8RGB(ivec2& _size) {
|
||||||
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
|
||||||
// Reduce scope:
|
// Reduce scope:
|
||||||
std::vector<etk::Color<uint8_t,3>> out;
|
etk::Vector<etk::Color<uint8_t,3>> out;
|
||||||
out.resize(data.size());
|
out.resize(data.size());
|
||||||
for (size_t iii=0; iii<data.size(); ++iii) {
|
for (size_t iii=0; iii<data.size(); ++iii) {
|
||||||
out[iii] = data[iii];
|
out[iii] = data[iii];
|
||||||
@ -148,7 +148,7 @@ void esvg::Document::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool esvg::Document::parse(const std::string& _data) {
|
bool esvg::Document::parse(const etk::String& _data) {
|
||||||
clear();
|
clear();
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
if (doc.parse(_data) == false) {
|
if (doc.parse(_data) == false) {
|
||||||
@ -172,11 +172,11 @@ bool esvg::Document::parse(const std::string& _data) {
|
|||||||
return m_loadOK;
|
return m_loadOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool esvg::Document::generate(std::string& _data) {
|
bool esvg::Document::generate(etk::String& _data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool esvg::Document::load(const std::string& _file) {
|
bool esvg::Document::load(const etk::String& _file) {
|
||||||
clear();
|
clear();
|
||||||
m_fileName = _file;
|
m_fileName = _file;
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
@ -201,7 +201,7 @@ bool esvg::Document::load(const std::string& _file) {
|
|||||||
return m_loadOK;
|
return m_loadOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool esvg::Document::store(const std::string& _file) {
|
bool esvg::Document::store(const etk::String& _file) {
|
||||||
ESVG_TODO("not implemented store in SVG...");
|
ESVG_TODO("not implemented store in SVG...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -215,11 +215,11 @@ bool esvg::Document::cleanStyleProperty(const exml::Element& _root) {
|
|||||||
}
|
}
|
||||||
// get attribute style:
|
// get attribute style:
|
||||||
if (child.attributes.exist("style") == true) {
|
if (child.attributes.exist("style") == true) {
|
||||||
std::string content = child.attributes["style"];
|
etk::String content = child.attributes["style"];
|
||||||
if (content.size() != 0) {
|
if (content.size() != 0) {
|
||||||
std::vector<std::string> listStyle = etk::split(content, ';');
|
etk::Vector<etk::String> listStyle = etk::split(content, ';');
|
||||||
for (auto &it : listStyle) {
|
for (auto &it : listStyle) {
|
||||||
std::vector<std::string> value = etk::split(it, ':');
|
etk::Vector<etk::String> value = etk::split(it, ':');
|
||||||
if (value.size() != 2) {
|
if (value.size() != 2) {
|
||||||
ESVG_ERROR("parsing style with a wrong patern : " << it << " missing ':'");
|
ESVG_ERROR("parsing style with a wrong patern : " << it << " missing ':'");
|
||||||
continue;
|
continue;
|
||||||
@ -333,9 +333,9 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
|
|||||||
}
|
}
|
||||||
// add element in the system
|
// add element in the system
|
||||||
if (_isReference == false) {
|
if (_isReference == false) {
|
||||||
m_subElementList.push_back(elementParser);
|
m_subElementList.pushBack(elementParser);
|
||||||
} else {
|
} else {
|
||||||
m_refList.push_back(elementParser);
|
m_refList.pushBack(elementParser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( m_size.x() == 0
|
if ( m_size.x() == 0
|
||||||
@ -352,7 +352,7 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const std::string& _name) {
|
ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const etk::String& _name) {
|
||||||
if (_name == "") {
|
if (_name == "") {
|
||||||
ESVG_ERROR("request a reference with no name ... ");
|
ESVG_ERROR("request a reference with no name ... ");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -369,8 +369,8 @@ ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const std::string& _
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::vector<vec2>> esvg::Document::getLines(vec2 _size) {
|
etk::Vector<etk::Vector<vec2>> esvg::Document::getLines(vec2 _size) {
|
||||||
std::vector<std::vector<vec2>> out;
|
etk::Vector<etk::Vector<vec2>> out;
|
||||||
if (_size.x() <= 0) {
|
if (_size.x() <= 0) {
|
||||||
_size.setX(m_size.x());
|
_size.setX(m_size.x());
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ std::vector<std::vector<vec2>> esvg::Document::getLines(vec2 _size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void esvg::Document::drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void esvg::Document::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <etk/math/Vector2D.hpp>
|
#include <etk/math/Vector2D.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/os/FSNode.hpp>
|
||||||
|
|
||||||
@ -18,12 +18,12 @@
|
|||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Document : public esvg::Base {
|
class Document : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
std::string m_fileName;
|
etk::String m_fileName;
|
||||||
bool m_loadOK;
|
bool m_loadOK;
|
||||||
std::string m_version;
|
etk::String m_version;
|
||||||
std::string m_title;
|
etk::String m_title;
|
||||||
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub-element list
|
etk::Vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub-element list
|
||||||
std::vector<ememory::SharedPtr<esvg::Base>> m_refList; //!< reference elements ...
|
etk::Vector<ememory::SharedPtr<esvg::Base>> m_refList; //!< reference elements ...
|
||||||
vec2 m_size;
|
vec2 m_size;
|
||||||
public:
|
public:
|
||||||
Document();
|
Document();
|
||||||
@ -35,28 +35,28 @@ namespace esvg {
|
|||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
* @return true : Parsing is OK
|
* @return true : Parsing is OK
|
||||||
*/
|
*/
|
||||||
bool parse(const std::string& _data);
|
bool parse(const etk::String& _data);
|
||||||
/**
|
/**
|
||||||
* @brief generate a string that contain the created SVG
|
* @brief generate a string that contain the created SVG
|
||||||
* @param[out] _data Data where the svg is stored
|
* @param[out] _data Data where the svg is stored
|
||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
* @return true : Parsing is OK
|
* @return true : Parsing is OK
|
||||||
*/
|
*/
|
||||||
bool generate(std::string& _data);
|
bool generate(etk::String& _data);
|
||||||
/**
|
/**
|
||||||
* @brief Load the file that might contain the svg
|
* @brief Load the file that might contain the svg
|
||||||
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
|
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
|
||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
* @return true : Parsing is OK
|
* @return true : Parsing is OK
|
||||||
*/
|
*/
|
||||||
bool load(const std::string& _file);
|
bool load(const etk::String& _file);
|
||||||
/**
|
/**
|
||||||
* @brief Store the SVG in the file
|
* @brief Store the SVG in the file
|
||||||
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
|
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
|
||||||
* @return false : An error occured
|
* @return false : An error occured
|
||||||
* @return true : Parsing is OK
|
* @return true : Parsing is OK
|
||||||
*/
|
*/
|
||||||
bool store(const std::string& _file);
|
bool store(const etk::String& _file);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief change all style in a xml atribute
|
* @brief change all style in a xml atribute
|
||||||
@ -72,30 +72,30 @@ namespace esvg {
|
|||||||
*/
|
*/
|
||||||
void displayDebug();
|
void displayDebug();
|
||||||
// TODO: remove this fucntion : use generic function ...
|
// TODO: remove this fucntion : use generic function ...
|
||||||
void generateAnImage(const std::string& _fileName, bool _visualDebug=false);
|
void generateAnImage(const etk::String& _fileName, bool _visualDebug=false);
|
||||||
void generateAnImage(const ivec2& _size, const std::string& _fileName, bool _visualDebug=false);
|
void generateAnImage(const ivec2& _size, const etk::String& _fileName, bool _visualDebug=false);
|
||||||
/**
|
/**
|
||||||
* @brief Generate Image in a specific format.
|
* @brief Generate Image in a specific format.
|
||||||
* @param[in,out] _size Size expected of the rendered image (value <=0 if it need to be automatic.) return the size generate
|
* @param[in,out] _size Size expected of the rendered image (value <=0 if it need to be automatic.) return the size generate
|
||||||
* @return Vector of the data used to display (simple vector: generic to transmit)
|
* @return Vector of the data used to display (simple vector: generic to transmit)
|
||||||
*/
|
*/
|
||||||
std::vector<etk::Color<float,4>> renderImageFloatRGBA(ivec2& _size);
|
etk::Vector<etk::Color<float,4>> renderImageFloatRGBA(ivec2& _size);
|
||||||
//! @previous
|
//! @previous
|
||||||
std::vector<etk::Color<float,3>> renderImageFloatRGB(ivec2& _size);
|
etk::Vector<etk::Color<float,3>> renderImageFloatRGB(ivec2& _size);
|
||||||
//! @previous
|
//! @previous
|
||||||
std::vector<etk::Color<uint8_t,4>> renderImageU8RGBA(ivec2& _size);
|
etk::Vector<etk::Color<uint8_t,4>> renderImageU8RGBA(ivec2& _size);
|
||||||
//! @previous
|
//! @previous
|
||||||
std::vector<etk::Color<uint8_t,3>> renderImageU8RGB(ivec2& _size);
|
etk::Vector<etk::Color<uint8_t,3>> renderImageU8RGB(ivec2& _size);
|
||||||
std::vector<std::vector<vec2>> getLines(vec2 _size=vec2(256,256));
|
etk::Vector<etk::Vector<vec2>> getLines(vec2 _size=vec2(256,256));
|
||||||
protected:
|
protected:
|
||||||
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level=0) override;
|
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level=0) override;
|
||||||
public:
|
public:
|
||||||
vec2 getDefinedSize() {
|
vec2 getDefinedSize() {
|
||||||
return m_size;
|
return m_size;
|
||||||
};
|
};
|
||||||
ememory::SharedPtr<esvg::Base> getReference(const std::string& _name);
|
ememory::SharedPtr<esvg::Base> getReference(const etk::String& _name);
|
||||||
protected:
|
protected:
|
||||||
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
|
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
mat2x3& _basicTrans,
|
mat2x3& _basicTrans,
|
||||||
|
@ -12,7 +12,7 @@ static const char* values[] = {
|
|||||||
"objectBoundingBox"
|
"objectBoundingBox"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::gradientUnits _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::gradientUnits _obj) {
|
||||||
_os << values[_obj];
|
_os << values[_obj];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,5 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::gradientUnits _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::gradientUnits _obj);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ static const char* values[] = {
|
|||||||
"bevel"
|
"bevel"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::join _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::join _obj) {
|
||||||
_os << values[_obj];
|
_os << values[_obj];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::join _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::join _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <esvg/RadialGradient.hpp>
|
#include <esvg/RadialGradient.hpp>
|
||||||
#include <esvg/esvg.hpp>
|
#include <esvg/esvg.hpp>
|
||||||
|
|
||||||
esvg::render::DynamicColorSpecial::DynamicColorSpecial(const std::string& _link, const mat2x3& _mtx) :
|
esvg::render::DynamicColorSpecial::DynamicColorSpecial(const etk::String& _link, const mat2x3& _mtx) :
|
||||||
m_linear(true),
|
m_linear(true),
|
||||||
m_colorName(_link),
|
m_colorName(_link),
|
||||||
m_matrix(_mtx),
|
m_matrix(_mtx),
|
||||||
@ -18,7 +18,7 @@ esvg::render::DynamicColorSpecial::DynamicColorSpecial(const std::string& _link,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::DynamicColorSpecial::setViewPort(const std::pair<vec2, vec2>& _viewPort) {
|
void esvg::render::DynamicColorSpecial::setViewPort(const etk::Pair<vec2, vec2>& _viewPort) {
|
||||||
m_viewPort = _viewPort;
|
m_viewPort = _viewPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec
|
|||||||
}
|
}
|
||||||
return etk::color::green;
|
return etk::color::green;
|
||||||
}
|
}
|
||||||
static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
|
static etk::Pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
|
||||||
const vec2& _pos2,
|
const vec2& _pos2,
|
||||||
const vec2& _center = vec2(0.0f, 0.0f),
|
const vec2& _center = vec2(0.0f, 0.0f),
|
||||||
float _radius = 1.0f) {
|
float _radius = 1.0f) {
|
||||||
@ -180,10 +180,10 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
|
|||||||
|
|
||||||
float distToCenter = (midpt - _center).length2();
|
float distToCenter = (midpt - _center).length2();
|
||||||
if (distToCenter > _radius * _radius) {
|
if (distToCenter > _radius * _radius) {
|
||||||
return std::pair<vec2,vec2>(vec2(0.0,0.0), vec2(0.0,0.0));
|
return etk::Pair<vec2,vec2>(vec2(0.0,0.0), vec2(0.0,0.0));
|
||||||
}
|
}
|
||||||
if (distToCenter == _radius * _radius) {
|
if (distToCenter == _radius * _radius) {
|
||||||
return std::pair<vec2,vec2>(midpt, midpt);
|
return etk::Pair<vec2,vec2>(midpt, midpt);
|
||||||
}
|
}
|
||||||
float distToIntersection;
|
float distToIntersection;
|
||||||
if (distToCenter == 0.0f) {
|
if (distToCenter == 0.0f) {
|
||||||
@ -200,7 +200,7 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
|
|||||||
// normalize...
|
// normalize...
|
||||||
v1.safeNormalize();
|
v1.safeNormalize();
|
||||||
v1 *= distToIntersection;
|
v1 *= distToIntersection;
|
||||||
return std::pair<vec2,vec2>(midpt + v1, midpt - v1);
|
return etk::Pair<vec2,vec2>(midpt + v1, midpt - v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec2& _pos) const {
|
etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec2& _pos) const {
|
||||||
@ -252,7 +252,7 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec
|
|||||||
if (focalCenter == currentPoint) {
|
if (focalCenter == currentPoint) {
|
||||||
ratio = 0.0f;
|
ratio = 0.0f;
|
||||||
} else {
|
} else {
|
||||||
std::pair<vec2,vec2> positions = intersectLineToCircle(focalCenter, currentPoint);
|
etk::Pair<vec2,vec2> positions = intersectLineToCircle(focalCenter, currentPoint);
|
||||||
float lenghtBase = (currentPoint - focalCenter).length();
|
float lenghtBase = (currentPoint - focalCenter).length();
|
||||||
float lenghtBorder1 = (positions.first - focalCenter).length();
|
float lenghtBorder1 = (positions.first - focalCenter).length();
|
||||||
float lenghtBorder2 = (positions.second - focalCenter).length();
|
float lenghtBorder2 = (positions.second - focalCenter).length();
|
||||||
@ -439,7 +439,7 @@ void esvg::render::DynamicColorSpecial::generate(esvg::Document* _document) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ememory::SharedPtr<esvg::render::DynamicColor> esvg::render::createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2x3& _mtx) {
|
ememory::SharedPtr<esvg::render::DynamicColor> esvg::render::createColor(etk::Pair<etk::Color<float,4>, etk::String> _color, const mat2x3& _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
|
||||||
&& _color.second == "") {
|
&& _color.second == "") {
|
||||||
|
@ -24,7 +24,7 @@ namespace esvg {
|
|||||||
virtual ~DynamicColor() {};
|
virtual ~DynamicColor() {};
|
||||||
virtual etk::Color<float,4> getColor(const ivec2& _pos) const = 0;
|
virtual etk::Color<float,4> getColor(const ivec2& _pos) const = 0;
|
||||||
virtual void generate(esvg::Document* _document) = 0;
|
virtual void generate(esvg::Document* _document) = 0;
|
||||||
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort) = 0;
|
virtual void setViewPort(const etk::Pair<vec2, vec2>& _viewPort) = 0;
|
||||||
};
|
};
|
||||||
class DynamicColorUni : public esvg::render::DynamicColor {
|
class DynamicColorUni : public esvg::render::DynamicColor {
|
||||||
public:
|
public:
|
||||||
@ -40,7 +40,7 @@ namespace esvg {
|
|||||||
virtual void generate(esvg::Document* _document) {
|
virtual void generate(esvg::Document* _document) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort) {
|
virtual void setViewPort(const etk::Pair<vec2, vec2>& _viewPort) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -49,9 +49,9 @@ namespace esvg {
|
|||||||
bool m_linear;
|
bool m_linear;
|
||||||
esvg::spreadMethod m_spread;
|
esvg::spreadMethod m_spread;
|
||||||
esvg::gradientUnits m_unit;
|
esvg::gradientUnits m_unit;
|
||||||
std::string m_colorName;
|
etk::String m_colorName;
|
||||||
mat2x3 m_matrix;
|
mat2x3 m_matrix;
|
||||||
std::pair<vec2, vec2> m_viewPort;
|
etk::Pair<vec2, vec2> m_viewPort;
|
||||||
vec2 m_pos1; // in radius ==> center
|
vec2 m_pos1; // in radius ==> center
|
||||||
vec2 m_pos2; // in radius ==> radius end position
|
vec2 m_pos2; // in radius ==> radius end position
|
||||||
vec2 m_focal; // Specific radius
|
vec2 m_focal; // Specific radius
|
||||||
@ -61,19 +61,19 @@ namespace esvg {
|
|||||||
float m_focalLength;
|
float m_focalLength;
|
||||||
bool m_clipOut;
|
bool m_clipOut;
|
||||||
bool m_centerIsFocal;
|
bool m_centerIsFocal;
|
||||||
std::vector<std::pair<float, etk::Color<float,4>>> m_data;
|
etk::Vector<etk::Pair<float, etk::Color<float,4>>> m_data;
|
||||||
public:
|
public:
|
||||||
DynamicColorSpecial(const std::string& _link, const mat2x3& _mtx);
|
DynamicColorSpecial(const etk::String& _link, const mat2x3& _mtx);
|
||||||
virtual etk::Color<float,4> getColor(const ivec2& _pos) const;
|
virtual etk::Color<float,4> getColor(const ivec2& _pos) const;
|
||||||
private:
|
private:
|
||||||
etk::Color<float,4> getColorLinear(const ivec2& _pos) const;
|
etk::Color<float,4> getColorLinear(const ivec2& _pos) const;
|
||||||
etk::Color<float,4> getColorRadial(const ivec2& _pos) const;
|
etk::Color<float,4> getColorRadial(const ivec2& _pos) const;
|
||||||
public:
|
public:
|
||||||
virtual void generate(esvg::Document* _document);
|
virtual void generate(esvg::Document* _document);
|
||||||
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort);
|
virtual void setViewPort(const etk::Pair<vec2, vec2>& _viewPort);
|
||||||
};
|
};
|
||||||
|
|
||||||
ememory::SharedPtr<DynamicColor> createColor(std::pair<etk::Color<float,4>, std::string> _color, const mat2x3& _mtx);
|
ememory::SharedPtr<DynamicColor> createColor(etk::Pair<etk::Color<float,4>, etk::String> _color, const mat2x3& _mtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <esvg/render/Element.hpp>
|
#include <esvg/render/Element.hpp>
|
||||||
#include <esvg/debug.hpp>
|
#include <esvg/debug.hpp>
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::render::path _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::render::path _obj) {
|
||||||
switch (_obj) {
|
switch (_obj) {
|
||||||
case esvg::render::path_stop:
|
case esvg::render::path_stop:
|
||||||
_os << "path_stop";
|
_os << "path_stop";
|
||||||
@ -48,9 +48,9 @@ std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::render::path _obj)
|
|||||||
};
|
};
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, const esvg::render::Element& _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, const esvg::render::Element& _obj) {
|
||||||
_os << _obj.getType();
|
_os << _obj.getType();
|
||||||
_os << ": rel=" << etk::to_string(_obj.getRelative()) << " ";
|
_os << ": rel=" << etk::toString(_obj.getRelative()) << " ";
|
||||||
_os << _obj.display();
|
_os << _obj.display();
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,17 @@ namespace esvg {
|
|||||||
m_pos2 = _val;
|
m_pos2 = _val;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const = 0;
|
virtual etk::String display() const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, const esvg::render::Element& _obj);
|
etk::Stream& operator <<(etk::Stream& _os, const esvg::render::Element& _obj);
|
||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::render::path _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::render::path _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <esvg/render/ElementStop.hpp>
|
#include <esvg/render/ElementStop.hpp>
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementBezierCurveTo::ElementBezierCurveTo(bool _relative, const v
|
|||||||
m_pos1 = _pos1;
|
m_pos1 = _pos1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string esvg::render::ElementBezierCurveTo::display() const {
|
etk::String esvg::render::ElementBezierCurveTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos) + " pos1=" + etk::to_string(m_pos1);
|
return etk::String("pos=") + etk::toString(m_pos) + " pos1=" + etk::toString(m_pos1);
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementBezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos);
|
ElementBezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementBezierSmoothCurveTo::ElementBezierSmoothCurveTo(bool _relat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementBezierSmoothCurveTo::display() const {
|
etk::String esvg::render::ElementBezierSmoothCurveTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos);
|
return etk::String("pos=") + etk::toString(m_pos);
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementBezierSmoothCurveTo(bool _relative, const vec2& _pos);
|
ElementBezierSmoothCurveTo(bool _relative, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ esvg::render::ElementClose::ElementClose(bool _relative):
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string esvg::render::ElementClose::display() const {
|
etk::String esvg::render::ElementClose::display() const {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementClose(bool _relative=false);
|
ElementClose(bool _relative=false);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ esvg::render::ElementCurveTo::ElementCurveTo(bool _relative, const vec2& _pos1,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementCurveTo::display() const {
|
etk::String esvg::render::ElementCurveTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos) + " pos1=" + etk::to_string(m_pos1) + " pos2=" + etk::to_string(m_pos2);
|
return etk::String("pos=") + etk::toString(m_pos) + " pos1=" + etk::toString(m_pos1) + " pos2=" + etk::toString(m_pos2);
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos);
|
ElementCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ esvg::render::ElementElliptic::ElementElliptic(bool _relative,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementElliptic::display() const {
|
etk::String esvg::render::ElementElliptic::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos)
|
return etk::String("pos=") + etk::toString(m_pos)
|
||||||
+ " radius=" + etk::to_string(m_pos1)
|
+ " radius=" + etk::toString(m_pos1)
|
||||||
+ " angle=" + etk::to_string(m_angle)
|
+ " angle=" + etk::toString(m_angle)
|
||||||
+ " largeArcFlag=" + etk::to_string(m_largeArcFlag)
|
+ " largeArcFlag=" + etk::toString(m_largeArcFlag)
|
||||||
+ " sweepFlag=" + etk::to_string(m_sweepFlag);
|
+ " sweepFlag=" + etk::toString(m_sweepFlag);
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ namespace esvg {
|
|||||||
bool _sweepFlag,
|
bool _sweepFlag,
|
||||||
const vec2& _pos);
|
const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementLineTo::ElementLineTo(bool _relative, const vec2& _pos):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementLineTo::display() const {
|
etk::String esvg::render::ElementLineTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos);
|
return etk::String("pos=") + etk::toString(m_pos);
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementLineTo(bool _relative, const vec2& _pos);
|
ElementLineTo(bool _relative, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementLineToH::ElementLineToH(bool _relative, float _posX):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementLineToH::display() const {
|
etk::String esvg::render::ElementLineToH::display() const {
|
||||||
return std::string("posX=") + etk::to_string(m_pos.x());
|
return etk::String("posX=") + etk::toString(m_pos.x());
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementLineToH(bool _relative, float _posX);
|
ElementLineToH(bool _relative, float _posX);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementLineToV::ElementLineToV(bool _relative, float _posY):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementLineToV::display() const {
|
etk::String esvg::render::ElementLineToV::display() const {
|
||||||
return std::string("posY=") + etk::to_string(m_pos.y());
|
return etk::String("posY=") + etk::toString(m_pos.y());
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementLineToV(bool _relative, float _posY);
|
ElementLineToV(bool _relative, float _posY);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,6 @@ esvg::render::ElementMoveTo::ElementMoveTo(bool _relative, const vec2& _pos):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementMoveTo::display() const {
|
etk::String esvg::render::ElementMoveTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos);
|
return etk::String("pos=") + etk::toString(m_pos);
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementMoveTo(bool _relative, const vec2& _pos);
|
ElementMoveTo(bool _relative, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ esvg::render::ElementSmoothCurveTo::ElementSmoothCurveTo(bool _relative, const v
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string esvg::render::ElementSmoothCurveTo::display() const {
|
etk::String esvg::render::ElementSmoothCurveTo::display() const {
|
||||||
return std::string("pos=") + etk::to_string(m_pos) + " pos2=" + etk::to_string(m_pos2);
|
return etk::String("pos=") + etk::toString(m_pos) + " pos2=" + etk::toString(m_pos2);
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementSmoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos);
|
ElementSmoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos);
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ esvg::render::ElementStop::ElementStop():
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string esvg::render::ElementStop::display() const {
|
etk::String esvg::render::ElementStop::display() const {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
ElementStop();
|
ElementStop();
|
||||||
public:
|
public:
|
||||||
virtual std::string display() const;
|
virtual etk::String display() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,43 +12,43 @@ void esvg::render::Path::clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::stop() {
|
void esvg::render::Path::stop() {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementStop>());
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementStop>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::close(bool _relative) {
|
void esvg::render::Path::close(bool _relative) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementClose>(_relative));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementClose>(_relative));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::moveTo(bool _relative, const vec2& _pos) {
|
void esvg::render::Path::moveTo(bool _relative, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementMoveTo>(_relative, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementMoveTo>(_relative, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::lineTo(bool _relative, const vec2& _pos) {
|
void esvg::render::Path::lineTo(bool _relative, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineTo>(_relative, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementLineTo>(_relative, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::lineToH(bool _relative, float _posX) {
|
void esvg::render::Path::lineToH(bool _relative, float _posX) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineToH>(_relative, _posX));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementLineToH>(_relative, _posX));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::lineToV(bool _relative, float _posY) {
|
void esvg::render::Path::lineToV(bool _relative, float _posY) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementLineToV>(_relative, _posY));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementLineToV>(_relative, _posY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::curveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos) {
|
void esvg::render::Path::curveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementCurveTo>(_relative, _pos1, _pos2, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementCurveTo>(_relative, _pos1, _pos2, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::smoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos) {
|
void esvg::render::Path::smoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementSmoothCurveTo>(_relative, _pos2, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementSmoothCurveTo>(_relative, _pos2, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::bezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos) {
|
void esvg::render::Path::bezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementBezierCurveTo>(_relative, _pos1, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementBezierCurveTo>(_relative, _pos1, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::bezierSmoothCurveTo(bool _relative, const vec2& _pos) {
|
void esvg::render::Path::bezierSmoothCurveTo(bool _relative, const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementBezierSmoothCurveTo>(_relative, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementBezierSmoothCurveTo>(_relative, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::Path::ellipticTo(bool _relative,
|
void esvg::render::Path::ellipticTo(bool _relative,
|
||||||
@ -57,7 +57,7 @@ void esvg::render::Path::ellipticTo(bool _relative,
|
|||||||
bool _largeArcFlag,
|
bool _largeArcFlag,
|
||||||
bool _sweepFlag,
|
bool _sweepFlag,
|
||||||
const vec2& _pos) {
|
const vec2& _pos) {
|
||||||
m_listElement.push_back(ememory::makeShared<esvg::render::ElementElliptic>(_relative, _radius, _angle, _largeArcFlag, _sweepFlag, _pos));
|
m_listElement.pushBack(ememory::makeShared<esvg::render::ElementElliptic>(_relative, _radius, _angle, _largeArcFlag, _sweepFlag, _pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* spacingDist(int32_t _spacing) {
|
static const char* spacingDist(int32_t _spacing) {
|
||||||
@ -79,7 +79,7 @@ void esvg::render::Path::display(int32_t _spacing) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void interpolateCubicBezier(std::vector<esvg::render::Point>& _listPoint,
|
void interpolateCubicBezier(etk::Vector<esvg::render::Point>& _listPoint,
|
||||||
int32_t _recurtionMax,
|
int32_t _recurtionMax,
|
||||||
float _threshold,
|
float _threshold,
|
||||||
vec2 _pos1,
|
vec2 _pos1,
|
||||||
@ -105,7 +105,7 @@ void interpolateCubicBezier(std::vector<esvg::render::Point>& _listPoint,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((distance2 + distance3)*(distance2 + distance3) < _threshold * delta.length2()) {
|
if ((distance2 + distance3)*(distance2 + distance3) < _threshold * delta.length2()) {
|
||||||
_listPoint.push_back(esvg::render::Point(_pos4, _type) );
|
_listPoint.pushBack(esvg::render::Point(_pos4, _type) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vec2 pos123 = (pos12+pos23)*0.5f;
|
vec2 pos123 = (pos12+pos23)*0.5f;
|
||||||
@ -125,7 +125,7 @@ static float vectorAngle(vec2 _uuu, vec2 _vvv) {
|
|||||||
esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, int32_t _recurtionMax, float _threshold) {
|
esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, int32_t _recurtionMax, float _threshold) {
|
||||||
ESVG_VERBOSE(spacingDist(_level) << "Generate List Points ... from a path");
|
ESVG_VERBOSE(spacingDist(_level) << "Generate List Points ... from a path");
|
||||||
esvg::render::PointList out;
|
esvg::render::PointList out;
|
||||||
std::vector<esvg::render::Point> tmpListPoint;
|
etk::Vector<esvg::render::Point> tmpListPoint;
|
||||||
vec2 lastPosition(0.0f, 0.0f);
|
vec2 lastPosition(0.0f, 0.0f);
|
||||||
vec2 lastAngle(0.0f, 0.0f);
|
vec2 lastAngle(0.0f, 0.0f);
|
||||||
int32_t lastPointId = -1;
|
int32_t lastPointId = -1;
|
||||||
@ -161,7 +161,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
vec2 delta = (tmpListPoint.front().m_pos - tmpListPoint.back().m_pos).absolute();
|
vec2 delta = (tmpListPoint.front().m_pos - tmpListPoint.back().m_pos).absolute();
|
||||||
if ( delta.x() <= 0.00001
|
if ( delta.x() <= 0.00001
|
||||||
&& delta.y() <= 0.00001) {
|
&& delta.y() <= 0.00001) {
|
||||||
tmpListPoint.pop_back();
|
tmpListPoint.popBack();
|
||||||
ESVG_VERBOSE(" Remove point Z property : " << tmpListPoint.back().m_pos << " with delta=" << delta);
|
ESVG_VERBOSE(" Remove point Z property : " << tmpListPoint.back().m_pos << " with delta=" << delta);
|
||||||
}
|
}
|
||||||
out.addList(tmpListPoint);
|
out.addList(tmpListPoint);
|
||||||
@ -183,49 +183,49 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
lastPosition = vec2(0.0f, 0.0f);
|
lastPosition = vec2(0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
lastPosition += it->getPos();
|
lastPosition += it->getPos();
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
||||||
lastAngle = lastPosition;
|
lastAngle = lastPosition;
|
||||||
break;
|
break;
|
||||||
case esvg::render::path_lineTo:
|
case esvg::render::path_lineTo:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
||||||
}
|
}
|
||||||
if (it->getRelative() == false) {
|
if (it->getRelative() == false) {
|
||||||
lastPosition = vec2(0.0f, 0.0f);
|
lastPosition = vec2(0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
lastPosition += it->getPos();
|
lastPosition += it->getPos();
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
lastAngle = lastPosition;
|
lastAngle = lastPosition;
|
||||||
break;
|
break;
|
||||||
case esvg::render::path_lineToH:
|
case esvg::render::path_lineToH:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
||||||
}
|
}
|
||||||
if (it->getRelative() == false) {
|
if (it->getRelative() == false) {
|
||||||
lastPosition = vec2(0.0f, 0.0f);
|
lastPosition = vec2(0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
lastPosition += it->getPos();
|
lastPosition += it->getPos();
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
lastAngle = lastPosition;
|
lastAngle = lastPosition;
|
||||||
break;
|
break;
|
||||||
case esvg::render::path_lineToV:
|
case esvg::render::path_lineToV:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::start));
|
||||||
}
|
}
|
||||||
if (it->getRelative() == false) {
|
if (it->getRelative() == false) {
|
||||||
lastPosition = vec2(0.0f, 0.0f);
|
lastPosition = vec2(0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
lastPosition += it->getPos();
|
lastPosition += it->getPos();
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
lastAngle = lastPosition;
|
lastAngle = lastPosition;
|
||||||
break;
|
break;
|
||||||
case esvg::render::path_curveTo:
|
case esvg::render::path_curveTo:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
vec2 lastPosStore(lastPosition);
|
vec2 lastPosStore(lastPosition);
|
||||||
@ -251,7 +251,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
case esvg::render::path_smoothCurveTo:
|
case esvg::render::path_smoothCurveTo:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
vec2 lastPosStore(lastPosition);
|
vec2 lastPosStore(lastPosition);
|
||||||
@ -278,7 +278,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
case esvg::render::path_bezierCurveTo:
|
case esvg::render::path_bezierCurveTo:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
vec2 lastPosStore(lastPosition);
|
vec2 lastPosStore(lastPosition);
|
||||||
@ -306,7 +306,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
case esvg::render::path_bezierSmoothCurveTo:
|
case esvg::render::path_bezierSmoothCurveTo:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
vec2 lastPosStore(lastPosition);
|
vec2 lastPosStore(lastPosition);
|
||||||
@ -334,7 +334,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
case esvg::render::path_elliptic:
|
case esvg::render::path_elliptic:
|
||||||
// If no previous point, we need to create the last point has start ...
|
// If no previous point, we need to create the last point has start ...
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
ememory::SharedPtr<esvg::render::ElementElliptic> tmpIt(ememory::dynamicPointerCast<esvg::render::ElementElliptic>(it));
|
ememory::SharedPtr<esvg::render::ElementElliptic> tmpIt(ememory::dynamicPointerCast<esvg::render::ElementElliptic>(it));
|
||||||
@ -363,9 +363,9 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|
|||||||
|| radius.y() < 1e-6f) {
|
|| radius.y() < 1e-6f) {
|
||||||
ESVG_WARNING("Degenerate arc in Line");
|
ESVG_WARNING("Degenerate arc in Line");
|
||||||
if (tmpListPoint.size() == 0) {
|
if (tmpListPoint.size() == 0) {
|
||||||
tmpListPoint.push_back(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(lastPosition, esvg::render::Point::type::join));
|
||||||
}
|
}
|
||||||
tmpListPoint.push_back(esvg::render::Point(pos, esvg::render::Point::type::join));
|
tmpListPoint.pushBack(esvg::render::Point(pos, esvg::render::Point::type::join));
|
||||||
} else {
|
} else {
|
||||||
// Convert to center point parameterization.
|
// Convert to center point parameterization.
|
||||||
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
||||||
|
@ -18,7 +18,7 @@ namespace esvg {
|
|||||||
namespace render {
|
namespace render {
|
||||||
class Path {
|
class Path {
|
||||||
public:
|
public:
|
||||||
std::vector<ememory::SharedPtr<esvg::render::Element>> m_listElement;
|
etk::Vector<ememory::SharedPtr<esvg::render::Element>> m_listElement;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
esvg::render::SegmentList m_debugInformation;
|
esvg::render::SegmentList m_debugInformation;
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,6 +31,12 @@ namespace esvg {
|
|||||||
vec2 m_posNext;
|
vec2 m_posNext;
|
||||||
vec2 m_delta;
|
vec2 m_delta;
|
||||||
float m_len;
|
float m_len;
|
||||||
|
// TODO: Update etk::Vector to support not having it ...
|
||||||
|
Point() :
|
||||||
|
m_pos(0,0),
|
||||||
|
m_type(esvg::render::Point::type::join) {
|
||||||
|
// nothing to do ...
|
||||||
|
}
|
||||||
Point(const vec2& _pos, enum esvg::render::Point::type _type = esvg::render::Point::type::join) :
|
Point(const vec2& _pos, enum esvg::render::Point::type _type = esvg::render::Point::type::join) :
|
||||||
m_pos(_pos),
|
m_pos(_pos),
|
||||||
m_type(_type) {
|
m_type(_type) {
|
||||||
|
@ -11,8 +11,8 @@ esvg::render::PointList::PointList() {
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::PointList::addList(std::vector<esvg::render::Point>& _list) {
|
void esvg::render::PointList::addList(etk::Vector<esvg::render::Point>& _list) {
|
||||||
m_data.push_back(_list);
|
m_data.pushBack(_list);
|
||||||
// TODO : Add a checker of correct list ...
|
// TODO : Add a checker of correct list ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ void esvg::render::PointList::applyMatrix(const mat2x3& _transformationMatrix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<vec2, vec2> esvg::render::PointList::getViewPort() {
|
etk::Pair<vec2, vec2> esvg::render::PointList::getViewPort() {
|
||||||
std::pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
|
etk::Pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
|
||||||
for (auto &it : m_data) {
|
for (auto &it : m_data) {
|
||||||
for (auto &it2 : it) {
|
for (auto &it2 : it) {
|
||||||
out.first.setMin(it2.m_pos);
|
out.first.setMin(it2.m_pos);
|
||||||
|
@ -15,13 +15,13 @@ namespace esvg {
|
|||||||
namespace render {
|
namespace render {
|
||||||
class PointList {
|
class PointList {
|
||||||
public:
|
public:
|
||||||
std::vector<std::vector<esvg::render::Point>> m_data;
|
etk::Vector<etk::Vector<esvg::render::Point>> m_data;
|
||||||
public:
|
public:
|
||||||
PointList();
|
PointList();
|
||||||
void addList(std::vector<esvg::render::Point>& _list);
|
void addList(etk::Vector<esvg::render::Point>& _list);
|
||||||
void display();
|
void display();
|
||||||
void applyMatrix(const mat2x3& _transformationMatrix);
|
void applyMatrix(const mat2x3& _transformationMatrix);
|
||||||
std::pair<vec2, vec2> getViewPort();
|
etk::Pair<vec2, vec2> getViewPort();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace esvg {
|
|||||||
namespace render {
|
namespace render {
|
||||||
class Scanline {
|
class Scanline {
|
||||||
private:
|
private:
|
||||||
std::vector<float> m_data;
|
etk::Vector<float> m_data;
|
||||||
public:
|
public:
|
||||||
// constructor :
|
// constructor :
|
||||||
Scanline(size_t _size=32);
|
Scanline(size_t _size=32);
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
#include <esvg/render/Segment.hpp>
|
#include <esvg/render/Segment.hpp>
|
||||||
#include <esvg/debug.hpp>
|
#include <esvg/debug.hpp>
|
||||||
|
|
||||||
|
esvg::render::Segment::Segment() {
|
||||||
|
p0 = vec2(0,0);
|
||||||
|
p1 = vec2(0,0);
|
||||||
|
direction = 0;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -13,6 +13,8 @@ namespace esvg {
|
|||||||
namespace render {
|
namespace render {
|
||||||
class Segment {
|
class Segment {
|
||||||
public:
|
public:
|
||||||
|
// TODO: Update etk::Vector to support not having it ...
|
||||||
|
Segment();
|
||||||
Segment(const vec2& _p0, const vec2& _p1);
|
Segment(const vec2& _p0, const vec2& _p1);
|
||||||
vec2 p0;
|
vec2 p0;
|
||||||
vec2 p1;
|
vec2 p1;
|
||||||
|
@ -13,7 +13,7 @@ esvg::render::SegmentList::SegmentList() {
|
|||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void esvg::render::SegmentList::addSegment(const vec2& _pos0, const vec2& _pos1) {
|
void esvg::render::SegmentList::addSegment(const vec2& _pos0, const vec2& _pos1) {
|
||||||
m_data.push_back(Segment(_pos0, _pos1));
|
m_data.pushBack(Segment(_pos0, _pos1));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, con
|
|||||||
// remove /0 operation
|
// remove /0 operation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_data.push_back(Segment(_pos0.m_pos, _pos1.m_pos));
|
m_data.pushBack(Segment(_pos0.m_pos, _pos1.m_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, const esvg::render::Point& _pos1, bool _disableHorizontal) {
|
void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, const esvg::render::Point& _pos1, bool _disableHorizontal) {
|
||||||
@ -33,11 +33,11 @@ void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, con
|
|||||||
// remove /0 operation
|
// remove /0 operation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_data.push_back(Segment(_pos0.m_pos, _pos1.m_pos));
|
m_data.pushBack(Segment(_pos0.m_pos, _pos1.m_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<vec2, vec2> esvg::render::SegmentList::getViewPort() {
|
etk::Pair<vec2, vec2> esvg::render::SegmentList::getViewPort() {
|
||||||
std::pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
|
etk::Pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
|
||||||
for (auto &it : m_data) {
|
for (auto &it : m_data) {
|
||||||
out.first.setMin(it.p0);
|
out.first.setMin(it.p0);
|
||||||
out.second.setMax(it.p0);
|
out.second.setMax(it.p0);
|
||||||
|
@ -16,7 +16,7 @@ namespace esvg {
|
|||||||
namespace render {
|
namespace render {
|
||||||
class SegmentList {
|
class SegmentList {
|
||||||
public:
|
public:
|
||||||
std::vector<esvg::render::Segment> m_data;
|
etk::Vector<esvg::render::Segment> m_data;
|
||||||
public:
|
public:
|
||||||
SegmentList();
|
SegmentList();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -43,7 +43,7 @@ namespace esvg {
|
|||||||
float _width,
|
float _width,
|
||||||
bool _isStart);
|
bool _isStart);
|
||||||
public:
|
public:
|
||||||
std::pair<vec2, vec2> getViewPort();
|
etk::Pair<vec2, vec2> getViewPort();
|
||||||
void applyMatrix(const mat2x3& _transformationMatrix);
|
void applyMatrix(const mat2x3& _transformationMatrix);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void esvg::render::Weight::append(int32_t _posY, const esvg::render::Scanline& _
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sortXPosFunction(const std::pair<float,float>& _e1, const std::pair<float,float>& _e2) {
|
bool sortXPosFunction(const etk::Pair<float,int32_t>& _e1, const etk::Pair<float,int32_t>& _e2) {
|
||||||
return _e1.first < _e2.first;
|
return _e1.first < _e2.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
|
|||||||
for (int32_t yyy=0; yyy<_size.y(); ++yyy) {
|
for (int32_t yyy=0; yyy<_size.y(); ++yyy) {
|
||||||
ESVG_VERBOSE("Weighting ... " << yyy << " / " << _size.y());
|
ESVG_VERBOSE("Weighting ... " << yyy << " / " << _size.y());
|
||||||
// Reduce the number of lines in the subsampling parsing:
|
// Reduce the number of lines in the subsampling parsing:
|
||||||
std::vector<Segment> availlableSegmentPixel;
|
etk::Vector<Segment> availlableSegmentPixel;
|
||||||
for (auto &it : _listSegment.m_data) {
|
for (auto &it : _listSegment.m_data) {
|
||||||
if ( it.p0.y() < float(yyy+1)
|
if ( it.p0.y() < float(yyy+1)
|
||||||
&& it.p1.y() > float(yyy)) {
|
&& it.p1.y() > float(yyy)) {
|
||||||
availlableSegmentPixel.push_back(it);
|
availlableSegmentPixel.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (availlableSegmentPixel.size() == 0) {
|
if (availlableSegmentPixel.size() == 0) {
|
||||||
@ -111,7 +111,7 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
|
|||||||
Scanline scanline(_size.x());
|
Scanline scanline(_size.x());
|
||||||
//find all the segment that cross the middle of the line of the center of the pixel line:
|
//find all the segment that cross the middle of the line of the center of the pixel line:
|
||||||
float subSamplingCenterPos = yyy + deltaSize*0.5f + deltaSize*kkk;
|
float subSamplingCenterPos = yyy + deltaSize*0.5f + deltaSize*kkk;
|
||||||
std::vector<Segment> availlableSegment;
|
etk::Vector<Segment> availlableSegment;
|
||||||
// find in the subList ...
|
// find in the subList ...
|
||||||
for (auto &it : availlableSegmentPixel) {
|
for (auto &it : availlableSegmentPixel) {
|
||||||
if ( it.p0.y() <= subSamplingCenterPos
|
if ( it.p0.y() <= subSamplingCenterPos
|
||||||
@ -122,7 +122,7 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
|
|||||||
&& availlableSegment.back().direction == it.direction) {
|
&& availlableSegment.back().direction == it.direction) {
|
||||||
// we not add this point in this case to prevent double count of the same point.
|
// we not add this point in this case to prevent double count of the same point.
|
||||||
} else {
|
} else {
|
||||||
availlableSegment.push_back(it);
|
availlableSegment.pushBack(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,18 +134,18 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
|
|||||||
ESVG_VERBOSE(" Availlable Segment " << it.p0 << " -> " << it.p1 << " dir=" << it.direction);
|
ESVG_VERBOSE(" Availlable Segment " << it.p0 << " -> " << it.p1 << " dir=" << it.direction);
|
||||||
}
|
}
|
||||||
// x position, angle
|
// x position, angle
|
||||||
std::vector<std::pair<float, int32_t>> listPosition;
|
etk::Vector<etk::Pair<float, int32_t>> listPosition;
|
||||||
for (auto &it : availlableSegment) {
|
for (auto &it : availlableSegment) {
|
||||||
vec2 delta = it.p0 - it.p1;
|
vec2 delta = it.p0 - it.p1;
|
||||||
// x = coefficent*y+bbb;
|
// x = coefficent*y+bbb;
|
||||||
float coefficient = delta.x()/delta.y();
|
float coefficient = delta.x()/delta.y();
|
||||||
float bbb = it.p0.x() - coefficient*it.p0.y();
|
float bbb = it.p0.x() - coefficient*it.p0.y();
|
||||||
float xpos = coefficient * subSamplingCenterPos + bbb;
|
float xpos = coefficient * subSamplingCenterPos + bbb;
|
||||||
listPosition.push_back(std::pair<float,int32_t>(xpos, it.direction));
|
listPosition.pushBack(etk::Pair<float,int32_t>(xpos, it.direction));
|
||||||
}
|
}
|
||||||
ESVG_VERBOSE(" List position " << listPosition.size());
|
ESVG_VERBOSE(" List position " << listPosition.size());
|
||||||
// now we order position of the xPosition:
|
// now we order position of the xPosition:
|
||||||
std::sort(listPosition.begin(), listPosition.end(), sortXPosFunction);
|
listPosition.sort(0, listPosition.size(), sortXPosFunction);
|
||||||
// move through all element in the point:
|
// move through all element in the point:
|
||||||
int32_t lastState = 0;
|
int32_t lastState = 0;
|
||||||
float currentValue = 0.0f;
|
float currentValue = 0.0f;
|
||||||
@ -160,9 +160,9 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
|
|||||||
if (currentPos != int32_t(it.first)) {
|
if (currentPos != int32_t(it.first)) {
|
||||||
// fill to the new pos -1:
|
// fill to the new pos -1:
|
||||||
#if __CPP_VERSION__ >= 2011 && !defined(__TARGET_OS__MacOs) && !defined(__TARGET_OS__IOs)
|
#if __CPP_VERSION__ >= 2011 && !defined(__TARGET_OS__MacOs) && !defined(__TARGET_OS__IOs)
|
||||||
float endValue = float(std::min(1,std::abs(lastState))) * deltaSize;
|
float endValue = float(etk::min(1,std::abs(lastState))) * deltaSize;
|
||||||
#else
|
#else
|
||||||
float endValue = float(std::min(1,abs(lastState))) * deltaSize;
|
float endValue = float(etk::min(1,abs(lastState))) * deltaSize;
|
||||||
#endif
|
#endif
|
||||||
for (int32_t iii=currentPos+1; iii<int32_t(it.first); ++iii) {
|
for (int32_t iii=currentPos+1; iii<int32_t(it.first); ++iii) {
|
||||||
scanline.set(iii, endValue);
|
scanline.set(iii, endValue);
|
||||||
|
@ -15,7 +15,7 @@ namespace esvg {
|
|||||||
class Weight {
|
class Weight {
|
||||||
private:
|
private:
|
||||||
ivec2 m_size;
|
ivec2 m_size;
|
||||||
std::vector<float> m_data;
|
etk::Vector<float> m_data;
|
||||||
public:
|
public:
|
||||||
// constructor :
|
// constructor :
|
||||||
Weight();
|
Weight();
|
||||||
|
@ -13,7 +13,7 @@ static const char* values[] = {
|
|||||||
"repeat"
|
"repeat"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::spreadMethod _obj) {
|
etk::Stream& esvg::operator <<(etk::Stream& _os, enum esvg::spreadMethod _obj) {
|
||||||
_os << values[_obj];
|
_os << values[_obj];
|
||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace esvg {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, enum esvg::spreadMethod _obj);
|
etk::Stream& operator <<(etk::Stream& _os, enum esvg::spreadMethod _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||||
etk::init(_argc, _argv);
|
etk::init(_argc, _argv);
|
||||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||||
std::string data = _argv[iii];
|
etk::String data = _argv[iii];
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (data == "--visual-test") {
|
if (data == "--visual-test") {
|
||||||
TEST_PRINT("visual-test=enable");
|
TEST_PRINT("visual-test=enable");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestCap, butt) {
|
TEST(TestCap, butt) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
@ -23,7 +23,7 @@ TEST(TestCap, butt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, round) {
|
TEST(TestCap, round) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
@ -35,7 +35,7 @@ TEST(TestCap, round) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, square) {
|
TEST(TestCap, square) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='20,75 80,75' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='80,25 20,25' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
@ -48,7 +48,7 @@ TEST(TestCap, square) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestCap, buttVert) {
|
TEST(TestCap, buttVert) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
@ -60,7 +60,7 @@ TEST(TestCap, buttVert) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, roundVert) {
|
TEST(TestCap, roundVert) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
@ -72,7 +72,7 @@ TEST(TestCap, roundVert) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, squareVert) {
|
TEST(TestCap, squareVert) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='25,20 25,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='75,80 75,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
@ -86,7 +86,7 @@ TEST(TestCap, squareVert) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestCap, buttDiag1) {
|
TEST(TestCap, buttDiag1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
@ -98,7 +98,7 @@ TEST(TestCap, buttDiag1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, roundDiag1) {
|
TEST(TestCap, roundDiag1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
@ -110,7 +110,7 @@ TEST(TestCap, roundDiag1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, squareDiag1) {
|
TEST(TestCap, squareDiag1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='20,20 80,80' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='80,20 20,80' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
@ -123,7 +123,7 @@ TEST(TestCap, squareDiag1) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestCap, buttDiag2) {
|
TEST(TestCap, buttDiag2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
@ -135,7 +135,7 @@ TEST(TestCap, buttDiag2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, roundDiag2) {
|
TEST(TestCap, roundDiag2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
@ -147,7 +147,7 @@ TEST(TestCap, roundDiag2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCap, squareDiag2) {
|
TEST(TestCap, squareDiag2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='20,80 80,20' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
" <polyline points='80,80 20,20' stroke='orange' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestCircle, fill) {
|
TEST(TestCircle, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <circle cx='50' cy='50' r='40' fill='red' />"
|
" <circle cx='50' cy='50' r='40' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestCircle, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCircle, stroke) {
|
TEST(TestCircle, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' />"
|
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestCircle, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestCircle, fill_and_stroke) {
|
TEST(TestCircle, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' fill='red' />"
|
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestColor, blending) {
|
TEST(TestColor, blending) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestColor, blending) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestColor, opacity) {
|
TEST(TestColor, opacity) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-width='3' fill='#F00' opacity='0.5' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-width='3' fill='#F00' opacity='0.5' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestColor, opacity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestColor, blending_and_opacity) {
|
TEST(TestColor, blending_and_opacity) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' opacity='0.7' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' opacity='0.7' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -44,7 +44,7 @@ TEST(TestColor, blending_and_opacity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestColor, multiple_layer) {
|
TEST(TestColor, multiple_layer) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='50' y='5' width='15' height='75' stroke='blue' stroke-width='9' fill='green'/>"
|
" <rect x='50' y='5' width='15' height='75' stroke='blue' stroke-width='9' fill='green'/>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='30' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' opacity='0.7' />"
|
" <rect x='12.5' y='12.5' width='75' height='30' stroke='#0F0' stroke-opacity='0.5' stroke-width='3' fill='#F00' fill-opacity='0.5' opacity='0.7' />"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestEllipse, fill) {
|
TEST(TestEllipse, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <ellipse cx='50' cy='50' rx='80' ry='30' fill='red' />"
|
" <ellipse cx='50' cy='50' rx='80' ry='30' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestEllipse, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEllipse, stroke) {
|
TEST(TestEllipse, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' />"
|
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestEllipse, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestEllipse, fill_and_stroke) {
|
TEST(TestEllipse, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' fill='red' />"
|
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestGradientLinear, horizontal) {
|
TEST(TestGradientLinear, horizontal) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad1' x1='0%' y1='0%' x2='100%' y2='0%'>\n"
|
" <linearGradient id='grad1' x1='0%' y1='0%' x2='100%' y2='0%'>\n"
|
||||||
@ -31,7 +31,7 @@ TEST(TestGradientLinear, horizontal) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, vertical) {
|
TEST(TestGradientLinear, vertical) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='0%' x2='0%' y2='100%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='0%' x2='0%' y2='100%'>\n"
|
||||||
@ -50,7 +50,7 @@ TEST(TestGradientLinear, vertical) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag1) {
|
TEST(TestGradientLinear, diag1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='0%' x2='100%' y2='100%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='0%' x2='100%' y2='100%'>\n"
|
||||||
@ -69,7 +69,7 @@ TEST(TestGradientLinear, diag1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag1Partiel) {
|
TEST(TestGradientLinear, diag1Partiel) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='40%' y1='40%' x2='70%' y2='70%'>\n"
|
" <linearGradient id='grad2' x1='40%' y1='40%' x2='70%' y2='70%'>\n"
|
||||||
@ -86,7 +86,7 @@ TEST(TestGradientLinear, diag1Partiel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag2) {
|
TEST(TestGradientLinear, diag2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
||||||
@ -107,7 +107,7 @@ TEST(TestGradientLinear, diag2) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag2Rotate0) {
|
TEST(TestGradientLinear, diag2Rotate0) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='50%' x2='100%' y2='50%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='50%' x2='100%' y2='50%'>\n"
|
||||||
@ -126,7 +126,7 @@ TEST(TestGradientLinear, diag2Rotate0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag2Rotate1) {
|
TEST(TestGradientLinear, diag2Rotate1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
||||||
@ -145,7 +145,7 @@ TEST(TestGradientLinear, diag2Rotate1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag2Rotate2) {
|
TEST(TestGradientLinear, diag2Rotate2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
||||||
@ -164,7 +164,7 @@ TEST(TestGradientLinear, diag2Rotate2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, diag2scale) {
|
TEST(TestGradientLinear, diag2scale) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
|
||||||
@ -183,7 +183,7 @@ TEST(TestGradientLinear, diag2scale) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, internalHref) {
|
TEST(TestGradientLinear, internalHref) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2Values'>\n"
|
" <linearGradient id='grad2Values'>\n"
|
||||||
@ -204,7 +204,7 @@ TEST(TestGradientLinear, internalHref) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitBox_spreadNone) {
|
TEST(TestGradientLinear, unitBox_spreadNone) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%'>\n"
|
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%'>\n"
|
||||||
@ -221,7 +221,7 @@ TEST(TestGradientLinear, unitBox_spreadNone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitBox_spreadPad) {
|
TEST(TestGradientLinear, unitBox_spreadPad) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='pad'>\n"
|
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='pad'>\n"
|
||||||
@ -239,7 +239,7 @@ TEST(TestGradientLinear, unitBox_spreadPad) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitBox_spreadReflect) {
|
TEST(TestGradientLinear, unitBox_spreadReflect) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='reflect'>\n"
|
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='reflect'>\n"
|
||||||
@ -257,7 +257,7 @@ TEST(TestGradientLinear, unitBox_spreadReflect) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitBox_spreadRepeat) {
|
TEST(TestGradientLinear, unitBox_spreadRepeat) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='repeat'>\n"
|
" <linearGradient id='grad2' x1='40%' y1='40%' x2='60%' y2='60%' spreadMethod='repeat'>\n"
|
||||||
@ -274,7 +274,7 @@ TEST(TestGradientLinear, unitBox_spreadRepeat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitUser_spreadNone) {
|
TEST(TestGradientLinear, unitUser_spreadNone) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' gradientUnits='userSpaceOnUse'>\n"
|
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' gradientUnits='userSpaceOnUse'>\n"
|
||||||
@ -291,7 +291,7 @@ TEST(TestGradientLinear, unitUser_spreadNone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitUser_spreadPad) {
|
TEST(TestGradientLinear, unitUser_spreadPad) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -309,7 +309,7 @@ TEST(TestGradientLinear, unitUser_spreadPad) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitUser_spreadReflect) {
|
TEST(TestGradientLinear, unitUser_spreadReflect) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -327,7 +327,7 @@ TEST(TestGradientLinear, unitUser_spreadReflect) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientLinear, unitUser_spreadRepeate) {
|
TEST(TestGradientLinear, unitUser_spreadRepeate) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestGradientRadial, circle) {
|
TEST(TestGradientRadial, circle) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='50%' fx='50%' fy='50%'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='50%' fx='50%' fy='50%'>\n"
|
||||||
@ -31,7 +31,7 @@ TEST(TestGradientRadial, circle) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, full) {
|
TEST(TestGradientRadial, full) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='50%' fx='50%' fy='50%'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='50%' fx='50%' fy='50%'>\n"
|
||||||
@ -51,7 +51,7 @@ TEST(TestGradientRadial, full) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, partial) {
|
TEST(TestGradientRadial, partial) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad2' cx='20%' cy='30%' r='30%' fx='50%' fy='50%'>\n"
|
" <radialGradient id='grad2' cx='20%' cy='30%' r='30%' fx='50%' fy='50%'>\n"
|
||||||
@ -70,7 +70,7 @@ TEST(TestGradientRadial, partial) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitBox_spreadNone) {
|
TEST(TestGradientRadial, unitBox_spreadNone) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%'>\n"
|
||||||
@ -89,7 +89,7 @@ TEST(TestGradientRadial, unitBox_spreadNone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitBox_spreadPad) {
|
TEST(TestGradientRadial, unitBox_spreadPad) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='pad'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='pad'>\n"
|
||||||
@ -108,7 +108,7 @@ TEST(TestGradientRadial, unitBox_spreadPad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitBox_spreadReflect) {
|
TEST(TestGradientRadial, unitBox_spreadReflect) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='reflect'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='reflect'>\n"
|
||||||
@ -128,7 +128,7 @@ TEST(TestGradientRadial, unitBox_spreadReflect) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitBox_spreadRepeat) {
|
TEST(TestGradientRadial, unitBox_spreadRepeat) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='repeat'>\n"
|
" <radialGradient id='grad1' cx='50%' cy='50%' r='10%' fx='50%' fy='50%' spreadMethod='repeat'>\n"
|
||||||
@ -148,7 +148,7 @@ TEST(TestGradientRadial, unitBox_spreadRepeat) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadNone) {
|
TEST(TestGradientRadial, unitUser_spreadNone) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50%' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50%' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -167,7 +167,7 @@ TEST(TestGradientRadial, unitUser_spreadNone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadPad) {
|
TEST(TestGradientRadial, unitUser_spreadPad) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -186,7 +186,7 @@ TEST(TestGradientRadial, unitUser_spreadPad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadReflect) {
|
TEST(TestGradientRadial, unitUser_spreadReflect) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -206,7 +206,7 @@ TEST(TestGradientRadial, unitUser_spreadReflect) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadRepeat) {
|
TEST(TestGradientRadial, unitUser_spreadRepeat) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='10' fx='50' fy='50' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -225,7 +225,7 @@ TEST(TestGradientRadial, unitUser_spreadRepeat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadPad_unCenter) {
|
TEST(TestGradientRadial, unitUser_spreadPad_unCenter) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='pad' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -244,7 +244,7 @@ TEST(TestGradientRadial, unitUser_spreadPad_unCenter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadReflect_unCenter) {
|
TEST(TestGradientRadial, unitUser_spreadReflect_unCenter) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -263,7 +263,7 @@ TEST(TestGradientRadial, unitUser_spreadReflect_unCenter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter) {
|
TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='40' fy='40' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -282,7 +282,7 @@ TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter2) {
|
TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='60' fy='60' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='60' fy='60' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"
|
||||||
@ -302,7 +302,7 @@ TEST(TestGradientRadial, unitUser_spreadRepeat_unCenter2) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestGradientRadial, unitUser_spreadRepeat_out) {
|
TEST(TestGradientRadial, unitUser_spreadRepeat_out) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
||||||
"<svg height='100' width='100'>\n"
|
"<svg height='100' width='100'>\n"
|
||||||
" <defs>\n"
|
" <defs>\n"
|
||||||
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='20' fy='40' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='20' fy='40' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// ------------------------------------------------------ Miter test -----------------------------------------------------
|
// ------------------------------------------------------ Miter test -----------------------------------------------------
|
||||||
|
|
||||||
TEST(TestJoin, miterRight1) {
|
TEST(TestJoin, miterRight1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -24,7 +24,7 @@ TEST(TestJoin, miterRight1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterRight2) {
|
TEST(TestJoin, miterRight2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -35,7 +35,7 @@ TEST(TestJoin, miterRight2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterRight3) {
|
TEST(TestJoin, miterRight3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -46,7 +46,7 @@ TEST(TestJoin, miterRight3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterRight4) {
|
TEST(TestJoin, miterRight4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -57,7 +57,7 @@ TEST(TestJoin, miterRight4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLeft1) {
|
TEST(TestJoin, miterLeft1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -68,7 +68,7 @@ TEST(TestJoin, miterLeft1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLeft2) {
|
TEST(TestJoin, miterLeft2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -79,7 +79,7 @@ TEST(TestJoin, miterLeft2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLeft3) {
|
TEST(TestJoin, miterLeft3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -90,7 +90,7 @@ TEST(TestJoin, miterLeft3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLeft4) {
|
TEST(TestJoin, miterLeft4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -101,7 +101,7 @@ TEST(TestJoin, miterLeft4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLimit1) {
|
TEST(TestJoin, miterLimit1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='10,10 25,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='10,10 25,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -112,7 +112,7 @@ TEST(TestJoin, miterLimit1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLimit2) {
|
TEST(TestJoin, miterLimit2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='10,10 50,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='10,10 50,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -123,7 +123,7 @@ TEST(TestJoin, miterLimit2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLimit3) {
|
TEST(TestJoin, miterLimit3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='10,10 75,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='10,10 75,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -134,7 +134,7 @@ TEST(TestJoin, miterLimit3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterLimit4) {
|
TEST(TestJoin, miterLimit4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='10,10 90,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
" <polyline points='10,10 90,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -145,7 +145,7 @@ TEST(TestJoin, miterLimit4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterCornerCasePath) {
|
TEST(TestJoin, miterCornerCasePath) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path"
|
" <path"
|
||||||
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
||||||
@ -158,7 +158,7 @@ TEST(TestJoin, miterCornerCasePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, miterCornerCasePathLimit) {
|
TEST(TestJoin, miterCornerCasePathLimit) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path"
|
" <path"
|
||||||
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
||||||
@ -173,7 +173,7 @@ TEST(TestJoin, miterCornerCasePathLimit) {
|
|||||||
// ------------------------------------------------------ Round test -----------------------------------------------------
|
// ------------------------------------------------------ Round test -----------------------------------------------------
|
||||||
|
|
||||||
TEST(TestJoin, roundRight1) {
|
TEST(TestJoin, roundRight1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -184,7 +184,7 @@ TEST(TestJoin, roundRight1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundRight2) {
|
TEST(TestJoin, roundRight2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -195,7 +195,7 @@ TEST(TestJoin, roundRight2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundRight3) {
|
TEST(TestJoin, roundRight3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -206,7 +206,7 @@ TEST(TestJoin, roundRight3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundRight4) {
|
TEST(TestJoin, roundRight4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -217,7 +217,7 @@ TEST(TestJoin, roundRight4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundLeft1) {
|
TEST(TestJoin, roundLeft1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -228,7 +228,7 @@ TEST(TestJoin, roundLeft1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundLeft2) {
|
TEST(TestJoin, roundLeft2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -239,7 +239,7 @@ TEST(TestJoin, roundLeft2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundLeft3) {
|
TEST(TestJoin, roundLeft3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -250,7 +250,7 @@ TEST(TestJoin, roundLeft3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundLeft4) {
|
TEST(TestJoin, roundLeft4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -261,7 +261,7 @@ TEST(TestJoin, roundLeft4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, roundCornerCasePath) {
|
TEST(TestJoin, roundCornerCasePath) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path"
|
" <path"
|
||||||
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
||||||
@ -277,7 +277,7 @@ TEST(TestJoin, roundCornerCasePath) {
|
|||||||
// ------------------------------------------------------ Bevel test -----------------------------------------------------
|
// ------------------------------------------------------ Bevel test -----------------------------------------------------
|
||||||
|
|
||||||
TEST(TestJoin, bevelRight1) {
|
TEST(TestJoin, bevelRight1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -288,7 +288,7 @@ TEST(TestJoin, bevelRight1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelRight2) {
|
TEST(TestJoin, bevelRight2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -299,7 +299,7 @@ TEST(TestJoin, bevelRight2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelRight3) {
|
TEST(TestJoin, bevelRight3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -310,7 +310,7 @@ TEST(TestJoin, bevelRight3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelRight4) {
|
TEST(TestJoin, bevelRight4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -321,7 +321,7 @@ TEST(TestJoin, bevelRight4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelLeft1) {
|
TEST(TestJoin, bevelLeft1) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -332,7 +332,7 @@ TEST(TestJoin, bevelLeft1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelLeft2) {
|
TEST(TestJoin, bevelLeft2) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -343,7 +343,7 @@ TEST(TestJoin, bevelLeft2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelLeft3) {
|
TEST(TestJoin, bevelLeft3) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -354,7 +354,7 @@ TEST(TestJoin, bevelLeft3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelLeft4) {
|
TEST(TestJoin, bevelLeft4) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -365,7 +365,7 @@ TEST(TestJoin, bevelLeft4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestJoin, bevelCornerCasePath) {
|
TEST(TestJoin, bevelCornerCasePath) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path"
|
" <path"
|
||||||
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
" d='m 37.984608,9.9629707 c 6.211703,0 12.423406,0 18.635109,0 0,2.5633883 0,5.1267763 0,7.6901643 -6.211703,0 -12.423406,0 -18.635109,0 0,-2.563388 0,-5.126776 0,-7.6901643 z'\n"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestLine, stroke) {
|
TEST(TestLine, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <line x1='10' y1='10' x2='90' y2='90' stroke='green' stroke-width='3' />"
|
" <line x1='10' y1='10' x2='90' y2='90' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestPath, fill) {
|
TEST(TestPath, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||||
" fill='red' />"
|
" fill='red' />"
|
||||||
@ -23,7 +23,7 @@ TEST(TestPath, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPath, stroke) {
|
TEST(TestPath, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||||
" stroke='green' stroke-width='3' />"
|
" stroke='green' stroke-width='3' />"
|
||||||
@ -35,7 +35,7 @@ TEST(TestPath, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPath, fill_and_stroke) {
|
TEST(TestPath, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||||
" stroke='green' stroke-width='3' fill='red' />"
|
" stroke='green' stroke-width='3' fill='red' />"
|
||||||
@ -47,7 +47,7 @@ TEST(TestPath, fill_and_stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPath, curveTo) {
|
TEST(TestPath, curveTo) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 c -30,0 -30,1 -20,20 z'"
|
" <path d='m 50,50 c -30,0 -30,1 -20,20 z'"
|
||||||
" fill='red' />"
|
" fill='red' />"
|
||||||
@ -61,7 +61,7 @@ TEST(TestPath, curveTo) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestPath, smoothCurveTo) {
|
TEST(TestPath, smoothCurveTo) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 s -30,0 -20,20 z'"
|
" <path d='m 50,50 s -30,0 -20,20 z'"
|
||||||
" fill='red' />"
|
" fill='red' />"
|
||||||
@ -75,7 +75,7 @@ TEST(TestPath, smoothCurveTo) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestPath, bezierCurveTo) {
|
TEST(TestPath, bezierCurveTo) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 q -30,1 -20,20 z'"
|
" <path d='m 50,50 q -30,1 -20,20 z'"
|
||||||
" fill='red' />"
|
" fill='red' />"
|
||||||
@ -89,7 +89,7 @@ TEST(TestPath, bezierCurveTo) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestPath, bezierSmoothCurveTo) {
|
TEST(TestPath, bezierSmoothCurveTo) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path d='m 50,50 t -20,30 t 30,-20 z'"
|
" <path d='m 50,50 t -20,30 t 30,-20 z'"
|
||||||
" fill='red' />"
|
" fill='red' />"
|
||||||
@ -101,7 +101,7 @@ TEST(TestPath, bezierSmoothCurveTo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPath, arc) {
|
TEST(TestPath, arc) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='300' width='800'>"
|
"<svg height='300' width='800'>"
|
||||||
" <path d='M20,290 l 50,-25"
|
" <path d='M20,290 l 50,-25"
|
||||||
" a25,25 -30 0,1 50,-25 l 30,0"
|
" a25,25 -30 0,1 50,-25 l 30,0"
|
||||||
@ -124,7 +124,7 @@ TEST(TestPath, arc) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(TestPath, end_path_border_case) {
|
TEST(TestPath, end_path_border_case) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <path\n"
|
" <path\n"
|
||||||
" style='fill:#9fecff;fill-opacity:1;stroke:#1b57df;stroke-width:8.81125546;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.94901961'\n"
|
" style='fill:#9fecff;fill-opacity:1;stroke:#1b57df;stroke-width:8.81125546;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.94901961'\n"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestPolygon, fill) {
|
TEST(TestPolygon, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polygon points='50,10 90,50 10,80' fill='red' />"
|
" <polygon points='50,10 90,50 10,80' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestPolygon, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPolygon, stroke) {
|
TEST(TestPolygon, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' />"
|
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestPolygon, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPolygon, fill_and_stroke) {
|
TEST(TestPolygon, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' fill='red' />"
|
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestPolyLine, fill) {
|
TEST(TestPolyLine, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' fill='orange' />"
|
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' fill='orange' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestPolyLine, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPolyLine, stroke) {
|
TEST(TestPolyLine, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='none' />"
|
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='none' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestPolyLine, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestPolyLine, fill_and_stroke) {
|
TEST(TestPolyLine, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='orange' />"
|
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='orange' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestRectangle, fill) {
|
TEST(TestRectangle, fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' fill='red' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -22,7 +22,7 @@ TEST(TestRectangle, fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestRectangle, stroke) {
|
TEST(TestRectangle, stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -33,7 +33,7 @@ TEST(TestRectangle, stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestRectangle, fill_and_stroke) {
|
TEST(TestRectangle, fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' fill='red' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -44,7 +44,7 @@ TEST(TestRectangle, fill_and_stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestRectangle, corned_fill) {
|
TEST(TestRectangle, corned_fill) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' fill='red' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -55,7 +55,7 @@ TEST(TestRectangle, corned_fill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestRectangle, corned_stroke) {
|
TEST(TestRectangle, corned_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
@ -66,7 +66,7 @@ TEST(TestRectangle, corned_stroke) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestRectangle, corned_fill_and_stroke) {
|
TEST(TestRectangle, corned_fill_and_stroke) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
etk::String data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
"<svg height='100' width='100'>"
|
"<svg height='100' width='100'>"
|
||||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' fill='red' />"
|
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' fill='red' />"
|
||||||
"</svg>");
|
"</svg>");
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
|
|
||||||
TEST(TestExtern, worddown) {
|
TEST(TestExtern, worddown) {
|
||||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"
|
etk::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"
|
||||||
"\n"
|
"\n"
|
||||||
"<svg\n"
|
"<svg\n"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
#include <vector>
|
#include <etk/Vector.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <esvg/esvg.hpp>
|
#include <esvg/esvg.hpp>
|
||||||
|
|
||||||
@ -21,12 +21,12 @@ static void usage() {
|
|||||||
|
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
etk::init(_argc, _argv);
|
etk::init(_argc, _argv);
|
||||||
std::string inputFile;
|
etk::String inputFile;
|
||||||
bool visualTest = false;
|
bool visualTest = false;
|
||||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||||
std::string data = _argv[iii];
|
etk::String data = _argv[iii];
|
||||||
if (etk::start_with(data, "--file=") == true) {
|
if (etk::start_with(data, "--file=") == true) {
|
||||||
inputFile = std::string(&data[7]);
|
inputFile = etk::String(&data[7]);
|
||||||
TEST_PRINT("file='" << inputFile << "'");
|
TEST_PRINT("file='" << inputFile << "'");
|
||||||
} else if (data == "--visual") {
|
} else if (data == "--visual") {
|
||||||
visualTest = true;
|
visualTest = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user