[DEV] integarate std x11
This commit is contained in:
parent
7e28d6b250
commit
32b1966f8d
@ -24,7 +24,7 @@ void esvg::Base::parseTransform(exml::Element* _element) {
|
|||||||
if (NULL == _element) {
|
if (NULL == _element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
etk::UString inputString = _element->getAttribute("transform");
|
std::string inputString = _element->getAttribute("transform");
|
||||||
if (inputString.size() == 0) {
|
if (inputString.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ void esvg::Base::parsePosition(const exml::Element *_element, etk::Vector2D<floa
|
|||||||
if (NULL == _element) {
|
if (NULL == _element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
etk::UString content = _element->getAttribute("x");
|
std::string content = _element->getAttribute("x");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
_pos.setX(parseLength(content));
|
_pos.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
@ -117,10 +117,10 @@ void esvg::Base::parsePosition(const exml::Element *_element, etk::Vector2D<floa
|
|||||||
* @param[in] _dataInput Data C String with the printed lenght
|
* @param[in] _dataInput Data C String with the printed lenght
|
||||||
* @return standart number of pixels
|
* @return standart number of pixels
|
||||||
*/
|
*/
|
||||||
float esvg::Base::parseLength(const etk::UString& _dataInput) {
|
float esvg::Base::parseLength(const std::string& _dataInput) {
|
||||||
SVG_VERBOSE(" lenght : '" << _dataInput << "'");
|
SVG_VERBOSE(" lenght : '" << _dataInput << "'");
|
||||||
float n = _dataInput.toFloat();
|
float n = _dataInput.toFloat();
|
||||||
etk::UString unit;
|
std::string unit;
|
||||||
for (int32_t iii=0; iii<_dataInput.size(); iii++) {
|
for (int32_t iii=0; iii<_dataInput.size(); iii++) {
|
||||||
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|
||||||
|| _dataInput[iii]<='+'
|
|| _dataInput[iii]<='+'
|
||||||
@ -161,7 +161,7 @@ float esvg::Base::parseLength(const etk::UString& _dataInput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return the next char position ... (after ';' or NULL)
|
// return the next char position ... (after ';' or NULL)
|
||||||
int32_t extractPartOfStyle(const etk::UString& _data, etk::UString& _outputType, etk::UString& _outputData, int32_t _pos) {
|
int32_t extractPartOfStyle(const std::string& _data, std::string& _outputType, std::string& _outputData, int32_t _pos) {
|
||||||
_outputType = "";
|
_outputType = "";
|
||||||
_outputData = "";
|
_outputData = "";
|
||||||
if (_pos == -1) {
|
if (_pos == -1) {
|
||||||
@ -205,7 +205,7 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
|
|||||||
}
|
}
|
||||||
bool fillNone = false;
|
bool fillNone = false;
|
||||||
bool strokeNone = false;
|
bool strokeNone = false;
|
||||||
etk::UString content = _element->getAttribute("fill");
|
std::string content = _element->getAttribute("fill");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_paint.fill = parseColor(content);
|
m_paint.fill = parseColor(content);
|
||||||
if (m_paint.fill.a == 0) {
|
if (m_paint.fill.a == 0) {
|
||||||
@ -280,8 +280,8 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
|
|||||||
}
|
}
|
||||||
content = _element->getAttribute("style");
|
content = _element->getAttribute("style");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
etk::UString outputType;
|
std::string outputType;
|
||||||
etk::UString outputValue;
|
std::string outputValue;
|
||||||
|
|
||||||
for( int32_t sss=extractPartOfStyle(content, outputType, outputValue, 0);
|
for( int32_t sss=extractPartOfStyle(content, outputType, outputValue, 0);
|
||||||
-2 != sss;
|
-2 != sss;
|
||||||
@ -369,7 +369,7 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
|
|||||||
* @param[in] _inputData Data C String with the xml definition
|
* @param[in] _inputData Data C String with the xml definition
|
||||||
* @return the parsed color
|
* @return the parsed color
|
||||||
*/
|
*/
|
||||||
draw::Color esvg::Base::parseColor(const etk::UString& _inputData) {
|
draw::Color esvg::Base::parseColor(const std::string& _inputData) {
|
||||||
draw::Color localColor = draw::color::white;
|
draw::Color localColor = draw::color::white;
|
||||||
|
|
||||||
if( _inputData.size() > 4
|
if( _inputData.size() > 4
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define __ESVG_BASE_H__
|
#define __ESVG_BASE_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
#include <draw/Color.h>
|
#include <draw/Color.h>
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ namespace esvg {
|
|||||||
virtual void display(int32_t _spacing) { };
|
virtual void display(int32_t _spacing) { };
|
||||||
void parseTransform(exml::Element *_element);
|
void parseTransform(exml::Element *_element);
|
||||||
void parsePosition(const exml::Element *_element, etk::Vector2D<float> &_pos, etk::Vector2D<float> &_size);
|
void parsePosition(const exml::Element *_element, etk::Vector2D<float> &_pos, etk::Vector2D<float> &_size);
|
||||||
float parseLength(const etk::UString& _dataInput);
|
float parseLength(const std::string& _dataInput);
|
||||||
void parsePaintAttr(const exml::Element *_element);
|
void parsePaintAttr(const exml::Element *_element);
|
||||||
draw::Color parseColor(const etk::UString& _inputData);
|
draw::Color parseColor(const std::string& _inputData);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ bool esvg::Circle::parse(exml::Element * _element, agg::trans_affine& _parentTra
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
etk::UString content = _element->getAttribute("cx");
|
std::string content = _element->getAttribute("cx");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_position.setX(parseLength(content));
|
m_position.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ bool esvg::Ellipse::parse(exml::Element * _element, agg::trans_affine& _parentTr
|
|||||||
m_c.setValue(0,0);
|
m_c.setValue(0,0);
|
||||||
m_r.setValue(0,0);
|
m_r.setValue(0,0);
|
||||||
|
|
||||||
etk::UString content = _element->getAttribute("cx");
|
std::string content = _element->getAttribute("cx");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_c.setX(parseLength(content));
|
m_c.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ bool esvg::Group::parse(exml::Element * _element, agg::trans_affine& _parentTran
|
|||||||
_sizeMax.setValue(etk_max(_sizeMax.x(), tmpPos.x()),
|
_sizeMax.setValue(etk_max(_sizeMax.x(), tmpPos.x()),
|
||||||
etk_max(_sizeMax.y(), tmpPos.y()));
|
etk_max(_sizeMax.y(), tmpPos.y()));
|
||||||
// add element in the system
|
// add element in the system
|
||||||
m_subElementList.pushBack(elementParser);
|
m_subElementList.push_back(elementParser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
#define __ESVG_GROUP_H__
|
#define __ESVG_GROUP_H__
|
||||||
|
|
||||||
#include <esvg/Base.h>
|
#include <esvg/Base.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Group : public esvg::Base {
|
class Group : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
etk::Vector<esvg::Base *> m_subElementList; //!< group sub elements ...
|
std::vector<esvg::Base *> m_subElementList; //!< group sub elements ...
|
||||||
public:
|
public:
|
||||||
Group(PaintState _parentPaintState);
|
Group(PaintState _parentPaintState);
|
||||||
~Group(void);
|
~Group(void);
|
||||||
|
@ -35,7 +35,7 @@ bool esvg::Line::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
etk::UString content = _element->getAttribute("x1");
|
std::string content = _element->getAttribute("x1");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_startPos.setX(parseLength(content));
|
m_startPos.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ esvg::Path::~Path(void) {
|
|||||||
|
|
||||||
|
|
||||||
// return the next char position ... (after 'X' or NULL)
|
// return the next char position ... (after 'X' or NULL)
|
||||||
const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _outputList) {
|
const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _outputList) {
|
||||||
if (*_input == '\0') {
|
if (*_input == '\0') {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _out
|
|||||||
while( sscanf(&_input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|
while( sscanf(&_input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|
||||||
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
|
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
|
||||||
SVG_VERBOSE("Find element : " << element);
|
SVG_VERBOSE("Find element : " << element);
|
||||||
_outputList.pushBack(element);
|
_outputList.push_back(element);
|
||||||
iii += nbElementRead;
|
iii += nbElementRead;
|
||||||
}
|
}
|
||||||
outputPointer = &_input[iii];
|
outputPointer = &_input[iii];
|
||||||
@ -73,7 +73,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
|
|
||||||
etk::UString elementXML1 = _element->getAttribute("d");
|
std::string elementXML1 = _element->getAttribute("d");
|
||||||
if (elementXML1.size() == 0) {
|
if (elementXML1.size() == 0) {
|
||||||
SVG_ERROR("(l "<<_element->getPos()<<") path: missing 'p' attribute");
|
SVG_ERROR("(l "<<_element->getPos()<<") path: missing 'p' attribute");
|
||||||
return false;
|
return false;
|
||||||
@ -81,7 +81,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
SVG_VERBOSE("Parse Path : \"" << elementXML << "\"");
|
SVG_VERBOSE("Parse Path : \"" << elementXML << "\"");
|
||||||
|
|
||||||
char command;
|
char command;
|
||||||
etk::Vector<float> listDot;
|
std::vector<float> listDot;
|
||||||
|
|
||||||
etk::Char plop = elementXML1.c_str();
|
etk::Char plop = elementXML1.c_str();
|
||||||
const char* elementXML = plop;
|
const char* elementXML = plop;
|
||||||
@ -119,13 +119,13 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
if (listDot.size() >= 2) {
|
if (listDot.size() >= 2) {
|
||||||
pathElement.m_element[0] = listDot[0];
|
pathElement.m_element[0] = listDot[0];
|
||||||
pathElement.m_element[1] = listDot[1];
|
pathElement.m_element[1] = listDot[1];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
pathElement.m_cmd = esvg::pathLineTo;
|
pathElement.m_cmd = esvg::pathLineTo;
|
||||||
for(int32_t iii=2; iii<listDot.size(); iii+=2) {
|
for(int32_t iii=2; iii<listDot.size(); iii+=2) {
|
||||||
pathElement.m_element[0] = listDot[iii];
|
pathElement.m_element[0] = listDot[iii];
|
||||||
pathElement.m_element[1] = listDot[iii+1];
|
pathElement.m_element[1] = listDot[iii+1];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
|
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
|
||||||
pathElement.m_element[0] = listDot[iii];
|
pathElement.m_element[0] = listDot[iii];
|
||||||
pathElement.m_element[1] = listDot[iii+1];
|
pathElement.m_element[1] = listDot[iii+1];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_cmd = esvg::pathLineToV;
|
pathElement.m_cmd = esvg::pathLineToV;
|
||||||
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
|
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
|
||||||
pathElement.m_element[0] = listDot[iii];
|
pathElement.m_element[0] = listDot[iii];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_cmd = esvg::pathLineToH;
|
pathElement.m_cmd = esvg::pathLineToH;
|
||||||
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
|
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
|
||||||
pathElement.m_element[0] = listDot[iii];
|
pathElement.m_element[0] = listDot[iii];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_element[1] = listDot[iii+1];
|
pathElement.m_element[1] = listDot[iii+1];
|
||||||
pathElement.m_element[2] = listDot[iii+2];
|
pathElement.m_element[2] = listDot[iii+2];
|
||||||
pathElement.m_element[3] = listDot[iii+3];
|
pathElement.m_element[3] = listDot[iii+3];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
|
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
|
||||||
pathElement.m_element[0] = listDot[iii];
|
pathElement.m_element[0] = listDot[iii];
|
||||||
pathElement.m_element[1] = listDot[iii+1];
|
pathElement.m_element[1] = listDot[iii+1];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_element[3] = listDot[iii+3];
|
pathElement.m_element[3] = listDot[iii+3];
|
||||||
pathElement.m_element[4] = listDot[iii+4];
|
pathElement.m_element[4] = listDot[iii+4];
|
||||||
pathElement.m_element[5] = listDot[iii+5];
|
pathElement.m_element[5] = listDot[iii+5];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_element[1] = listDot[iii+1];
|
pathElement.m_element[1] = listDot[iii+1];
|
||||||
pathElement.m_element[2] = listDot[iii+2];
|
pathElement.m_element[2] = listDot[iii+2];
|
||||||
pathElement.m_element[3] = listDot[iii+3];
|
pathElement.m_element[3] = listDot[iii+3];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
pathElement.m_element[4] = listDot[iii+4];
|
pathElement.m_element[4] = listDot[iii+4];
|
||||||
pathElement.m_element[5] = listDot[iii+5];
|
pathElement.m_element[5] = listDot[iii+5];
|
||||||
pathElement.m_element[6] = listDot[iii+6];
|
pathElement.m_element[6] = listDot[iii+6];
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Z': // closepath (absolute)
|
case 'Z': // closepath (absolute)
|
||||||
@ -267,7 +267,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pathElement.m_cmd = esvg::pathStop;
|
pathElement.m_cmd = esvg::pathStop;
|
||||||
m_listElement.pushBack(pathElement);
|
m_listElement.push_back(pathElement);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SVG_ERROR ("Unknow error : \"" << command << "\"");
|
SVG_ERROR ("Unknow error : \"" << command << "\"");
|
||||||
|
@ -38,7 +38,7 @@ namespace esvg {
|
|||||||
};
|
};
|
||||||
class Path : public esvg::Base {
|
class Path : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
etk::Vector<PathBasic> m_listElement;
|
std::vector<PathBasic> m_listElement;
|
||||||
public:
|
public:
|
||||||
Path(PaintState _parentPaintState);
|
Path(PaintState _parentPaintState);
|
||||||
~Path(void);
|
~Path(void);
|
||||||
|
@ -36,7 +36,7 @@ bool esvg::Polygon::parse(exml::Element * _element, agg::trans_affine& _parentTr
|
|||||||
|
|
||||||
SVG_VERBOSE("parsed P2. trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")");
|
SVG_VERBOSE("parsed P2. trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")");
|
||||||
|
|
||||||
const etk::UString sss1 = _element->getAttribute("points");
|
const std::string sss1 = _element->getAttribute("points");
|
||||||
if (sss1.size() == 0) {
|
if (sss1.size() == 0) {
|
||||||
SVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute");
|
SVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute");
|
||||||
return false;
|
return false;
|
||||||
@ -49,7 +49,7 @@ bool esvg::Polygon::parse(exml::Element * _element, agg::trans_affine& _parentTr
|
|||||||
vec2 pos(0,0);
|
vec2 pos(0,0);
|
||||||
int32_t n;
|
int32_t n;
|
||||||
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
||||||
m_listPoint.pushBack(pos);
|
m_listPoint.push_back(pos);
|
||||||
sss += n;
|
sss += n;
|
||||||
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
|
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
|
||||||
etk_max(_sizeMax.y(), pos.y()));
|
etk_max(_sizeMax.y(), pos.y()));
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define __ESVG_POLYGON_H__
|
#define __ESVG_POLYGON_H__
|
||||||
|
|
||||||
#include <esvg/Base.h>
|
#include <esvg/Base.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
enum polygonMode {
|
enum polygonMode {
|
||||||
@ -19,7 +19,7 @@ namespace esvg {
|
|||||||
};
|
};
|
||||||
class Polygon : public esvg::Base {
|
class Polygon : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
etk::Vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polygone
|
std::vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polygone
|
||||||
enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
|
enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
|
||||||
public:
|
public:
|
||||||
Polygon(PaintState parentPaintState);
|
Polygon(PaintState parentPaintState);
|
||||||
|
@ -31,7 +31,7 @@ bool esvg::Polyline::parse(exml::Element * _element, agg::trans_affine& _parentT
|
|||||||
// add the property of the parrent modifications ...
|
// add the property of the parrent modifications ...
|
||||||
m_transformMatrix *= _parentTrans;
|
m_transformMatrix *= _parentTrans;
|
||||||
|
|
||||||
etk::UString sss1 = _element->getAttribute("points");
|
std::string sss1 = _element->getAttribute("points");
|
||||||
if (sss1.size() == 0) {
|
if (sss1.size() == 0) {
|
||||||
SVG_ERROR("(l "<<_element->getPos()<<") polyline: missing points attribute");
|
SVG_ERROR("(l "<<_element->getPos()<<") polyline: missing points attribute");
|
||||||
return false;
|
return false;
|
||||||
@ -44,7 +44,7 @@ bool esvg::Polyline::parse(exml::Element * _element, agg::trans_affine& _parentT
|
|||||||
etk::Vector2D<float> pos;
|
etk::Vector2D<float> pos;
|
||||||
int32_t n;
|
int32_t n;
|
||||||
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
|
||||||
m_listPoint.pushBack(pos);
|
m_listPoint.push_back(pos);
|
||||||
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
|
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
|
||||||
etk_max(_sizeMax.y(), pos.y()));
|
etk_max(_sizeMax.y(), pos.y()));
|
||||||
sss += n;
|
sss += n;
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
#define __ESVG_POLYLINE_H__
|
#define __ESVG_POLYLINE_H__
|
||||||
|
|
||||||
#include <esvg/Base.h>
|
#include <esvg/Base.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Polyline : public esvg::Base {
|
class Polyline : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
etk::Vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polyline
|
std::vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polyline
|
||||||
public:
|
public:
|
||||||
Polyline(PaintState _parentPaintState);
|
Polyline(PaintState _parentPaintState);
|
||||||
~Polyline(void);
|
~Polyline(void);
|
||||||
|
@ -41,7 +41,7 @@ bool esvg::Rectangle::parse(exml::Element * _element, agg::trans_affine& _parent
|
|||||||
|
|
||||||
parsePosition(_element, m_position, m_size);
|
parsePosition(_element, m_position, m_size);
|
||||||
|
|
||||||
etk::UString content = _element->getAttribute("rx");
|
std::string content = _element->getAttribute("rx");
|
||||||
if (content.size()!=0) {
|
if (content.size()!=0) {
|
||||||
m_roundedCorner.setX(parseLength(content));
|
m_roundedCorner.setX(parseLength(content));
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ esvg::Renderer::~Renderer(void) {
|
|||||||
// Writing the buffer to a .PPM file, assuming it has
|
// Writing the buffer to a .PPM file, assuming it has
|
||||||
// RGB-structure, one byte per color component
|
// RGB-structure, one byte per color component
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
void esvg::Renderer::writePpm(etk::UString fileName) {
|
void esvg::Renderer::writePpm(std::string fileName) {
|
||||||
if (NULL == m_buffer) {
|
if (NULL == m_buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace esvg {
|
|||||||
public:
|
public:
|
||||||
Renderer(uint32_t width, uint32_t height);
|
Renderer(uint32_t width, uint32_t height);
|
||||||
~Renderer(void);
|
~Renderer(void);
|
||||||
void writePpm(etk::UString fileName);
|
void writePpm(std::string fileName);
|
||||||
etk::Vector2D<float> m_size;
|
etk::Vector2D<float> m_size;
|
||||||
agg::rendering_buffer * m_renderingBuffer;
|
agg::rendering_buffer * m_renderingBuffer;
|
||||||
agg::pixfmt_rgba32 * m_pixFrame;
|
agg::pixfmt_rgba32 * m_pixFrame;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#define __class__ "Document"
|
#define __class__ "Document"
|
||||||
|
|
||||||
|
|
||||||
esvg::Document::Document(const etk::UString& _fileName) : m_renderedElement(NULL) {
|
esvg::Document::Document(const std::string& _fileName) : m_renderedElement(NULL) {
|
||||||
m_fileName = _fileName;
|
m_fileName = _fileName;
|
||||||
m_version = "0.0";
|
m_version = "0.0";
|
||||||
m_loadOK = true;
|
m_loadOK = true;
|
||||||
@ -139,7 +139,7 @@ esvg::Document::Document(const etk::UString& _fileName) : m_renderedElement(NULL
|
|||||||
maxSize.setY(size.y());
|
maxSize.setY(size.y());
|
||||||
}
|
}
|
||||||
// add element in the system
|
// add element in the system
|
||||||
m_subElementList.pushBack(elementParser);
|
m_subElementList.push_back(elementParser);
|
||||||
}
|
}
|
||||||
if (m_size.x() == 0 || m_size.y()==0) {
|
if (m_size.x() == 0 || m_size.y()==0) {
|
||||||
m_size.setValue((int32_t)maxSize.x(), (int32_t)maxSize.y());
|
m_size.setValue((int32_t)maxSize.x(), (int32_t)maxSize.y());
|
||||||
@ -204,7 +204,7 @@ void esvg::Document::generateTestFile(void)
|
|||||||
|
|
||||||
|
|
||||||
aggDraw(*m_renderedElement, basicTrans);
|
aggDraw(*m_renderedElement, basicTrans);
|
||||||
etk::UString tmpFileOut = "yyy_out_";
|
std::string tmpFileOut = "yyy_out_";
|
||||||
tmpFileOut += m_fileName;
|
tmpFileOut += m_fileName;
|
||||||
tmpFileOut += ".ppm";
|
tmpFileOut += ".ppm";
|
||||||
m_renderedElement->writePpm(tmpFileOut);
|
m_renderedElement->writePpm(tmpFileOut);
|
||||||
@ -243,7 +243,7 @@ void esvg::Document::generateAnImage(int32_t _sizeX, int32_t _sizeY)
|
|||||||
|
|
||||||
aggDraw(*m_renderedElement, basicTrans);
|
aggDraw(*m_renderedElement, basicTrans);
|
||||||
/*
|
/*
|
||||||
etk::UString tmpFileOut = "zzz_out_test.ppm";
|
std::string tmpFileOut = "zzz_out_test.ppm";
|
||||||
m_renderedElement->WritePpm(tmpFileOut);
|
m_renderedElement->WritePpm(tmpFileOut);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
12
esvg/esvg.h
12
esvg/esvg.h
@ -10,7 +10,7 @@
|
|||||||
#define __ESVG_H__
|
#define __ESVG_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
@ -20,15 +20,15 @@
|
|||||||
namespace esvg {
|
namespace esvg {
|
||||||
class Document : public esvg::Base {
|
class Document : public esvg::Base {
|
||||||
private:
|
private:
|
||||||
etk::UString m_fileName;
|
std::string m_fileName;
|
||||||
bool m_loadOK;
|
bool m_loadOK;
|
||||||
etk::UString m_version;
|
std::string m_version;
|
||||||
etk::UString m_title;
|
std::string m_title;
|
||||||
etk::Vector<esvg::Base *> m_subElementList;
|
std::vector<esvg::Base *> m_subElementList;
|
||||||
vec2 m_size;
|
vec2 m_size;
|
||||||
esvg::Renderer* m_renderedElement;
|
esvg::Renderer* m_renderedElement;
|
||||||
public:
|
public:
|
||||||
Document(const etk::UString& _fileName);
|
Document(const std::string& _fileName);
|
||||||
~Document(void);
|
~Document(void);
|
||||||
bool isLoadOk(void) { return m_loadOK; };
|
bool isLoadOk(void) { return m_loadOK; };
|
||||||
void displayDebug(void);
|
void displayDebug(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user