[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:05:16 +02:00
parent 7563abcf5a
commit 8553ffec06
89 changed files with 498 additions and 484 deletions

View File

@ -12,8 +12,8 @@
const float esvg::kappa90(0.5522847493f);
esvg::PaintState::PaintState() :
fill(std::pair<etk::Color<float,4>, std::string>(etk::color::black, "")),
stroke(std::pair<etk::Color<float,4>, std::string>(etk::color::none, "")),
fill(etk::Pair<etk::Color<float,4>, etk::String>(etk::color::black, "")),
stroke(etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "")),
strokeWidth(1.0f),
flagEvenOdd(false),
lineCap(esvg::cap_butt),
@ -25,8 +25,8 @@ esvg::PaintState::PaintState() :
}
void esvg::PaintState::clear() {
fill = std::pair<etk::Color<float,4>, std::string>(etk::color::black, "");
stroke = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
fill = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::black, "");
stroke = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, "");
strokeWidth = 1.0;
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;
}
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);
if (posStart == std::string::npos) {
if (posStart == etk::String::npos) {
// Not find element is a normal case ...
return "";
}
@ -69,31 +69,31 @@ std::string extractTransformData(const std::string& _value, const std::string& _
return "";
}
size_t posEnd = _value.find(')', posStart);
if (posEnd == std::string::npos) {
if (posEnd == etk::String::npos) {
ESVG_ERROR("Missing element ')' in '" << _value << "' for " << _base);
return "";
}
ESVG_VERBOSE("Find : '" << std::string(_value.begin()+posStart, _value.begin()+posEnd) << "' for " << _base);
return std::string(_value.begin()+posStart, _value.begin()+posEnd);
ESVG_VERBOSE("Find : '" << etk::String(_value.begin()+posStart, _value.begin()+posEnd) << "' for " << _base);
return etk::String(_value.begin()+posStart, _value.begin()+posEnd);
}
void esvg::Base::parseTransform(const exml::Element& _element) {
if (_element.exist() == false) {
return;
}
std::string inputString = _element.attributes["transform"];
etk::String inputString = _element.attributes["transform"];
if (inputString.size() == 0) {
return;
}
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] == ',') {
inputString[iii] = ' ';
}
}
ESVG_VERBOSE("find transform : \"" << inputString << "\"");
// need to find elements in order ...
std::string data = extractTransformData(inputString, "matrix");
etk::String data = extractTransformData(inputString, "matrix");
if (data.size() != 0) {
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) {
@ -177,7 +177,7 @@ void esvg::Base::parsePosition(const exml::Element& _element, vec2 &_pos, vec2 &
if (_element.exist() == false) {
return;
}
std::string content = _element.attributes["x"];
etk::String content = _element.attributes["x"];
if (content.size()!=0) {
_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 << "'");
float n = stof(_dataInput);
std::string unit;
float n = _dataInput.to<float>();
etk::String unit;
for (int32_t iii=0; iii<_dataInput.size(); ++iii) {
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|| _dataInput[iii]=='+'
@ -207,46 +207,46 @@ std::pair<float, enum esvg::distance> esvg::Base::parseLength2(const std::string
|| _dataInput[iii]=='.') {
continue;
}
unit = std::string(_dataInput, iii);
unit = etk::String(_dataInput, iii);
break;
}
ESVG_VERBOSE(" lenght : '" << n << "' => unit=" << unit);
// note : ";" is for the parsing of the style elements ...
if(unit.size() == 0) {
return std::make_pair(n, esvg::distance_pixel);
return etk::makePair(n, esvg::distance_pixel);
} 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'
&& 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'
&& 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'
&& 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'
&& 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'
&& 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'
&& 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'
&& 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'
&& 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) {
std::pair<float, enum esvg::distance> value = parseLength2(_dataInput);
float esvg::Base::parseLength(const etk::String& _dataInput) {
etk::Pair<float, enum esvg::distance> value = parseLength2(_dataInput);
ESVG_VERBOSE(" lenght : '" << value.first << "' => unit=" << value.second);
float font_size = 20.0f;
switch (value.second) {
@ -280,13 +280,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
bool fillNone = false;
bool strokeNone = false;
*/
std::string content;
etk::String content;
// ---------------- get unique ID ----------------
m_id = _element.attributes["id"];
// ---------------- stroke ----------------
content = _element.attributes["stroke"];
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 {
if (content.size()!=0) {
m_paint.stroke = parseColor(content);
@ -298,7 +298,7 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
content = _element.attributes["stroke-opacity"];
if (content.size()!=0) {
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);
}
@ -339,13 +339,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
content = _element.attributes["stroke-miterlimit"];
if (content.size()!=0) {
float tmp = parseLength(content);
m_paint.miterLimit = std::max(0.0f, tmp);
m_paint.miterLimit = etk::max(0.0f, tmp);
}
}
// ---------------- FILL ----------------
content = _element.attributes["fill"];
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 {
if (content.size()!=0) {
m_paint.fill = parseColor(content);
@ -353,7 +353,7 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
content = _element.attributes["fill-opacity"];
if (content.size()!=0) {
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);
}
content = _element.attributes["fill-rule"];
@ -370,13 +370,13 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
content = _element.attributes["opacity"];
if (content.size()!=0) {
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) {
std::pair<etk::Color<float,4>, std::string> localColor(etk::color::white, "");
etk::Pair<etk::Color<float,4>, etk::String> esvg::Base::parseColor(const etk::String& _inputData) {
etk::Pair<etk::Color<float,4>, etk::String> localColor(etk::color::white, "");
if( _inputData.size() > 4
&& _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[3] == '(') {
if (_inputData[4] == '#') {
std::string color(_inputData.begin() + 5, _inputData.end()-1);
localColor = std::pair<etk::Color<float,4>, std::string>(etk::color::none, color);
etk::String color(_inputData.begin() + 5, _inputData.end()-1);
localColor = etk::Pair<etk::Color<float,4>, etk::String>(etk::color::none, color);
} else {
ESVG_ERROR("Problem in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
}
} 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);
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;
}
void esvg::Base::setId(const std::string& _newId) {
void esvg::Base::setId(const etk::String& _newId) {
// TODO : Check if it is UNIQUE ...
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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -11,7 +11,7 @@
#pragma once
#include <etk/types.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/math/Matrix2x3.hpp>
#include <etk/Color.hpp>
@ -38,14 +38,14 @@ namespace esvg {
PaintState();
void clear();
public:
std::pair<etk::Color<float,4>, std::string> fill;
std::pair<etk::Color<float,4>, std::string> stroke;
etk::Pair<etk::Color<float,4>, etk::String> fill;
etk::Pair<etk::Color<float,4>, etk::String> stroke;
float strokeWidth;
bool flagEvenOdd; //!< Fill rules
enum esvg::cap lineCap;
enum esvg::join lineJoin;
float miterLimit;
std::pair<vec2, vec2> viewPort; //!< min pos, max pos
etk::Pair<vec2, vec2> viewPort; //!< min pos, max pos
float opacity;
};
@ -79,7 +79,7 @@ namespace esvg {
* @param[in] _basicTrans Parant transformation of the environement
* @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,
float _threshold,
mat2x3& _basicTrans,
@ -99,8 +99,8 @@ namespace esvg {
* @param[in] _dataInput Data C String with the printed lenght
* @return standard number of pixels
*/
float parseLength(const std::string& _dataInput);
std::pair<float, enum esvg::distance> parseLength2(const std::string& _dataInput);
float parseLength(const etk::String& _dataInput);
etk::Pair<float, enum esvg::distance> parseLength2(const etk::String& _dataInput);
/**
* @brief parse a Painting attribute of a specific node
* @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
* @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:
std::string m_id; //!< unique ID of the element.
etk::String m_id; //!< unique ID of the element.
public:
/**
* @brief Get the ID of the Element
* @return UniqueId in the svg file
*/
const std::string& getId() const;
const etk::String& getId() const;
/**
* @brief Set the ID of the Element
* @param[in] _newId New Id of the element
*/
void setId(const std::string& _newId);
void setId(const etk::String& _newId);
};
};

View File

@ -29,7 +29,7 @@ bool esvg::Circle::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
std::string content = _element.attributes["cx"];
etk::String content = _element.attributes["cx"];
if (content.size()!=0) {
m_position.setX(parseLength(content));
}
@ -143,7 +143,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
#endif
}
void esvg::Circle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
void esvg::Circle::drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
int32_t _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
@ -156,11 +156,11 @@ void esvg::Circle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -18,7 +18,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -33,7 +33,7 @@ esvg::Dimension::Dimension(const vec2& _size, enum esvg::distance _type) :
set(_size, _type);
}
void esvg::Dimension::set(std::string _config) {
void esvg::Dimension::set(etk::String _config) {
m_data.setValue(0,0);
m_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 );
}
static enum esvg::distance parseType(std::string& _config) {
static enum esvg::distance parseType(etk::String& _config) {
enum esvg::distance type = esvg::distance_pixel;
if (etk::end_with(_config, "%", false) == true) {
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_type = esvg::distance_pixel;
enum distance type = esvg::distance_pixel;
@ -125,8 +125,8 @@ esvg::Dimension::~Dimension() {
// nothing to do ...
}
esvg::Dimension::operator std::string() const {
std::string str;
esvg::Dimension::operator etk::String() const {
etk::String str;
str = getValue();
switch(getType()) {
case esvg::distance_pourcent:
@ -214,7 +214,7 @@ vec2 esvg::Dimension::getPixel(const vec2& _upperSize) const {
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) {
case esvg::distance_pourcent:
_os << "%";
@ -256,24 +256,24 @@ std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::distance _obj) {
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();
return _os;
}
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;
}
template<> std::u32string to_u32string<esvg::Dimension>(const esvg::Dimension& _obj) {
return etk::to_u32string(etk::to_string(_obj));
template<> etk::UString toUString<esvg::Dimension>(const esvg::Dimension& _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);
return true;
}
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
template<> bool from_string<esvg::Dimension>(esvg::Dimension& _variableRet, const etk::UString& _value) {
return from_string(_variableRet, etk::toString(_value));
}
};
@ -289,7 +289,7 @@ esvg::Dimension1D::Dimension1D(float _size, enum esvg::distance _type) :
set(_size, _type);
}
void esvg::Dimension1D::set(std::string _config) {
void esvg::Dimension1D::set(etk::String _config) {
m_data = 0;
m_type = esvg::distance_pixel;
enum distance type = esvg::distance_pixel;
@ -330,8 +330,8 @@ esvg::Dimension1D::~Dimension1D() {
// nothing to do ...
}
esvg::Dimension1D::operator std::string() const {
std::string str;
esvg::Dimension1D::operator etk::String() const {
etk::String str;
str = getValue();
switch(getType()) {
case esvg::distance_pourcent:
@ -419,24 +419,24 @@ float esvg::Dimension1D::getPixel(float _upperSize) const {
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();
return _os;
}
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;
}
template<> std::u32string to_u32string<esvg::Dimension1D>(const esvg::Dimension1D& _obj) {
return etk::to_u32string(etk::to_string(_obj));
template<> etk::UString toUString<esvg::Dimension1D>(const esvg::Dimension1D& _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);
return true;
}
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
template<> bool from_string<esvg::Dimension1D>(esvg::Dimension1D& _variableRet, const etk::UString& _value) {
return from_string(_variableRet, etk::toString(_value));
}
};

View File

@ -46,7 +46,7 @@ namespace esvg {
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
Dimension(const etk::String& _config) :
m_data(0,0),
m_type(esvg::distance_pixel) {
set(_config);
@ -56,7 +56,7 @@ namespace esvg {
* @param[in] _configX dimension X 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_type(esvg::distance_pixel) {
set(_configX, _configY);
@ -69,7 +69,7 @@ namespace esvg {
/**
* @brief string cast :
*/
operator std::string() const;
operator etk::String() const;
/**
* @brief get the current dimention.
@ -97,13 +97,13 @@ namespace esvg {
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
void set(etk::String _config);
/**
* @brief set the current dimention in requested type
* @param[in] _configX dimension X configuration.
* @param[in] _configY dimension Y configuration.
*/
void set(std::string _configX, std::string _configY);
void set(etk::String _configX, etk::String _configY);
public:
/**
* @brief get the current dimention in pixel
@ -142,8 +142,8 @@ namespace esvg {
return false;
}
};
std::ostream& operator <<(std::ostream& _os, enum esvg::distance _obj);
std::ostream& operator <<(std::ostream& _os, const esvg::Dimension& _obj);
etk::Stream& operator <<(etk::Stream& _os, enum esvg::distance _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)
* but one case need to be dynamic the %, then when requested in % the register the % value
@ -167,7 +167,7 @@ namespace esvg {
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension1D(const std::string& _config) :
Dimension1D(const etk::String& _config) :
m_data(0.0f),
m_type(esvg::distance_pixel) {
set(_config);
@ -180,7 +180,7 @@ namespace esvg {
/**
* @brief string cast :
*/
operator std::string() const;
operator etk::String() const;
/**
* @brief get the current dimention.
@ -208,7 +208,7 @@ namespace esvg {
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
void set(etk::String _config);
public:
/**
* @brief get the current dimention in pixel
@ -247,6 +247,6 @@ namespace esvg {
return false;
}
};
std::ostream& operator <<(std::ostream& _os, const esvg::Dimension1D& _obj);
etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension1D& _obj);
}

View File

@ -30,7 +30,7 @@ bool esvg::Ellipse::parseXML(const exml::Element& _element, mat2x3& _parentTrans
m_c.setValue(0,0);
m_r.setValue(0,0);
std::string content = _element.attributes["cx"];
etk::String content = _element.attributes["cx"];
if (content.size()!=0) {
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,
float _threshold,
mat2x3& _basicTrans,
@ -162,11 +162,11 @@ void esvg::Ellipse::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -18,7 +18,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -85,10 +85,10 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
elementParser.reset();
continue;
}
_sizeMax.setValue(std::max(_sizeMax.x(), tmpPos.x()),
std::max(_sizeMax.y(), tmpPos.y()));
_sizeMax.setValue(etk::max(_sizeMax.x(), tmpPos.x()),
etk::max(_sizeMax.y(), tmpPos.y()));
// add element in the system
m_subElementList.push_back(elementParser);
m_subElementList.pushBack(elementParser);
}
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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -6,19 +6,19 @@
#pragma once
#include <esvg/Base.hpp>
#include <vector>
#include <etk/Vector.hpp>
namespace esvg {
class Group : public esvg::Base {
private:
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub elements ...
etk::Vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub elements ...
public:
Group(PaintState _parentPaintState);
~Group();
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -30,7 +30,7 @@ bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
std::string content = _element.attributes["x1"];
etk::String content = _element.attributes["x1"];
if (content.size() != 0) {
m_startPos.setX(parseLength(content));
}
@ -46,8 +46,8 @@ bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
if (content.size() != 0) {
m_stopPos.setY(parseLength(content));
}
_sizeMax.setValue(std::max(m_startPos.x(), m_stopPos.x()),
std::max(m_startPos.y(), m_stopPos.y()));
_sizeMax.setValue(etk::max(m_startPos.x(), m_stopPos.x()),
etk::max(m_startPos.y(), m_stopPos.y()));
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,
float _threshold,
mat2x3& _basicTrans,
@ -129,11 +129,11 @@ void esvg::Line::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -18,7 +18,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -41,8 +41,8 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
std::string contentX = _element.attributes["x1"];
std::string contentY = _element.attributes["y1"];
etk::String contentX = _element.attributes["x1"];
etk::String contentY = _element.attributes["y1"];
if ( 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"
m_href = _element.attributes["xlink:href"];
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 :
for(const auto it : _element.nodes) {
@ -90,9 +90,9 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
if (child.getValue() == "stop") {
float offset = 100;
etk::Color<float,4> stopColor = etk::color::none;
std::string content = child.attributes["offset"];
etk::String content = child.attributes["offset"];
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) {
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
offset = tmp.first*100.0f;
@ -110,11 +110,11 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
content = child.attributes["stop-opacity"];
if (content.size()!=0) {
float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f);
opacity = etk::avg(0.0f, opacity, 1.0f);
stopColor.setA(opacity);
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 {
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;
}
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 == "") {
return m_data;
}

View File

@ -19,8 +19,8 @@ namespace esvg {
enum gradientUnits m_unit;
enum spreadMethod m_spread;
private:
std::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::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
etk::Vector<etk::Pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
public:
LinearGradient(PaintState _parentPaintState);
~LinearGradient();
@ -30,7 +30,7 @@ namespace esvg {
public:
const esvg::Dimension& getPosition1();
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);
};
}

View File

@ -19,7 +19,7 @@ esvg::Path::~Path() {
// 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') {
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
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
ESVG_VERBOSE("Find element : " << element);
_outputList.push_back(element);
_outputList.pushBack(element);
iii += nbElementRead;
}
outputPointer = &_input[iii];
@ -56,8 +56,8 @@ const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _out
//outputPointer++;
return outputPointer;
}
std::string cleanBadSpaces(const std::string& _input) {
std::string out;
etk::String cleanBadSpaces(const etk::String& _input) {
etk::String out;
bool haveSpace = false;
for (auto &it : _input) {
if ( it == ' '
@ -87,7 +87,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
m_transformMatrix *= _parentTrans;
std::string elementXML1 = _element.attributes["d"];
etk::String elementXML1 = _element.attributes["d"];
if (elementXML1.size() == 0) {
ESVG_WARNING("(l "<<_element.getPos()<<") path: missing 'd' attribute or empty");
return false;
@ -95,7 +95,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, v
ESVG_VERBOSE("Parse Path : \"" << elementXML1 << "\"");
char command;
std::vector<float> listDot;
etk::Vector<float> listDot;
elementXML1 = cleanBadSpaces(elementXML1);
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,
float _threshold,
mat2x3& _basicTrans,
@ -339,11 +339,11 @@ void esvg::Path::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = m_listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -18,7 +18,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -31,7 +31,7 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
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) {
ESVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute");
return false;
@ -43,10 +43,10 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
vec2 pos(0,0);
int32_t n;
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;
_sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
std::max(_sizeMax.y(), pos.y()));
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
etk::max(_sizeMax.y(), pos.y()));
if(sss[0] == ' ' || sss[0] == ',') {
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,
float _threshold,
mat2x3& _basicTrans,
@ -143,11 +143,11 @@ void esvg::Polygon::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -6,7 +6,7 @@
#pragma once
#include <esvg/Base.hpp>
#include <vector>
#include <etk/Vector.hpp>
namespace esvg {
/*
@ -17,7 +17,7 @@ namespace esvg {
*/
class Polygon : public esvg::Base {
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
public:
Polygon(PaintState parentPaintState);
@ -25,7 +25,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -29,7 +29,7 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
std::string sss1 = _element.attributes["points"];
etk::String sss1 = _element.attributes["points"];
if (sss1.size() == 0) {
ESVG_ERROR("(l "<<_element.getPos()<<") polyline: missing points attribute");
return false;
@ -41,9 +41,9 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
vec2 pos;
int32_t n;
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
m_listPoint.push_back(pos);
_sizeMax.setValue(std::max(_sizeMax.x(), pos.x()),
std::max(_sizeMax.y(), pos.y()));
m_listPoint.pushBack(pos);
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
etk::max(_sizeMax.y(), pos.y()));
sss += n;
} else {
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,
float _threshold,
mat2x3& _basicTrans,
@ -140,10 +140,10 @@ void esvg::Polyline::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -6,19 +6,19 @@
#pragma once
#include <esvg/Base.hpp>
#include <vector>
#include <etk/Vector.hpp>
namespace esvg {
class Polyline : public esvg::Base {
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:
Polyline(PaintState _parentPaintState);
~Polyline();
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -42,8 +42,8 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
std::string contentX = _element.attributes["cx"];
std::string contentY = _element.attributes["cy"];
etk::String contentX = _element.attributes["cx"];
etk::String contentY = _element.attributes["cy"];
if ( 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"
m_href = _element.attributes["xlink:href"];
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 :
for(auto it : _element.nodes) {
@ -95,9 +95,9 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
if (child.getValue() == "stop") {
float offset = 100;
etk::Color<float,4> stopColor = etk::color::none;
std::string content = child.attributes["offset"];
etk::String content = child.attributes["offset"];
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) {
// special case ==> all time % then no type define ==> % in [0.0 .. 1.0]
offset = tmp.first*100.0f;
@ -115,11 +115,11 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
content = child.attributes["stop-opacity"];
if (content.size()!=0) {
float opacity = parseLength(content);
opacity = std::avg(0.0f, opacity, 1.0f);
opacity = etk::avg(0.0f, opacity, 1.0f);
stopColor.setA(opacity);
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 {
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;
}
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 == "") {
return m_data;
}

View File

@ -20,8 +20,8 @@ namespace esvg {
enum gradientUnits m_unit;
enum spreadMethod m_spread;
private:
std::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::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
etk::Vector<etk::Pair<float, etk::Color<float,4>>> m_data; //!< incompatible with href
public:
RadialGradient(PaintState _parentPaintState);
~RadialGradient();
@ -32,7 +32,7 @@ namespace esvg {
const esvg::Dimension& getCenter();
const esvg::Dimension& getFocal();
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);
};
}

View File

@ -35,7 +35,7 @@ bool esvg::Rectangle::parseXML(const exml::Element& _element, mat2x3& _parentTra
parsePosition(_element, m_position, m_size);
std::string content = _element.attributes["rx"];
etk::String content = _element.attributes["rx"];
if (content.size()!=0) {
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,
float _threshold,
mat2x3& _basicTrans,
@ -157,10 +157,10 @@ void esvg::Rectangle::drawShapePoints(std::vector<std::vector<vec2>>& _out,
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
for (auto &it : listPoints.m_data) {
std::vector<vec2> listPoint;
etk::Vector<vec2> listPoint;
for (auto &itDot : it) {
listPoint.push_back(itDot.m_pos);
listPoint.pushBack(itDot.m_pos);
}
_out.push_back(listPoint);
_out.pushBack(listPoint);
}
}

View File

@ -19,7 +19,7 @@ namespace esvg {
bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, vec2& _sizeMax) override;
void display(int32_t _spacing) 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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -58,11 +58,11 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
ememory::SharedPtr<esvg::render::DynamicColor>& _colorStroke,
float _opacity) {
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);
}
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);
}
// all together
@ -123,7 +123,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
false);
/*
mat2x3 m_matrix;
std::pair<vec2, vec2> m_viewPort;
etk::Pair<vec2, vec2> m_viewPort;
vec2 m_pos1;
vec2 m_pos2;
*/
@ -141,25 +141,25 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
// for each lines:
for (int32_t yyy=0; yyy<dynamicSize.y(); ++yyy) {
// 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) {
if ( it.p0.y() * m_factor <= float(yyy+1)
&& 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:
float subSamplingCenterPos = yyy + 0.5f;
std::vector<esvg::render::Segment> availlableSegment;
etk::Vector<esvg::render::Segment> availlableSegment;
// find in the subList ...
for (auto &it : availlableSegmentPixel) {
if ( it.p0.y() * m_factor <= subSamplingCenterPos
&& it.p1.y() * m_factor >= subSamplingCenterPos ) {
availlableSegment.push_back(it);
availlableSegment.pushBack(it);
}
}
// x position, angle
std::vector<std::pair<float, float>> listPosition;
etk::Vector<etk::Pair<float, float>> listPosition;
for (auto &it : availlableSegment) {
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
// x = coefficent*y+bbb;
@ -181,29 +181,29 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
// for each colomn:
for (int32_t xxx=0; xxx<dynamicSize.x(); ++xxx) {
// 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) {
if ( ( it.p0.x() * m_factor <= float(xxx+1)
&& it.p1.x() * m_factor >= float(xxx) )
|| ( it.p0.x() * m_factor >= float(xxx+1)
&& 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:
float subSamplingCenterPos = xxx + 0.5f;
std::vector<esvg::render::Segment> availlableSegment;
etk::Vector<esvg::render::Segment> availlableSegment;
// find in the subList ...
for (auto &it : availlableSegmentPixel) {
if ( ( it.p0.x() * m_factor <= subSamplingCenterPos
&& it.p1.x() * m_factor >= subSamplingCenterPos)
|| ( it.p0.x() * m_factor >= subSamplingCenterPos
&& it.p1.x() * m_factor <= subSamplingCenterPos) ) {
availlableSegment.push_back(it);
availlableSegment.pushBack(it);
}
}
// x position, angle
std::vector<std::pair<float, float>> listPosition;
etk::Vector<etk::Pair<float, float>> listPosition;
for (auto &it : availlableSegment) {
vec2 delta = it.p0 * m_factor - it.p1 * m_factor;
// x = coefficent*y+bbb;
@ -229,7 +229,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
#endif
void esvg::Renderer::writePPM(const std::string& _fileName) {
void esvg::Renderer::writePPM(const etk::String& _fileName) {
if (m_buffer.size() == 0) {
return;
}
@ -290,7 +290,7 @@ extern "C" {
};
#pragma pack(pop)
}
void esvg::Renderer::writeBMP(const std::string& _fileName) {
void esvg::Renderer::writeBMP(const etk::String& _fileName) {
if (m_buffer.size() == 0) {
return;
}
@ -385,7 +385,7 @@ const ivec2& esvg::Renderer::getSize() const {
return m_size;
}
std::vector<etk::Color<float,4>> esvg::Renderer::getData() {
etk::Vector<etk::Color<float,4>> esvg::Renderer::getData() {
return m_buffer;
}
@ -393,7 +393,7 @@ std::vector<etk::Color<float,4>> esvg::Renderer::getData() {
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 {
@ -401,7 +401,7 @@ int32_t esvg::Renderer::getInterpolationRecurtionMax() const {
}
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 {
@ -409,7 +409,7 @@ float esvg::Renderer::getInterpolationThreshold() const {
}
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 {

View File

@ -28,9 +28,9 @@ namespace esvg {
void setSize(const ivec2& _size);
const ivec2& getSize() const;
protected:
std::vector<etk::Color<float,4>> m_buffer;
etk::Vector<etk::Color<float,4>> m_buffer;
public:
std::vector<etk::Color<float,4>> getData();
etk::Vector<etk::Color<float,4>> getData();
protected:
int32_t m_interpolationRecurtionMax;
public:
@ -47,8 +47,8 @@ namespace esvg {
void setNumberSubScanLine(int32_t _value);
int32_t getNumberSubScanLine() const;
public:
void writePPM(const std::string& _fileName);
void writeBMP(const std::string& _fileName);
void writePPM(const etk::String& _fileName);
void writeBMP(const etk::String& _fileName);
protected:
etk::Color<float,4> mergeColor(etk::Color<float,4> _base, etk::Color<float,4> _integration);
public:
@ -59,7 +59,7 @@ namespace esvg {
float _opacity);
#ifdef DEBUG
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
protected:
esvg::Document* m_document;

View File

@ -13,7 +13,7 @@ static const char* values[] = {
"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];
return _os;
}

View File

@ -16,6 +16,6 @@ namespace esvg {
/**
* @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);
}

View File

@ -58,10 +58,10 @@ void esvg::Document::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
}
// 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);
}
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;
if (sizeRender.x() <= 0) {
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) {
_size.setX(m_size.x());
}
@ -106,10 +106,10 @@ std::vector<etk::Color<float,4>> esvg::Document::renderImageFloatRGBA(ivec2& _si
return renderedElement->getData();
}
std::vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _size) {
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
etk::Vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _size) {
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
// Reduce scope:
std::vector<etk::Color<float,3>> out;
etk::Vector<etk::Color<float,3>> out;
out.resize(data.size());
for (size_t iii=0; iii<data.size(); ++iii) {
out[iii] = data[iii];
@ -117,10 +117,10 @@ std::vector<etk::Color<float,3>> esvg::Document::renderImageFloatRGB(ivec2& _siz
return out;
}
std::vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _size) {
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
etk::Vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _size) {
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
// Reduce scope:
std::vector<etk::Color<uint8_t,4>> out;
etk::Vector<etk::Color<uint8_t,4>> out;
out.resize(data.size());
for (size_t iii=0; iii<data.size(); ++iii) {
out[iii] = data[iii];
@ -128,10 +128,10 @@ std::vector<etk::Color<uint8_t,4>> esvg::Document::renderImageU8RGBA(ivec2& _siz
return out;
}
std::vector<etk::Color<uint8_t,3>> esvg::Document::renderImageU8RGB(ivec2& _size) {
std::vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
etk::Vector<etk::Color<uint8_t,3>> esvg::Document::renderImageU8RGB(ivec2& _size) {
etk::Vector<etk::Color<float,4>> data = renderImageFloatRGBA(_size);
// Reduce scope:
std::vector<etk::Color<uint8_t,3>> out;
etk::Vector<etk::Color<uint8_t,3>> out;
out.resize(data.size());
for (size_t iii=0; iii<data.size(); ++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();
exml::Document doc;
if (doc.parse(_data) == false) {
@ -172,11 +172,11 @@ bool esvg::Document::parse(const std::string& _data) {
return m_loadOK;
}
bool esvg::Document::generate(std::string& _data) {
bool esvg::Document::generate(etk::String& _data) {
return false;
}
bool esvg::Document::load(const std::string& _file) {
bool esvg::Document::load(const etk::String& _file) {
clear();
m_fileName = _file;
exml::Document doc;
@ -201,7 +201,7 @@ bool esvg::Document::load(const std::string& _file) {
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...");
return false;
}
@ -215,11 +215,11 @@ bool esvg::Document::cleanStyleProperty(const exml::Element& _root) {
}
// get attribute style:
if (child.attributes.exist("style") == true) {
std::string content = child.attributes["style"];
etk::String content = child.attributes["style"];
if (content.size() != 0) {
std::vector<std::string> listStyle = etk::split(content, ';');
etk::Vector<etk::String> listStyle = etk::split(content, ';');
for (auto &it : listStyle) {
std::vector<std::string> value = etk::split(it, ':');
etk::Vector<etk::String> value = etk::split(it, ':');
if (value.size() != 2) {
ESVG_ERROR("parsing style with a wrong patern : " << it << " missing ':'");
continue;
@ -333,9 +333,9 @@ bool esvg::Document::parseXMLData(const exml::Element& _root, bool _isReference)
}
// add element in the system
if (_isReference == false) {
m_subElementList.push_back(elementParser);
m_subElementList.pushBack(elementParser);
} else {
m_refList.push_back(elementParser);
m_refList.pushBack(elementParser);
}
}
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 == "") {
ESVG_ERROR("request a reference with no name ... ");
return nullptr;
@ -369,8 +369,8 @@ ememory::SharedPtr<esvg::Base> esvg::Document::getReference(const std::string& _
return nullptr;
}
std::vector<std::vector<vec2>> esvg::Document::getLines(vec2 _size) {
std::vector<std::vector<vec2>> out;
etk::Vector<etk::Vector<vec2>> esvg::Document::getLines(vec2 _size) {
etk::Vector<etk::Vector<vec2>> out;
if (_size.x() <= 0) {
_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,
float _threshold,
mat2x3& _basicTrans,

View File

@ -6,7 +6,7 @@
#pragma once
#include <etk/types.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/os/FSNode.hpp>
@ -18,12 +18,12 @@
namespace esvg {
class Document : public esvg::Base {
private:
std::string m_fileName;
etk::String m_fileName;
bool m_loadOK;
std::string m_version;
std::string m_title;
std::vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub-element list
std::vector<ememory::SharedPtr<esvg::Base>> m_refList; //!< reference elements ...
etk::String m_version;
etk::String m_title;
etk::Vector<ememory::SharedPtr<esvg::Base>> m_subElementList; //!< sub-element list
etk::Vector<ememory::SharedPtr<esvg::Base>> m_refList; //!< reference elements ...
vec2 m_size;
public:
Document();
@ -35,28 +35,28 @@ namespace esvg {
* @return false : An error occured
* @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
* @param[out] _data Data where the svg is stored
* @return false : An error occured
* @return true : Parsing is OK
*/
bool generate(std::string& _data);
bool generate(etk::String& _data);
/**
* @brief Load the file that might contain the svg
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
* @return false : An error occured
* @return true : Parsing is OK
*/
bool load(const std::string& _file);
bool load(const etk::String& _file);
/**
* @brief Store the SVG in the file
* @param[in] _file Filename of the svg (compatible with etk FSNode naming)
* @return false : An error occured
* @return true : Parsing is OK
*/
bool store(const std::string& _file);
bool store(const etk::String& _file);
protected:
/**
* @brief change all style in a xml atribute
@ -72,30 +72,30 @@ namespace esvg {
*/
void displayDebug();
// TODO: remove this fucntion : use generic function ...
void generateAnImage(const std::string& _fileName, bool _visualDebug=false);
void generateAnImage(const ivec2& _size, const std::string& _fileName, bool _visualDebug=false);
void generateAnImage(const etk::String& _fileName, bool _visualDebug=false);
void generateAnImage(const ivec2& _size, const etk::String& _fileName, bool _visualDebug=false);
/**
* @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
* @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
std::vector<etk::Color<float,3>> renderImageFloatRGB(ivec2& _size);
etk::Vector<etk::Color<float,3>> renderImageFloatRGB(ivec2& _size);
//! @previous
std::vector<etk::Color<uint8_t,4>> renderImageU8RGBA(ivec2& _size);
etk::Vector<etk::Color<uint8_t,4>> renderImageU8RGBA(ivec2& _size);
//! @previous
std::vector<etk::Color<uint8_t,3>> renderImageU8RGB(ivec2& _size);
std::vector<std::vector<vec2>> getLines(vec2 _size=vec2(256,256));
etk::Vector<etk::Color<uint8_t,3>> renderImageU8RGB(ivec2& _size);
etk::Vector<etk::Vector<vec2>> getLines(vec2 _size=vec2(256,256));
protected:
void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level=0) override;
public:
vec2 getDefinedSize() {
return m_size;
};
ememory::SharedPtr<esvg::Base> getReference(const std::string& _name);
ememory::SharedPtr<esvg::Base> getReference(const etk::String& _name);
protected:
void drawShapePoints(std::vector<std::vector<vec2>>& _out,
void drawShapePoints(etk::Vector<etk::Vector<vec2>>& _out,
int32_t _recurtionMax,
float _threshold,
mat2x3& _basicTrans,

View File

@ -12,7 +12,7 @@ static const char* values[] = {
"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];
return _os;
}

View File

@ -15,5 +15,5 @@ namespace esvg {
/**
* @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);
}

View File

@ -13,7 +13,7 @@ static const char* values[] = {
"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];
return _os;
}

View File

@ -16,7 +16,7 @@ namespace esvg {
/**
* @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);
}

View File

@ -10,7 +10,7 @@
#include <esvg/RadialGradient.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_colorName(_link),
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;
}
@ -162,7 +162,7 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorLinear(const ivec
}
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& _center = vec2(0.0f, 0.0f),
float _radius = 1.0f) {
@ -180,10 +180,10 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
float distToCenter = (midpt - _center).length2();
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) {
return std::pair<vec2,vec2>(midpt, midpt);
return etk::Pair<vec2,vec2>(midpt, midpt);
}
float distToIntersection;
if (distToCenter == 0.0f) {
@ -200,7 +200,7 @@ static std::pair<vec2,vec2> intersectLineToCircle(const vec2& _pos1,
// normalize...
v1.safeNormalize();
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 {
@ -252,7 +252,7 @@ etk::Color<float,4> esvg::render::DynamicColorSpecial::getColorRadial(const ivec
if (focalCenter == currentPoint) {
ratio = 0.0f;
} else {
std::pair<vec2,vec2> positions = intersectLineToCircle(focalCenter, currentPoint);
etk::Pair<vec2,vec2> positions = intersectLineToCircle(focalCenter, currentPoint);
float lenghtBase = (currentPoint - focalCenter).length();
float lenghtBorder1 = (positions.first - 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:
if ( _color.first.a() == 0x00
&& _color.second == "") {

View File

@ -24,7 +24,7 @@ namespace esvg {
virtual ~DynamicColor() {};
virtual etk::Color<float,4> getColor(const ivec2& _pos) const = 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 {
public:
@ -40,7 +40,7 @@ namespace esvg {
virtual void generate(esvg::Document* _document) {
// nothing to do ...
}
virtual void setViewPort(const std::pair<vec2, vec2>& _viewPort) {
virtual void setViewPort(const etk::Pair<vec2, vec2>& _viewPort) {
// nothing to do ...
};
};
@ -49,9 +49,9 @@ namespace esvg {
bool m_linear;
esvg::spreadMethod m_spread;
esvg::gradientUnits m_unit;
std::string m_colorName;
etk::String m_colorName;
mat2x3 m_matrix;
std::pair<vec2, vec2> m_viewPort;
etk::Pair<vec2, vec2> m_viewPort;
vec2 m_pos1; // in radius ==> center
vec2 m_pos2; // in radius ==> radius end position
vec2 m_focal; // Specific radius
@ -61,19 +61,19 @@ namespace esvg {
float m_focalLength;
bool m_clipOut;
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:
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;
private:
etk::Color<float,4> getColorLinear(const ivec2& _pos) const;
etk::Color<float,4> getColorRadial(const ivec2& _pos) const;
public:
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);
}
}

View File

@ -7,7 +7,7 @@
#include <esvg/render/Element.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) {
case esvg::render::path_stop:
_os << "path_stop";
@ -48,9 +48,9 @@ std::ostream& esvg::operator <<(std::ostream& _os, enum esvg::render::path _obj)
};
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 << ": rel=" << etk::to_string(_obj.getRelative()) << " ";
_os << ": rel=" << etk::toString(_obj.getRelative()) << " ";
_os << _obj.display();
return _os;
}

View File

@ -74,17 +74,17 @@ namespace esvg {
m_pos2 = _val;
}
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
*/
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
*/
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>

View File

@ -13,6 +13,6 @@ esvg::render::ElementBezierCurveTo::ElementBezierCurveTo(bool _relative, const v
m_pos1 = _pos1;
}
std::string esvg::render::ElementBezierCurveTo::display() const {
return std::string("pos=") + etk::to_string(m_pos) + " pos1=" + etk::to_string(m_pos1);
etk::String esvg::render::ElementBezierCurveTo::display() const {
return etk::String("pos=") + etk::toString(m_pos) + " pos1=" + etk::toString(m_pos1);
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementBezierCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -13,6 +13,6 @@ esvg::render::ElementBezierSmoothCurveTo::ElementBezierSmoothCurveTo(bool _relat
}
std::string esvg::render::ElementBezierSmoothCurveTo::display() const {
return std::string("pos=") + etk::to_string(m_pos);
etk::String esvg::render::ElementBezierSmoothCurveTo::display() const {
return etk::String("pos=") + etk::toString(m_pos);
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementBezierSmoothCurveTo(bool _relative, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -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 "";
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementClose(bool _relative=false);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -16,6 +16,6 @@ esvg::render::ElementCurveTo::ElementCurveTo(bool _relative, const vec2& _pos1,
std::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);
etk::String esvg::render::ElementCurveTo::display() const {
return etk::String("pos=") + etk::toString(m_pos) + " pos1=" + etk::toString(m_pos1) + " pos2=" + etk::toString(m_pos2);
}

View File

@ -14,7 +14,7 @@ namespace esvg {
public:
ElementCurveTo(bool _relative, const vec2& _pos1, const vec2& _pos2, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -22,10 +22,10 @@ esvg::render::ElementElliptic::ElementElliptic(bool _relative,
}
std::string esvg::render::ElementElliptic::display() const {
return std::string("pos=") + etk::to_string(m_pos)
+ " radius=" + etk::to_string(m_pos1)
+ " angle=" + etk::to_string(m_angle)
+ " largeArcFlag=" + etk::to_string(m_largeArcFlag)
+ " sweepFlag=" + etk::to_string(m_sweepFlag);
etk::String esvg::render::ElementElliptic::display() const {
return etk::String("pos=") + etk::toString(m_pos)
+ " radius=" + etk::toString(m_pos1)
+ " angle=" + etk::toString(m_angle)
+ " largeArcFlag=" + etk::toString(m_largeArcFlag)
+ " sweepFlag=" + etk::toString(m_sweepFlag);
}

View File

@ -24,7 +24,7 @@ namespace esvg {
bool _sweepFlag,
const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -13,6 +13,6 @@ esvg::render::ElementLineTo::ElementLineTo(bool _relative, const vec2& _pos):
}
std::string esvg::render::ElementLineTo::display() const {
return std::string("pos=") + etk::to_string(m_pos);
etk::String esvg::render::ElementLineTo::display() const {
return etk::String("pos=") + etk::toString(m_pos);
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementLineTo(bool _relative, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -13,6 +13,6 @@ esvg::render::ElementLineToH::ElementLineToH(bool _relative, float _posX):
}
std::string esvg::render::ElementLineToH::display() const {
return std::string("posX=") + etk::to_string(m_pos.x());
etk::String esvg::render::ElementLineToH::display() const {
return etk::String("posX=") + etk::toString(m_pos.x());
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementLineToH(bool _relative, float _posX);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -13,6 +13,6 @@ esvg::render::ElementLineToV::ElementLineToV(bool _relative, float _posY):
}
std::string esvg::render::ElementLineToV::display() const {
return std::string("posY=") + etk::to_string(m_pos.y());
etk::String esvg::render::ElementLineToV::display() const {
return etk::String("posY=") + etk::toString(m_pos.y());
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementLineToV(bool _relative, float _posY);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -13,6 +13,6 @@ esvg::render::ElementMoveTo::ElementMoveTo(bool _relative, const vec2& _pos):
}
std::string esvg::render::ElementMoveTo::display() const {
return std::string("pos=") + etk::to_string(m_pos);
etk::String esvg::render::ElementMoveTo::display() const {
return etk::String("pos=") + etk::toString(m_pos);
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementMoveTo(bool _relative, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -14,6 +14,6 @@ esvg::render::ElementSmoothCurveTo::ElementSmoothCurveTo(bool _relative, const v
}
std::string esvg::render::ElementSmoothCurveTo::display() const {
return std::string("pos=") + etk::to_string(m_pos) + " pos2=" + etk::to_string(m_pos2);
etk::String esvg::render::ElementSmoothCurveTo::display() const {
return etk::String("pos=") + etk::toString(m_pos) + " pos2=" + etk::toString(m_pos2);
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementSmoothCurveTo(bool _relative, const vec2& _pos2, const vec2& _pos);
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -12,7 +12,7 @@ esvg::render::ElementStop::ElementStop():
}
std::string esvg::render::ElementStop::display() const {
etk::String esvg::render::ElementStop::display() const {
return "";
}

View File

@ -15,7 +15,7 @@ namespace esvg {
public:
ElementStop();
public:
virtual std::string display() const;
virtual etk::String display() const;
};
}
}

View File

@ -12,43 +12,43 @@ void esvg::render::Path::clear() {
}
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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,
@ -57,7 +57,7 @@ void esvg::render::Path::ellipticTo(bool _relative,
bool _largeArcFlag,
bool _sweepFlag,
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) {
@ -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,
float _threshold,
vec2 _pos1,
@ -105,7 +105,7 @@ void interpolateCubicBezier(std::vector<esvg::render::Point>& _listPoint,
#endif
if ((distance2 + distance3)*(distance2 + distance3) < _threshold * delta.length2()) {
_listPoint.push_back(esvg::render::Point(_pos4, _type) );
_listPoint.pushBack(esvg::render::Point(_pos4, _type) );
return;
}
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_VERBOSE(spacingDist(_level) << "Generate List Points ... from a path");
esvg::render::PointList out;
std::vector<esvg::render::Point> tmpListPoint;
etk::Vector<esvg::render::Point> tmpListPoint;
vec2 lastPosition(0.0f, 0.0f);
vec2 lastAngle(0.0f, 0.0f);
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();
if ( delta.x() <= 0.00001
&& delta.y() <= 0.00001) {
tmpListPoint.pop_back();
tmpListPoint.popBack();
ESVG_VERBOSE(" Remove point Z property : " << tmpListPoint.back().m_pos << " with delta=" << delta);
}
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 += 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;
break;
case esvg::render::path_lineTo:
// If no previous point, we need to create the last point has start ...
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) {
lastPosition = vec2(0.0f, 0.0f);
}
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;
break;
case esvg::render::path_lineToH:
// If no previous point, we need to create the last point has start ...
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) {
lastPosition = vec2(0.0f, 0.0f);
}
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;
break;
case esvg::render::path_lineToV:
// If no previous point, we need to create the last point has start ...
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) {
lastPosition = vec2(0.0f, 0.0f);
}
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;
break;
case esvg::render::path_curveTo:
// If no previous point, we need to create the last point has start ...
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);
@ -251,7 +251,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
case esvg::render::path_smoothCurveTo:
// If no previous point, we need to create the last point has start ...
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);
@ -278,7 +278,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
case esvg::render::path_bezierCurveTo:
// If no previous point, we need to create the last point has start ...
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);
@ -306,7 +306,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
case esvg::render::path_bezierSmoothCurveTo:
// If no previous point, we need to create the last point has start ...
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);
@ -334,7 +334,7 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
case esvg::render::path_elliptic:
// If no previous point, we need to create the last point has start ...
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));
@ -363,9 +363,9 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
|| radius.y() < 1e-6f) {
ESVG_WARNING("Degenerate arc in Line");
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 {
// Convert to center point parameterization.
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes

View File

@ -18,7 +18,7 @@ namespace esvg {
namespace render {
class Path {
public:
std::vector<ememory::SharedPtr<esvg::render::Element>> m_listElement;
etk::Vector<ememory::SharedPtr<esvg::render::Element>> m_listElement;
#ifdef DEBUG
esvg::render::SegmentList m_debugInformation;
#endif

View File

@ -31,6 +31,12 @@ namespace esvg {
vec2 m_posNext;
vec2 m_delta;
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) :
m_pos(_pos),
m_type(_type) {

View File

@ -11,8 +11,8 @@ esvg::render::PointList::PointList() {
// nothing to do ...
}
void esvg::render::PointList::addList(std::vector<esvg::render::Point>& _list) {
m_data.push_back(_list);
void esvg::render::PointList::addList(etk::Vector<esvg::render::Point>& _list) {
m_data.pushBack(_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() {
std::pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
etk::Pair<vec2, vec2> esvg::render::PointList::getViewPort() {
etk::Pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
for (auto &it : m_data) {
for (auto &it2 : it) {
out.first.setMin(it2.m_pos);

View File

@ -15,13 +15,13 @@ namespace esvg {
namespace render {
class PointList {
public:
std::vector<std::vector<esvg::render::Point>> m_data;
etk::Vector<etk::Vector<esvg::render::Point>> m_data;
public:
PointList();
void addList(std::vector<esvg::render::Point>& _list);
void addList(etk::Vector<esvg::render::Point>& _list);
void display();
void applyMatrix(const mat2x3& _transformationMatrix);
std::pair<vec2, vec2> getViewPort();
etk::Pair<vec2, vec2> getViewPort();
};
}
}

View File

@ -12,7 +12,7 @@ namespace esvg {
namespace render {
class Scanline {
private:
std::vector<float> m_data;
etk::Vector<float> m_data;
public:
// constructor :
Scanline(size_t _size=32);

View File

@ -7,6 +7,12 @@
#include <esvg/render/Segment.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) {
// segment register all time the lower at P0n then we need to register the sens of the path
p0 = _p0;

View File

@ -13,6 +13,8 @@ namespace esvg {
namespace render {
class Segment {
public:
// TODO: Update etk::Vector to support not having it ...
Segment();
Segment(const vec2& _p0, const vec2& _p1);
vec2 p0;
vec2 p1;

View File

@ -13,7 +13,7 @@ esvg::render::SegmentList::SegmentList() {
}
#ifdef DEBUG
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
@ -23,7 +23,7 @@ void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, con
// remove /0 operation
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) {
@ -33,11 +33,11 @@ void esvg::render::SegmentList::addSegment(const esvg::render::Point& _pos0, con
// remove /0 operation
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() {
std::pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
etk::Pair<vec2, vec2> esvg::render::SegmentList::getViewPort() {
etk::Pair<vec2, vec2> out(vec2(9999999999.0,9999999999.0),vec2(-9999999999.0,-9999999999.0));
for (auto &it : m_data) {
out.first.setMin(it.p0);
out.second.setMax(it.p0);

View File

@ -16,7 +16,7 @@ namespace esvg {
namespace render {
class SegmentList {
public:
std::vector<esvg::render::Segment> m_data;
etk::Vector<esvg::render::Segment> m_data;
public:
SegmentList();
#ifdef DEBUG
@ -43,7 +43,7 @@ namespace esvg {
float _width,
bool _isStart);
public:
std::pair<vec2, vec2> getViewPort();
etk::Pair<vec2, vec2> getViewPort();
void applyMatrix(const mat2x3& _transformationMatrix);
};
}

View File

@ -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;
}
@ -93,11 +93,11 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
for (int32_t yyy=0; yyy<_size.y(); ++yyy) {
ESVG_VERBOSE("Weighting ... " << yyy << " / " << _size.y());
// Reduce the number of lines in the subsampling parsing:
std::vector<Segment> availlableSegmentPixel;
etk::Vector<Segment> availlableSegmentPixel;
for (auto &it : _listSegment.m_data) {
if ( it.p0.y() < float(yyy+1)
&& it.p1.y() > float(yyy)) {
availlableSegmentPixel.push_back(it);
availlableSegmentPixel.pushBack(it);
}
}
if (availlableSegmentPixel.size() == 0) {
@ -111,7 +111,7 @@ void esvg::render::Weight::generate(ivec2 _size, int32_t _subSamplingCount, cons
Scanline scanline(_size.x());
//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;
std::vector<Segment> availlableSegment;
etk::Vector<Segment> availlableSegment;
// find in the subList ...
for (auto &it : availlableSegmentPixel) {
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) {
// we not add this point in this case to prevent double count of the same point.
} 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);
}
// x position, angle
std::vector<std::pair<float, int32_t>> listPosition;
etk::Vector<etk::Pair<float, int32_t>> listPosition;
for (auto &it : availlableSegment) {
vec2 delta = it.p0 - it.p1;
// x = coefficent*y+bbb;
float coefficient = delta.x()/delta.y();
float bbb = it.p0.x() - coefficient*it.p0.y();
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());
// 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:
int32_t lastState = 0;
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)) {
// fill to the new pos -1:
#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
float endValue = float(std::min(1,abs(lastState))) * deltaSize;
float endValue = float(etk::min(1,abs(lastState))) * deltaSize;
#endif
for (int32_t iii=currentPos+1; iii<int32_t(it.first); ++iii) {
scanline.set(iii, endValue);

View File

@ -15,7 +15,7 @@ namespace esvg {
class Weight {
private:
ivec2 m_size;
std::vector<float> m_data;
etk::Vector<float> m_data;
public:
// constructor :
Weight();

View File

@ -13,7 +13,7 @@ static const char* values[] = {
"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];
return _os;
}

View File

@ -16,7 +16,7 @@ namespace esvg {
/**
* @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);
}

View File

@ -7,7 +7,7 @@
*/
#include <test-debug/debug.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <gtest/gtest.h>
#include <etk/etk.hpp>
@ -18,7 +18,7 @@ int main(int _argc, const char *_argv[]) {
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
etk::init(_argc, _argv);
for (int32_t iii=0; iii<_argc ; ++iii) {
std::string data = _argv[iii];
etk::String data = _argv[iii];
#ifdef DEBUG
if (data == "--visual-test") {
TEST_PRINT("visual-test=enable");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <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'/>"
@ -23,7 +23,7 @@ TEST(TestCap, butt) {
}
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'>"
" <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'/>"
@ -35,7 +35,7 @@ TEST(TestCap, round) {
}
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'>"
" <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'/>"
@ -48,7 +48,7 @@ TEST(TestCap, square) {
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'>"
" <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'/>"
@ -60,7 +60,7 @@ TEST(TestCap, buttVert) {
}
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'>"
" <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'/>"
@ -72,7 +72,7 @@ TEST(TestCap, roundVert) {
}
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'>"
" <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'/>"
@ -86,7 +86,7 @@ TEST(TestCap, squareVert) {
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'>"
" <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'/>"
@ -98,7 +98,7 @@ TEST(TestCap, buttDiag1) {
}
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'>"
" <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'/>"
@ -110,7 +110,7 @@ TEST(TestCap, roundDiag1) {
}
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'>"
" <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'/>"
@ -123,7 +123,7 @@ TEST(TestCap, squareDiag1) {
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'>"
" <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'/>"
@ -135,7 +135,7 @@ TEST(TestCap, buttDiag2) {
}
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'>"
" <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'/>"
@ -147,7 +147,7 @@ TEST(TestCap, roundDiag2) {
}
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'>"
" <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'/>"

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <circle cx='50' cy='50' r='40' fill='red' />"
"</svg>");
@ -22,7 +22,7 @@ TEST(TestCircle, fill) {
}
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'>"
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestCircle, 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'>"
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' fill='red' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <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>");
@ -22,7 +22,7 @@ TEST(TestColor, blending) {
}
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'>"
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0' stroke-width='3' fill='#F00' opacity='0.5' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestColor, 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'>"
" <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>");
@ -44,7 +44,7 @@ TEST(TestColor, blending_and_opacity) {
}
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'>"
" <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' />"

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <ellipse cx='50' cy='50' rx='80' ry='30' fill='red' />"
"</svg>");
@ -22,7 +22,7 @@ TEST(TestEllipse, fill) {
}
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'>"
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestEllipse, 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'>"
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' fill='red' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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"
" <defs>\n"
" <linearGradient id='grad1' x1='0%' y1='0%' x2='100%' y2='0%'>\n"
@ -31,7 +31,7 @@ TEST(TestGradientLinear, horizontal) {
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='0%' x2='0%' y2='100%'>\n"
@ -50,7 +50,7 @@ TEST(TestGradientLinear, vertical) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='0%' x2='100%' y2='100%'>\n"
@ -69,7 +69,7 @@ TEST(TestGradientLinear, diag1) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='40%' y1='40%' x2='70%' y2='70%'>\n"
@ -86,7 +86,7 @@ TEST(TestGradientLinear, diag1Partiel) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
@ -107,7 +107,7 @@ TEST(TestGradientLinear, diag2) {
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='50%' x2='100%' y2='50%'>\n"
@ -126,7 +126,7 @@ TEST(TestGradientLinear, diag2Rotate0) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
@ -145,7 +145,7 @@ TEST(TestGradientLinear, diag2Rotate1) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
@ -164,7 +164,7 @@ TEST(TestGradientLinear, diag2Rotate2) {
}
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"
" <defs>\n"
" <linearGradient id='grad2' x1='0%' y1='100%' x2='100%' y2='0%'>\n"
@ -183,7 +183,7 @@ TEST(TestGradientLinear, diag2scale) {
}
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"
" <defs>\n"
" <linearGradient id='grad2Values'>\n"
@ -204,7 +204,7 @@ TEST(TestGradientLinear, internalHref) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\n"
" <linearGradient id='grad2' x1='45' y1='45' x2='55' y2='55' spreadMethod='repeat' gradientUnits='userSpaceOnUse' >\n"

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\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) {
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"
" <defs>\n"
" <radialGradient id='grad1' cx='50' cy='50' r='24' fx='20' fy='40' spreadMethod='reflect' gradientUnits='userSpaceOnUse' >\n"

View File

@ -13,7 +13,7 @@
// ------------------------------------------------------ Miter test -----------------------------------------------------
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'>"
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -24,7 +24,7 @@ TEST(TestJoin, miterRight1) {
}
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'>"
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -35,7 +35,7 @@ TEST(TestJoin, miterRight2) {
}
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'>"
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -46,7 +46,7 @@ TEST(TestJoin, miterRight3) {
}
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'>"
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -57,7 +57,7 @@ TEST(TestJoin, miterRight4) {
}
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'>"
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -68,7 +68,7 @@ TEST(TestJoin, miterLeft1) {
}
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'>"
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -79,7 +79,7 @@ TEST(TestJoin, miterLeft2) {
}
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'>"
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -90,7 +90,7 @@ TEST(TestJoin, miterLeft3) {
}
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'>"
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -101,7 +101,7 @@ TEST(TestJoin, miterLeft4) {
}
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'>"
" <polyline points='10,10 25,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -112,7 +112,7 @@ TEST(TestJoin, miterLimit1) {
}
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'>"
" <polyline points='10,10 50,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -123,7 +123,7 @@ TEST(TestJoin, miterLimit2) {
}
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'>"
" <polyline points='10,10 75,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -134,7 +134,7 @@ TEST(TestJoin, miterLimit3) {
}
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'>"
" <polyline points='10,10 90,25 10,40' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
"</svg>");
@ -145,7 +145,7 @@ TEST(TestJoin, miterLimit4) {
}
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'>"
" <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"
@ -158,7 +158,7 @@ TEST(TestJoin, miterCornerCasePath) {
}
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'>"
" <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"
@ -173,7 +173,7 @@ TEST(TestJoin, miterCornerCasePathLimit) {
// ------------------------------------------------------ Round test -----------------------------------------------------
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'>"
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -184,7 +184,7 @@ TEST(TestJoin, roundRight1) {
}
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'>"
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -195,7 +195,7 @@ TEST(TestJoin, roundRight2) {
}
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'>"
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -206,7 +206,7 @@ TEST(TestJoin, roundRight3) {
}
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'>"
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -217,7 +217,7 @@ TEST(TestJoin, roundRight4) {
}
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'>"
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -228,7 +228,7 @@ TEST(TestJoin, roundLeft1) {
}
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'>"
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -239,7 +239,7 @@ TEST(TestJoin, roundLeft2) {
}
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'>"
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -250,7 +250,7 @@ TEST(TestJoin, roundLeft3) {
}
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'>"
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
"</svg>");
@ -261,7 +261,7 @@ TEST(TestJoin, roundLeft4) {
}
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'>"
" <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"
@ -277,7 +277,7 @@ TEST(TestJoin, roundCornerCasePath) {
// ------------------------------------------------------ Bevel test -----------------------------------------------------
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'>"
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -288,7 +288,7 @@ TEST(TestJoin, bevelRight1) {
}
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'>"
" <polyline points='20,80 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -299,7 +299,7 @@ TEST(TestJoin, bevelRight2) {
}
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'>"
" <polyline points='80,80 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -310,7 +310,7 @@ TEST(TestJoin, bevelRight3) {
}
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'>"
" <polyline points='80,20 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -321,7 +321,7 @@ TEST(TestJoin, bevelRight4) {
}
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'>"
" <polyline points='80,20 50,50 80,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -332,7 +332,7 @@ TEST(TestJoin, bevelLeft1) {
}
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'>"
" <polyline points='80,80 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -343,7 +343,7 @@ TEST(TestJoin, bevelLeft2) {
}
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'>"
" <polyline points='20,80 50,50 20,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -354,7 +354,7 @@ TEST(TestJoin, bevelLeft3) {
}
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'>"
" <polyline points='20,20 50,50 80,20' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
"</svg>");
@ -365,7 +365,7 @@ TEST(TestJoin, bevelLeft4) {
}
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'>"
" <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"

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <line x1='10' y1='10' x2='90' y2='90' stroke='green' stroke-width='3' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <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' />"
@ -23,7 +23,7 @@ TEST(TestPath, fill) {
}
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'>"
" <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' />"
@ -35,7 +35,7 @@ TEST(TestPath, 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'>"
" <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' />"
@ -47,7 +47,7 @@ TEST(TestPath, fill_and_stroke) {
}
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'>"
" <path d='m 50,50 c -30,0 -30,1 -20,20 z'"
" fill='red' />"
@ -61,7 +61,7 @@ TEST(TestPath, curveTo) {
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'>"
" <path d='m 50,50 s -30,0 -20,20 z'"
" fill='red' />"
@ -75,7 +75,7 @@ TEST(TestPath, smoothCurveTo) {
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'>"
" <path d='m 50,50 q -30,1 -20,20 z'"
" fill='red' />"
@ -89,7 +89,7 @@ TEST(TestPath, bezierCurveTo) {
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'>"
" <path d='m 50,50 t -20,30 t 30,-20 z'"
" fill='red' />"
@ -101,7 +101,7 @@ TEST(TestPath, bezierSmoothCurveTo) {
}
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'>"
" <path d='M20,290 l 50,-25"
" a25,25 -30 0,1 50,-25 l 30,0"
@ -124,7 +124,7 @@ TEST(TestPath, arc) {
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'>"
" <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"

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <polygon points='50,10 90,50 10,80' fill='red' />"
"</svg>");
@ -22,7 +22,7 @@ TEST(TestPolygon, fill) {
}
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'>"
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestPolygon, 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'>"
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' fill='red' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' fill='orange' />"
"</svg>");
@ -22,7 +22,7 @@ TEST(TestPolyLine, fill) {
}
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'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='none' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestPolyLine, 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'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='orange' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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'>"
" <rect x='12.5' y='12.5' width='75' height='50' fill='red' />"
"</svg>");
@ -22,7 +22,7 @@ TEST(TestRectangle, fill) {
}
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'>"
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' />"
"</svg>");
@ -33,7 +33,7 @@ TEST(TestRectangle, 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'>"
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' fill='red' />"
"</svg>");
@ -44,7 +44,7 @@ TEST(TestRectangle, fill_and_stroke) {
}
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'>"
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' fill='red' />"
"</svg>");
@ -55,7 +55,7 @@ TEST(TestRectangle, corned_fill) {
}
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'>"
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' />"
"</svg>");
@ -66,7 +66,7 @@ TEST(TestRectangle, corned_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'>"
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' fill='red' />"
"</svg>");

View File

@ -11,7 +11,7 @@
#include "main.hpp"
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"
"\n"
"<svg\n"

View File

@ -7,7 +7,7 @@
*/
#include <test-debug/debug.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/etk.hpp>
#include <esvg/esvg.hpp>
@ -21,12 +21,12 @@ static void usage() {
int main(int _argc, const char *_argv[]) {
etk::init(_argc, _argv);
std::string inputFile;
etk::String inputFile;
bool visualTest = false;
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) {
inputFile = std::string(&data[7]);
inputFile = etk::String(&data[7]);
TEST_PRINT("file='" << inputFile << "'");
} else if (data == "--visual") {
visualTest = true;