diff --git a/.classpath b/.classpath
index d43dd0c..5c16154 100644
--- a/.classpath
+++ b/.classpath
@@ -21,7 +21,12 @@
-
+
+
+
+
+
+
diff --git a/Formatter.xml b/Formatter.xml
index 14a5d6c..18e9720 100644
--- a/Formatter.xml
+++ b/Formatter.xml
@@ -2,19 +2,19 @@
-
+
-
+
-
+
@@ -22,12 +22,12 @@
-
+
-
+
@@ -43,7 +43,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
@@ -86,7 +86,7 @@
-
+
@@ -96,7 +96,7 @@
-
+
@@ -141,15 +141,15 @@
-
+
-
+
-
+
@@ -168,14 +168,14 @@
-
+
-
+
@@ -218,7 +218,7 @@
-
+
@@ -245,7 +245,7 @@
-
+
@@ -289,7 +289,7 @@
-
+
@@ -317,7 +317,7 @@
-
+
@@ -358,22 +358,22 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/esvg.iml b/esvg.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/esvg.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/module-info.java b/src/module-info.java
index 11c18b8..3b335ec 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -7,4 +7,5 @@ open module org.atriasoft.esvg {
exports org.atriasoft.esvg.render;
requires transitive io.scenarium.logger;
+ requires transitive org.atriasoft.etk;
}
diff --git a/src/org/atriasoft/esvg/Base.cpp b/src/org/atriasoft/esvg/Base.cpp
index e5eb287..cfbcc89 100644
--- a/src/org/atriasoft/esvg/Base.cpp
+++ b/src/org/atriasoft/esvg/Base.cpp
@@ -11,36 +11,10 @@
const float esvg::kappa90(0.5522847493f);
-esvg::PaintState::PaintState() :
- fill(etk::Pair, etk::String>(etk::color::black, "")),
- stroke(etk::Pair, etk::String>(etk::color::none, "")),
- strokeWidth(1.0f),
- flagEvenOdd(false),
- lineCap(esvg::cap_butt),
- lineJoin(esvg::join_miter),
- miterLimit(4.0f),
- viewPort(Vector2f(0.0f,0.0f), Vector2f(0.0f,0.0f)),
- opacity(1.0) {
-
-}
-
-void esvg::PaintState::clear() {
- fill = etk::Pair, etk::String>(etk::color::black, "");
- stroke = etk::Pair, etk::String>(etk::color::none, "");
- strokeWidth = 1.0;
- viewPort.first.setValue(0.0f,0.0f);
- viewPort.first.setValue(0.0f,0.0f);
- flagEvenOdd = false;
- lineJoin = esvg::join_miter;
- lineCap = esvg::cap_butt;
- miterLimit = 4.0f;
- opacity = 1.0;
-}
-
esvg::Base::Base(PaintState _parentPaintState) {
// copy the parent painting properties ...
- m_paint = _parentPaintState;
+ this.paint = _parentPaintState;
}
etk::String extractTransformData(const etk::String& _value, const etk::String& _base) {
@@ -97,7 +71,7 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
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) {
- m_transformMatrix = mat2x3(matrix);
+ this.transformMatrix = mat2x3(matrix);
// find a matrix : simply exit ...
return;
} else {
@@ -108,10 +82,10 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
if (data.size() != 0) {
float xxx, yyy;
if (sscanf(data.c_str(), "%f %f", &xxx, &yyy) == 2) {
- m_transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, yyy));
+ this.transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, yyy));
Log.verbose("Translate : " << xxx << ", " << yyy);
} else if (sscanf(data.c_str(), "%f", &xxx) == 1) {
- m_transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, 0));
+ this.transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, 0));
Log.verbose("Translate : " << xxx << ", " << 0);
} else {
Log.error("Parsing translate() with wrong data ... '" << data << "'");
@@ -121,10 +95,10 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
if (data.size() != 0) {
float xxx, yyy;
if (sscanf(data.c_str(), "%f %f", &xxx, &yyy) == 2) {
- m_transformMatrix *= etk::mat2x3Scale(Vector2f(xxx, yyy));
+ this.transformMatrix *= etk::mat2x3Scale(Vector2f(xxx, yyy));
Log.verbose("Scale : " << xxx << ", " << yyy);
} else if (sscanf(data.c_str(), "%f", &xxx) == 1) {
- m_transformMatrix *= etk::mat2x3Scale(xxx);
+ this.transformMatrix *= etk::mat2x3Scale(xxx);
Log.verbose("Scale : " << xxx << ", " << xxx);
} else {
Log.error("Parsing scale() with wrong data ... '" << data << "'");
@@ -135,13 +109,13 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
float angle, xxx, yyy;
if (sscanf(data.c_str(), "%f %f %f", &angle, &xxx, &yyy) == 3) {
angle = angle / 180 * M_PI;
- m_transformMatrix *= etk::mat2x3Translate(Vector2f(-xxx, -yyy));
- m_transformMatrix *= etk::mat2x3Rotate(angle);
- m_transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, yyy));
+ this.transformMatrix *= etk::mat2x3Translate(Vector2f(-xxx, -yyy));
+ this.transformMatrix *= etk::mat2x3Rotate(angle);
+ this.transformMatrix *= etk::mat2x3Translate(Vector2f(xxx, yyy));
} else if (sscanf(data.c_str(), "%f", &angle) == 1) {
angle = angle / 180 * M_PI;
Log.verbose("rotate : " << angle << "rad, " << (angle/M_PI*180) << "°");
- m_transformMatrix *= etk::mat2x3Rotate(angle);
+ this.transformMatrix *= etk::mat2x3Rotate(angle);
} else {
Log.error("Parsing rotate() with wrong data ... '" << data << "'");
}
@@ -152,7 +126,7 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
if (sscanf(data.c_str(), "%f", &angle) == 1) {
angle = angle / 180 * M_PI;
Log.verbose("skewX : " << angle << "rad, " << (angle/M_PI*180) << "°");
- m_transformMatrix *= etk::mat2x3Skew(Vector2f(angle, 0.0f));
+ this.transformMatrix *= etk::mat2x3Skew(Vector2f(angle, 0.0f));
} else {
Log.error("Parsing skewX() with wrong data ... '" << data << "'");
}
@@ -163,7 +137,7 @@ void esvg::Base::parseTransform(const exml::Element& _element) {
if (sscanf(data.c_str(), "%f", &angle) == 1) {
angle = angle / 180 * M_PI;
Log.verbose("skewY : " << angle << "rad, " << (angle/M_PI*180) << "°");
- m_transformMatrix *= etk::mat2x3Skew(Vector2f(0.0f, angle));
+ this.transformMatrix *= etk::mat2x3Skew(Vector2f(0.0f, angle));
} else {
Log.error("Parsing skewY() with wrong data ... '" << data << "'");
}
@@ -196,7 +170,7 @@ void esvg::Base::parsePosition(const exml::Element& _element, Vector2f &_pos, Ve
}
-etk::Pair esvg::Base::parseLength2(const etk::String& _dataInput) {
+Pair esvg::Base::parseLength2(const etk::String& _dataInput) {
Log.verbose(" lenght : '" << _dataInput << "'");
float n = _dataInput.to();
etk::String unit;
@@ -246,12 +220,12 @@ etk::Pair esvg::Base::parseLength2(const etk::String
float esvg::Base::parseLength(const etk::String& _dataInput) {
- etk::Pair value = parseLength2(_dataInput);
+ Pair value = parseLength2(_dataInput);
Log.verbose(" lenght : '" << value.first << "' => unit=" << value.second);
float font_size = 20.0f;
switch (value.second) {
case esvg::distance_pourcent:
- return value.first;// / 100.0 * m_paint.viewPort.x();
+ return value.first;// / 100.0 * this.paint.viewPort.x();
case esvg::distance_element:
return value.first * font_size;
case esvg::distance_ex:
@@ -277,29 +251,29 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
return;
}
/*
- bool fillNone = false;
- bool strokeNone = false;
+ boolean fillNone = false;
+ boolean strokeNone = false;
*/
etk::String content;
// ---------------- get unique ID ----------------
- m_id = _element.attributes["id"];
+ this.id = _element.attributes["id"];
// ---------------- stroke ----------------
content = _element.attributes["stroke"];
if (content == "none") {
- m_paint.stroke = etk::Pair, etk::String>(etk::color::none, "");
+ this.paint.stroke = Pair, etk::String>(etk::color::none, "");
} else {
if (content.size()!=0) {
- m_paint.stroke = parseColor(content);
+ this.paint.stroke = parseColor(content);
}
content = _element.attributes["stroke-width"];
if (content.size()!=0) {
- m_paint.strokeWidth = parseLength(content);
+ this.paint.strokeWidth = parseLength(content);
}
content = _element.attributes["stroke-opacity"];
if (content.size()!=0) {
float opacity = parseLength(content);
opacity = etk::avg(0.0f, opacity, 1.0f);
- m_paint.stroke.first.setA(opacity);
+ this.paint.stroke.first.setA(opacity);
}
content = _element.attributes["stroke-dasharray"];
@@ -313,55 +287,55 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
content = _element.attributes["stroke-linecap"];
if (content.size()!=0) {
if (content == "butt" ) {
- m_paint.lineCap = esvg::cap_butt;
+ this.paint.lineCap = esvg::cap_butt;
} else if (content == "round" ) {
- m_paint.lineCap = esvg::cap_round;
+ this.paint.lineCap = esvg::cap_round;
} else if (content == "square" ) {
- m_paint.lineCap = esvg::cap_square;
+ this.paint.lineCap = esvg::cap_square;
} else {
- m_paint.lineCap = esvg::cap_butt;
+ this.paint.lineCap = esvg::cap_butt;
Log.error("not know stroke-linecap value : \"" << content << "\", not in [butt,round,square]");
}
}
content = _element.attributes["stroke-linejoin"];
if (content.size()!=0) {
if (content == "miter" ) {
- m_paint.lineJoin = esvg::join_miter;
+ this.paint.lineJoin = esvg::join_miter;
} else if (content == "round" ) {
- m_paint.lineJoin = esvg::join_round;
+ this.paint.lineJoin = esvg::join_round;
} else if (content == "bevel" ) {
- m_paint.lineJoin = esvg::join_bevel;
+ this.paint.lineJoin = esvg::join_bevel;
} else {
- m_paint.lineJoin = esvg::join_miter;
+ this.paint.lineJoin = esvg::join_miter;
Log.error("not know stroke-linejoin value : \"" << content << "\", not in [miter,round,bevel]");
}
}
content = _element.attributes["stroke-miterlimit"];
if (content.size()!=0) {
float tmp = parseLength(content);
- m_paint.miterLimit = etk::max(0.0f, tmp);
+ this.paint.miterLimit = etk::max(0.0f, tmp);
}
}
// ---------------- FILL ----------------
content = _element.attributes["fill"];
if (content == "none") {
- m_paint.fill = etk::Pair, etk::String>(etk::color::none, "");
+ this.paint.fill = Pair, etk::String>(etk::color::none, "");
} else {
if (content.size()!=0) {
- m_paint.fill = parseColor(content);
+ this.paint.fill = parseColor(content);
}
content = _element.attributes["fill-opacity"];
if (content.size()!=0) {
float opacity = parseLength(content);
opacity = etk::avg(0.0f, opacity, 1.0f);
- m_paint.fill.first.setA(opacity);
+ this.paint.fill.first.setA(opacity);
}
content = _element.attributes["fill-rule"];
if (content.size()!=0) {
if (content == "nonzero") {
- m_paint.flagEvenOdd = false;
+ this.paint.flagEvenOdd = false;
} else if (content == "evenodd" ) {
- m_paint.flagEvenOdd = true;
+ this.paint.flagEvenOdd = true;
} else {
Log.error("not know fill-rule value : \"" << content << "\", not in [nonzero,evenodd]");
}
@@ -369,14 +343,14 @@ void esvg::Base::parsePaintAttr(const exml::Element& _element) {
// ---------------- opacity ----------------
content = _element.attributes["opacity"];
if (content.size()!=0) {
- m_paint.opacity = parseLength(content);
- m_paint.opacity = etk::avg(0.0f, m_paint.opacity, 1.0f);
+ this.paint.opacity = parseLength(content);
+ this.paint.opacity = etk::avg(0.0f, this.paint.opacity, 1.0f);
}
}
}
-etk::Pair, etk::String> esvg::Base::parseColor(const etk::String& _inputData) {
- etk::Pair, etk::String> localColor(etk::color::white, "");
+Pair, etk::String> esvg::Base::parseColor(const etk::String& _inputData) {
+ Pair, etk::String> localColor(etk::color::white, "");
if( _inputData.size() > 4
&& _inputData[0] == 'u'
@@ -385,27 +359,27 @@ etk::Pair, etk::String> esvg::Base::parseColor(const etk::St
&& _inputData[3] == '(') {
if (_inputData[4] == '#') {
etk::String color(_inputData.begin() + 5, _inputData.end()-1);
- localColor = etk::Pair, etk::String>(etk::color::none, color);
+ localColor = Pair, etk::String>(etk::color::none, color);
} else {
Log.error("Problem in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
}
} else {
- localColor = etk::Pair, etk::String>(_inputData, "");
+ localColor = Pair, etk::String>(_inputData, "");
}
Log.verbose("Parse color : \"" << _inputData << "\" == > " << localColor.first << " " << localColor.second);
return localColor;
}
-bool esvg::Base::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Base::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
// TODO : UNDERSTAND why nothing is done here ...
// Parse basic elements (ID...):
- m_id = _element.attributes["id"];
+ this.id = _element.attributes["id"];
_sizeMax = Vector2f(0.0f, 0.0f);
return false;
}
-const char * esvg::Base::spacingDist(int32_t _spacing) {
+const char * esvg::Base::spacingDist(int _spacing) {
static const char *tmpValue = " ";
if (_spacing>20) {
_spacing = 20;
@@ -413,27 +387,27 @@ const char * esvg::Base::spacingDist(int32_t _spacing) {
return tmpValue + 20*4 - _spacing*4;
}
-void esvg::Base::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Base::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.warning(spacingDist(_level) << "DRAW esvg::Base ... ==> No drawing availlable");
}
const etk::String& esvg::Base::getId() const {
- return m_id;
+ return this.id;
}
void esvg::Base::setId(const etk::String& _newId) {
// TODO : Check if it is UNIQUE ...
- m_id = _newId;
+ this.id = _newId;
}
void esvg::Base::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
}
diff --git a/src/org/atriasoft/esvg/Base.java b/src/org/atriasoft/esvg/Base.java
index fd296d1..11e6644 100644
--- a/src/org/atriasoft/esvg/Base.java
+++ b/src/org/atriasoft/esvg/Base.java
@@ -1,129 +1,95 @@
+package org.atriasoft.esvg;
+
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-
-#include
-#include
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-namespace esvg {
- extern const float kappa90; //!< proportional lenght to the radius of a bezier handle for 90° arcs.
+class Base {
+ public static float kappa90; //!< proportional lenght to the radius of a bezier handle for 90° arcs.
+ protected PaintState paint;
+ protected mat2x3 transformMatrix; //!< specific render of the curent element
+
+ protected String spacingDist(int _spacing);
+
+ public Base() {};
+
+ Base(PaintState _parentPaintState);
+
/**
- * @brief Painting mode of the Object:
+ * parse all the element needed in the basic node
+ * @param _element standart XML node
+ * @return true if no problem arrived
*/
- enum paint {
- paint_none, //!< No painting.
- paint_color, //!< Painting a color.
- paint_gradientLinear, //!< Painting a linear gradient.
- paint_gradientRadial //!< Painting a radial gradient.
- };
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
- class PaintState {
- public:
- PaintState();
- void clear();
- public:
- etk::Pair, etk::String> fill;
- etk::Pair, etk::String> stroke;
- float strokeWidth;
- bool flagEvenOdd; //!< Fill rules
- enum esvg::cap lineCap;
- enum esvg::join lineJoin;
- float miterLimit;
- etk::Pair viewPort; //!< min pos, max pos
- float opacity;
- };
+ /**
+ * Draw the form in the renderer
+ * @param _myRenderer Renderer engine
+ * @param _basicTrans Parant transformation of the environement
+ * @param _level Level of the tree
+ */
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level=1);
- class Base {
- protected:
- PaintState m_paint;
- mat2x3 m_transformMatrix; //!< specific render of the curent element
- const char * spacingDist(int32_t _spacing);
- public:
- Base() {};
- Base(PaintState _parentPaintState);
- virtual ~Base() { };
- /**
- * @brief parse all the element needed in the basic node
- * @param[in] _element standart XML node
- * @return true if no problem arrived
- */
- virtual bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
- /**
- * @brief Draw the form in the renderer
- * @param[in] _myRenderer Renderer engine
- * @param[in] _basicTrans Parant transformation of the environement
- * @param[in] _level Level of the tree
- */
- virtual void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level=1);
- /**
- * @brief Draw rhe shape with all points
- * @param[in] _out where the lines are added
- * @param[in] _recurtionMax interpolation recurtion max
- * @param[in] _threshold threshold to stop recurtion
- * @param[in] _basicTrans Parant transformation of the environement
- * @param[in] _level Level of the tree
- */
- virtual void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
- float _threshold,
- mat2x3& _basicTrans,
- int32_t _level=1);
-
- virtual void display(int32_t _spacing) { };
- void parseTransform(const exml::Element& _element);
- /**
- * @brief parse x, y, width, height attribute of the xml node
- * @param[in] _element XML node
- * @param[out] _pos parsed position
- * @param[out] _size parsed dimention
- */
- void parsePosition(const exml::Element& _element, Vector2f &_pos, Vector2f &_size);
- /**
- * @brief parse a lenght of the xml element
- * @param[in] _dataInput Data C String with the printed lenght
- * @return standard number of pixels
- */
- float parseLength(const etk::String& _dataInput);
- etk::Pair 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
- */
- void parsePaintAttr(const exml::Element& _element);
- /**
- * @brief parse a color specification from the svg file
- * @param[in] _inputData Data C String with the xml definition
- * @return The parsed color (color used and the link if needed)
- */
- etk::Pair, etk::String> parseColor(const etk::String& _inputData);
- protected:
- etk::String m_id; //!< unique ID of the element.
- public:
- /**
- * @brief Get the ID of the Element
- * @return UniqueId in the svg file
- */
- const etk::String& getId() const;
- /**
- * @brief Set the ID of the Element
- * @param[in] _newId New Id of the element
- */
- void setId(const etk::String& _newId);
- };
-};
+ /**
+ * Draw rhe shape with all points
+ * @param _out where the lines are added
+ * @param _recurtionMax interpolation recurtion max
+ * @param _threshold threshold to stop recurtion
+ * @param _basicTrans Parant transformation of the environement
+ * @param _level Level of the tree
+ */
+ void drawShapePoints(final List> _out,
+ final int _recurtionMax,
+ final float _threshold,
+ final mat2x3 _basicTrans,
+ final int _level=1);
+
+ void display(final int _spacing) {};
+
+ void parseTransform(const exml::Element& _element);
+
+ /**
+ * parse x, y, width, height attribute of the xml node
+ * @param _element XML node
+ * @param _pos parsed position
+ * @param _size parsed dimention
+ */
+ void parsePosition(const exml::Element& _element, Vector2f &_pos, Vector2f &_size);
+
+ /**
+ * parse a lenght of the xml element
+ * @param _dataInput Data C String with the printed lenght
+ * @return standard number of pixels
+ */
+ float parseLength(const etk::String& _dataInput);
+ Pair parseLength2(const etk::String& _dataInput);
+ /**
+ * parse a Painting attribute of a specific node
+ * @param _element Basic node of the XML that might be parsed
+ */
+ void parsePaintAttr(exml::Element _element);
+ /**
+ * parse a color specification from the svg file
+ * @param _inputData Data C String with the xml definition
+ * @return The parsed color (color used and the link if needed)
+ */
+ Pair parseColor(String _inputData);
+ protected String id; //!< unique ID of the element.
+
+ /**
+ * Get the ID of the Element
+ * @return UniqueId in the svg file
+ */
+ public String getId() {
+ return this.id;
+ }
+ /**
+ * Set the ID of the Element
+ * @param _newId New Id of the element
+ */
+ public void setId(String _newId) {
+ this.id = _newId;
+ }
+}
diff --git a/src/org/atriasoft/esvg/CapMode.java b/src/org/atriasoft/esvg/CapMode.java
new file mode 100644
index 0000000..32a601f
--- /dev/null
+++ b/src/org/atriasoft/esvg/CapMode.java
@@ -0,0 +1,13 @@
+package org.atriasoft.esvg;
+
+/** @file
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+
+public enum CapMode {
+ BUTT,
+ ROUND,
+ SQUARE
+}
diff --git a/src/org/atriasoft/esvg/Circle.cpp b/src/org/atriasoft/esvg/Circle.cpp
index a438610..95559e3 100644
--- a/src/org/atriasoft/esvg/Circle.cpp
+++ b/src/org/atriasoft/esvg/Circle.cpp
@@ -17,9 +17,9 @@ esvg::Circle::~Circle() {
}
-bool esvg::Circle::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
- m_radius = 0.0;
- m_position.setValue(0,0);
+boolean esvg::Circle::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+ this.radius = 0.0;
+ this.position.setValue(0,0);
if (_element.exist() == false) {
return false;
}
@@ -27,70 +27,70 @@ bool esvg::Circle::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String content = _element.attributes["cx"];
if (content.size()!=0) {
- m_position.setX(parseLength(content));
+ this.position.setX(parseLength(content));
}
content = _element.attributes["cy"];
if (content.size()!=0) {
- m_position.setY(parseLength(content));
+ this.position.setY(parseLength(content));
}
content = _element.attributes["r"];
if (content.size()!=0) {
- m_radius = parseLength(content);
+ this.radius = parseLength(content);
} else {
Log.error("(l "<<_element.getPos()<<") Circle \"r\" is not present");
return false;
}
- if (0 > m_radius) {
- m_radius = 0;
+ if (0 > this.radius) {
+ this.radius = 0;
Log.error("(l "<<_element.getPos()<<") Circle \"r\" is negative");
return false;
}
- _sizeMax.setValue(m_position.x() + m_radius, m_position.y() + m_radius);
+ _sizeMax.setValue(this.position.x() + this.radius, this.position.y() + this.radius);
return true;
}
-void esvg::Circle::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Circle " << m_position << " radius=" << m_radius);
+void esvg::Circle::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Circle " << this.position << " radius=" << this.radius);
}
esvg::render::Path esvg::Circle::createPath() {
esvg::render::Path out;
out.clear();
- out.moveTo(false, m_position + Vector2f(m_radius, 0.0f));
+ out.moveTo(false, this.position + Vector2f(this.radius, 0.0f));
out.curveTo(false,
- m_position + Vector2f(m_radius, m_radius*esvg::kappa90),
- m_position + Vector2f(m_radius*esvg::kappa90, m_radius),
- m_position + Vector2f(0.0f, m_radius));
+ this.position + Vector2f(this.radius, this.radius*esvg::kappa90),
+ this.position + Vector2f(this.radius*esvg::kappa90, this.radius),
+ this.position + Vector2f(0.0f, this.radius));
out.curveTo(false,
- m_position + Vector2f(-m_radius*esvg::kappa90, m_radius),
- m_position + Vector2f(-m_radius, m_radius*esvg::kappa90),
- m_position + Vector2f(-m_radius, 0.0f));
+ this.position + Vector2f(-this.radius*esvg::kappa90, this.radius),
+ this.position + Vector2f(-this.radius, this.radius*esvg::kappa90),
+ this.position + Vector2f(-this.radius, 0.0f));
out.curveTo(false,
- m_position + Vector2f(-m_radius, -m_radius*esvg::kappa90),
- m_position + Vector2f(-m_radius*esvg::kappa90, -m_radius),
- m_position + Vector2f(0.0f, -m_radius));
+ this.position + Vector2f(-this.radius, -this.radius*esvg::kappa90),
+ this.position + Vector2f(-this.radius*esvg::kappa90, -this.radius),
+ this.position + Vector2f(0.0f, -this.radius));
out.curveTo(false,
- m_position + Vector2f(m_radius*esvg::kappa90, -m_radius),
- m_position + Vector2f(m_radius, -m_radius*esvg::kappa90),
- m_position + Vector2f(m_radius, 0.0f));
+ this.position + Vector2f(this.radius*esvg::kappa90, -this.radius),
+ this.position + Vector2f(this.radius, -this.radius*esvg::kappa90),
+ this.position + Vector2f(this.radius, 0.0f));
out.close();
return out;
}
-void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::Circle");
- if (m_radius <= 0.0f) {
- Log.verbose(spacingDist(_level+1) << "Too small radius" << m_radius);
+ if (this.radius <= 0.0f) {
+ Log.verbose(spacingDist(_level+1) << "Too small radius" << this.radius);
return;
}
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -102,10 +102,10 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -120,10 +120,10 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -136,7 +136,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
@@ -144,21 +144,21 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_
}
void esvg::Circle::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Circle");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Circle.java b/src/org/atriasoft/esvg/Circle.java
index 2503997..52779e9 100644
--- a/src/org/atriasoft/esvg/Circle.java
+++ b/src/org/atriasoft/esvg/Circle.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,27 +6,33 @@
*/
#pragma once
-#include
+#include
-namespace esvg {
- class Circle : public esvg::Base {
+namespace esvg{
+class Circle extends esvg::Base
+{
private:
- Vector2f m_position; //!< Position of the Circle
- float m_radius; //!< Radius of the Circle
+ Vector2f this.position; //!< Position of the Circle
+ float this.radius; //!< Radius of the Circle
public:
- Circle(PaintState _parentPaintState);
- ~Circle();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Circle(PaintState _parentPaintState);~
+
+ Circle();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
private:
- esvg::render::Path createPath();
- };
-}
-
-
+ esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/Dimension.cpp b/src/org/atriasoft/esvg/Dimension.cpp
index 6522b79..b23819c 100644
--- a/src/org/atriasoft/esvg/Dimension.cpp
+++ b/src/org/atriasoft/esvg/Dimension.cpp
@@ -22,20 +22,20 @@ static const float millimeterToKilometer = 1000000.0f;
static const float basicRatio = 72.0f / 25.4f;
esvg::Dimension::Dimension() :
- m_data(0,0),
- m_type(esvg::distance_pixel) {
+ this.data(0,0),
+ this.type(esvg::distance_pixel) {
// notinh to do ...
}
esvg::Dimension::Dimension(const Vector2f& _size, enum esvg::distance _type) :
- m_data(0,0),
- m_type(esvg::distance_pixel) {
+ this.data(0,0),
+ this.type(esvg::distance_pixel) {
set(_size, _type);
}
void esvg::Dimension::set(etk::String _config) {
- m_data.setValue(0,0);
- m_type = esvg::distance_pixel;
+ this.data.setValue(0,0);
+ this.type = esvg::distance_pixel;
enum distance type = esvg::distance_pixel;
if (etk::end_with(_config, "%", false) == true) {
type = esvg::distance_pourcent;
@@ -106,8 +106,8 @@ static enum esvg::distance parseType(etk::String& _config) {
void esvg::Dimension::set(etk::String _configX, etk::String _configY) {
- m_data.setValue(0,0);
- m_type = esvg::distance_pixel;
+ this.data.setValue(0,0);
+ this.type = esvg::distance_pixel;
enum distance type = esvg::distance_pixel;
// First Parse X
enum distance typeX = parseType(_configX);
@@ -170,8 +170,8 @@ esvg::Dimension::operator etk::String() const {
}
void esvg::Dimension::set(const Vector2f& _size, enum esvg::distance _type) {
- m_data = _size;
- m_type = _type;
+ this.data = _size;
+ this.type = _type;
switch(_type) {
case esvg::distance_pourcent:
case esvg::distance_pixel:
@@ -193,23 +193,23 @@ void esvg::Dimension::set(const Vector2f& _size, enum esvg::distance _type) {
}
Vector2f esvg::Dimension::getPixel(const Vector2f& _upperSize) const {
- switch(m_type) {
+ switch(this.type) {
case esvg::distance_pourcent:
- return Vector2f(_upperSize.x()*m_data.x()*0.01f, _upperSize.y()*m_data.y()*0.01f);
+ return Vector2f(_upperSize.x()*this.data.x()*0.01f, _upperSize.y()*this.data.y()*0.01f);
case esvg::distance_pixel:
- return m_data;
+ return this.data;
case esvg::distance_meter:
- return Vector2f(m_data.x()*meterToMillimeter*basicRatio, m_data.y()*meterToMillimeter*basicRatio);
+ return Vector2f(this.data.x()*meterToMillimeter*basicRatio, this.data.y()*meterToMillimeter*basicRatio);
case esvg::distance_centimeter:
- return Vector2f(m_data.x()*centimeterToMillimeter*basicRatio, m_data.y()*centimeterToMillimeter*basicRatio);
+ return Vector2f(this.data.x()*centimeterToMillimeter*basicRatio, this.data.y()*centimeterToMillimeter*basicRatio);
case esvg::distance_millimeter:
- return Vector2f(m_data.x()*basicRatio, m_data.y()*basicRatio);
+ return Vector2f(this.data.x()*basicRatio, this.data.y()*basicRatio);
case esvg::distance_kilometer:
- return Vector2f(m_data.x()*kilometerToMillimeter*basicRatio, m_data.y()*kilometerToMillimeter*basicRatio);
+ return Vector2f(this.data.x()*kilometerToMillimeter*basicRatio, this.data.y()*kilometerToMillimeter*basicRatio);
case esvg::distance_inch:
- return Vector2f(m_data.x()*inchToMillimeter*basicRatio, m_data.y()*inchToMillimeter*basicRatio);
+ return Vector2f(this.data.x()*inchToMillimeter*basicRatio, this.data.y()*inchToMillimeter*basicRatio);
case esvg::distance_foot:
- return Vector2f(m_data.x()*footToMillimeter*basicRatio, m_data.y()*footToMillimeter*basicRatio);
+ return Vector2f(this.data.x()*footToMillimeter*basicRatio, this.data.y()*footToMillimeter*basicRatio);
}
return Vector2f(128.0f, 128.0f);
}
@@ -268,30 +268,30 @@ namespace etk {
template<> etk::UString toUString(const esvg::Dimension& _obj) {
return etk::toUString(etk::toString(_obj));
}
- template<> bool from_string(esvg::Dimension& _variableRet, const etk::String& _value) {
+ template<> boolean frothis.string(esvg::Dimension& _variableRet, const etk::String& _value) {
_variableRet = esvg::Dimension(_value);
return true;
}
- template<> bool from_string(esvg::Dimension& _variableRet, const etk::UString& _value) {
- return from_string(_variableRet, etk::toString(_value));
+ template<> boolean frothis.string(esvg::Dimension& _variableRet, const etk::UString& _value) {
+ return frothis.string(_variableRet, etk::toString(_value));
}
};
esvg::Dimension1D::Dimension1D() :
- m_data(0.0f),
- m_type(esvg::distance_pixel) {
+ this.data(0.0f),
+ this.type(esvg::distance_pixel) {
// notinh to do ...
}
esvg::Dimension1D::Dimension1D(float _size, enum esvg::distance _type) :
- m_data(0.0f),
- m_type(esvg::distance_pixel) {
+ this.data(0.0f),
+ this.type(esvg::distance_pixel) {
set(_size, _type);
}
void esvg::Dimension1D::set(etk::String _config) {
- m_data = 0;
- m_type = esvg::distance_pixel;
+ this.data = 0;
+ this.type = esvg::distance_pixel;
enum distance type = esvg::distance_pixel;
if (etk::end_with(_config, "%", false) == true) {
type = esvg::distance_pourcent;
@@ -375,8 +375,8 @@ esvg::Dimension1D::operator etk::String() const {
}
void esvg::Dimension1D::set(float _size, enum esvg::distance _type) {
- m_data = _size;
- m_type = _type;
+ this.data = _size;
+ this.type = _type;
switch(_type) {
case esvg::distance_pourcent:
case esvg::distance_pixel:
@@ -398,23 +398,23 @@ void esvg::Dimension1D::set(float _size, enum esvg::distance _type) {
}
float esvg::Dimension1D::getPixel(float _upperSize) const {
- switch(m_type) {
+ switch(this.type) {
case esvg::distance_pourcent:
- return _upperSize*m_data*0.01f;
+ return _upperSize*this.data*0.01f;
case esvg::distance_pixel:
- return m_data;
+ return this.data;
case esvg::distance_meter:
- return m_data*meterToMillimeter*basicRatio;
+ return this.data*meterToMillimeter*basicRatio;
case esvg::distance_centimeter:
- return m_data*centimeterToMillimeter*basicRatio;
+ return this.data*centimeterToMillimeter*basicRatio;
case esvg::distance_millimeter:
- return m_data*basicRatio;
+ return this.data*basicRatio;
case esvg::distance_kilometer:
- return m_data*kilometerToMillimeter*basicRatio;
+ return this.data*kilometerToMillimeter*basicRatio;
case esvg::distance_inch:
- return m_data*inchToMillimeter*basicRatio;
+ return this.data*inchToMillimeter*basicRatio;
case esvg::distance_foot:
- return m_data*footToMillimeter*basicRatio;
+ return this.data*footToMillimeter*basicRatio;
}
return 128.0f;
}
@@ -431,12 +431,12 @@ namespace etk {
template<> etk::UString toUString(const esvg::Dimension1D& _obj) {
return etk::toUString(etk::toString(_obj));
}
- template<> bool from_string(esvg::Dimension1D& _variableRet, const etk::String& _value) {
+ template<> boolean frothis.string(esvg::Dimension1D& _variableRet, const etk::String& _value) {
_variableRet = esvg::Dimension1D(_value);
return true;
}
- template<> bool from_string(esvg::Dimension1D& _variableRet, const etk::UString& _value) {
- return from_string(_variableRet, etk::toString(_value));
+ template<> boolean frothis.string(esvg::Dimension1D& _variableRet, const etk::UString& _value) {
+ return frothis.string(_variableRet, etk::toString(_value));
}
};
diff --git a/src/org/atriasoft/esvg/Dimension.java b/src/org/atriasoft/esvg/Dimension.java
index 987cff1..9f5109a 100644
--- a/src/org/atriasoft/esvg/Dimension.java
+++ b/src/org/atriasoft/esvg/Dimension.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,10 +6,237 @@
*/
#pragma once
-#include
-#include
+#include#include
-namespace esvg {
+namespace esvg{
+/**
+ * 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
+ */
+class Dimension {
+ private:Vector2f this.data;
+ enum distance this.type;
+ public:
+ /**
+ * Constructor (default :0,0 mode pixel)
+ */
+ Dimension();
+
+ /**
+ * Constructor
+ * @param _size Requested dimention
+ * @param _type Unit of the Dimention
+ */
+ Dimension(const Vector2f& _size, enum esvg::distance _type=esvg::distance_pixel);
+ /**
+ * Constructor
+ * @param _config dimension configuration.
+ */
+ Dimension(const etk::String& _config) :
+ this.data(0,0),
+ this.type(esvg::distance_pixel) {
+ set(_config);
+ };
+ /**
+ * Constructor
+ * @param _configX dimension X configuration.
+ * @param _configY dimension Y configuration.
+ */
+ Dimension(const etk::String& _configX, const etk::String& _configY) :
+ this.data(0,0),
+ this.type(esvg::distance_pixel) {
+ set(_configX, _configY);
+ };
+ /**
+ * Destructor
+ */
+ ~Dimension();
+
+ /**
+ * string cast :
+ */
+ operator etk::String() const;
+
+ /**
+ * get the current dimention.
+ * @return dimention requested.
+ */
+ const Vector2f& getValue() const {
+ return this.data;
+ }
+ /**
+ * @breif get the dimension type
+ * @return the type
+ */
+ enum distance getType() const {
+ return this.type;
+ };
+ /**
+ * set the current dimention in requested type
+ * @param _size Dimention to set
+ * @param _type Type of unit requested.
+ */
+ void set(const Vector2f& _size, enum distance _type);
+
+ public:
+ /**
+ * set the current dimention in requested type
+ * @param _config dimension configuration.
+ */
+ void set(etk::String _config);
+ /**
+ * set the current dimention in requested type
+ * @param _configX dimension X configuration.
+ * @param _configY dimension Y configuration.
+ */
+ void set(etk::String _configX, etk::String _configY);
+ public:
+ /**
+ * get the current dimention in pixel
+ * @param _upperSize Size in pixel of the upper value
+ * @return dimention in Pixel
+ */
+ Vector2f getPixel(const Vector2f& _upperSize) const;
+ /*****************************************************
+ * = assigment
+ *****************************************************/
+ const Dimension& operator= (const Dimension& _obj ) {
+ if (this!=&_obj) {
+ this.data = _obj.this.data;
+ this.type = _obj.this.type;
+ }
+ return *this;
+ }
+ /*****************************************************
+ * == operator
+ *****************************************************/
+ boolean operator == (const Dimension& _obj) const {
+ if( this.data == _obj.this.data
+ && this.type == _obj.this.type) {
+ return true;
+ }
+ return false;
+ }
+ /*****************************************************
+ * != operator
+ *****************************************************/
+ boolean operator!= (const Dimension& _obj) const {
+ if( this.data != _obj.this.data
+ || this.type != _obj.this.type) {
+ return true;
+ }
+ return false;
+ }
+ };
+ etk::Stream& operator <<(etk::Stream& _os, enum esvg::distance _obj);
+ etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension& _obj);
+ /**
+ * 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
+ */
+ class Dimension1D {
+ private:
+ float this.data;
+ enum distance this.type;
+ public:
+ /**
+ * Constructor (default :0,0 mode pixel)
+ */
+ Dimension1D();
+ /**
+ * Constructor
+ * @param _size Requested dimention
+ * @param _type Unit of the Dimention
+ */
+ Dimension1D(float _size, enum esvg::distance _type=esvg::distance_pixel);
+ /**
+ * Constructor
+ * @param _config dimension configuration.
+ */
+ Dimension1D(const etk::String& _config) :
+ this.data(0.0f),
+ this.type(esvg::distance_pixel) {
+ set(_config);
+ };
+ /**
+ * Destructor
+ */
+ ~Dimension1D();
+
+ /**
+ * string cast :
+ */
+ operator etk::String() const;
+
+ /**
+ * get the current dimention.
+ * @return dimention requested.
+ */
+ const float& getValue() const {
+ return this.data;
+ }
+ /**
+ * @breif get the dimension type
+ * @return the type
+ */
+ enum distance getType() const {
+ return this.type;
+ };
+ /**
+ * set the current dimention in requested type
+ * @param _size Dimention to set
+ * @param _type Type of unit requested.
+ */
+ void set(float _size, enum distance _type);
+
+ public:
+ /**
+ * set the current dimention in requested type
+ * @param _config dimension configuration.
+ */
+ void set(etk::String _config);
+ public:
+ /**
+ * get the current dimention in pixel
+ * @param _upperSize Size in pixel of the upper value
+ * @return dimention in Pixel
+ */
+ float getPixel(float _upperSize) const;
+ /*****************************************************
+ * = assigment
+ *****************************************************/
+ const Dimension1D& operator= (const Dimension1D& _obj ) {
+ if (this!=&_obj) {
+ this.data = _obj.this.data;
+ this.type = _obj.this.type;
+ }
+ return *this;
+ }
+ /*****************************************************
+ * == operator
+ *****************************************************/
+ boolean operator == (const Dimension1D& _obj) const {
+ if( this.data == _obj.this.data
+ && this.type == _obj.this.type) {
+ return true;
+ }
+ return false;
+ }
+ /*****************************************************
+ * != operator
+ *****************************************************/
+ boolean operator!= (const Dimension1D& _obj) const {
+ if( this.data != _obj.this.data
+ || this.type != _obj.this.type) {
+ return true;
+ }
+ return false;
+ }
+ };
+ etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension1D& _obj);
+}
+
+;
enum distance {
distance_pourcent=0, //!< "%"
distance_pixel, //!< "px"
@@ -22,231 +250,4 @@ namespace esvg {
distance_ex, //!< "ex"
distance_point, //!< "pt"
distance_pc //!< "pc"
- };
- /**
- * @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
- */
- class Dimension {
- private:
- Vector2f m_data;
- enum distance m_type;
- public:
- /**
- * @brief Constructor (default :0,0 mode pixel)
- */
- Dimension();
- /**
- * @brief Constructor
- * @param[in] _size Requested dimention
- * @param[in] _type Unit of the Dimention
- */
- Dimension(const Vector2f& _size, enum esvg::distance _type=esvg::distance_pixel);
- /**
- * @brief Constructor
- * @param[in] _config dimension configuration.
- */
- Dimension(const etk::String& _config) :
- m_data(0,0),
- m_type(esvg::distance_pixel) {
- set(_config);
- };
- /**
- * @brief Constructor
- * @param[in] _configX dimension X configuration.
- * @param[in] _configY dimension Y configuration.
- */
- Dimension(const etk::String& _configX, const etk::String& _configY) :
- m_data(0,0),
- m_type(esvg::distance_pixel) {
- set(_configX, _configY);
- };
- /**
- * @brief Destructor
- */
- ~Dimension();
-
- /**
- * @brief string cast :
- */
- operator etk::String() const;
-
- /**
- * @brief get the current dimention.
- * @return dimention requested.
- */
- const Vector2f& getValue() const {
- return m_data;
- }
- /**
- * @breif get the dimension type
- * @return the type
- */
- enum distance getType() const {
- return m_type;
- };
- /**
- * @brief set the current dimention in requested type
- * @param[in] _size Dimention to set
- * @param[in] _type Type of unit requested.
- */
- void set(const Vector2f& _size, enum distance _type);
-
- public:
- /**
- * @brief set the current dimention in requested type
- * @param[in] _config dimension configuration.
- */
- 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(etk::String _configX, etk::String _configY);
- public:
- /**
- * @brief get the current dimention in pixel
- * @param[in] _upperSize Size in pixel of the upper value
- * @return dimention in Pixel
- */
- Vector2f getPixel(const Vector2f& _upperSize) const;
- /*****************************************************
- * = assigment
- *****************************************************/
- const Dimension& operator= (const Dimension& _obj ) {
- if (this!=&_obj) {
- m_data = _obj.m_data;
- m_type = _obj.m_type;
- }
- return *this;
- }
- /*****************************************************
- * == operator
- *****************************************************/
- bool operator == (const Dimension& _obj) const {
- if( m_data == _obj.m_data
- && m_type == _obj.m_type) {
- return true;
- }
- return false;
- }
- /*****************************************************
- * != operator
- *****************************************************/
- bool operator!= (const Dimension& _obj) const {
- if( m_data != _obj.m_data
- || m_type != _obj.m_type) {
- return true;
- }
- return false;
- }
- };
- 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
- */
- class Dimension1D {
- private:
- float m_data;
- enum distance m_type;
- public:
- /**
- * @brief Constructor (default :0,0 mode pixel)
- */
- Dimension1D();
- /**
- * @brief Constructor
- * @param[in] _size Requested dimention
- * @param[in] _type Unit of the Dimention
- */
- Dimension1D(float _size, enum esvg::distance _type=esvg::distance_pixel);
- /**
- * @brief Constructor
- * @param[in] _config dimension configuration.
- */
- Dimension1D(const etk::String& _config) :
- m_data(0.0f),
- m_type(esvg::distance_pixel) {
- set(_config);
- };
- /**
- * @brief Destructor
- */
- ~Dimension1D();
-
- /**
- * @brief string cast :
- */
- operator etk::String() const;
-
- /**
- * @brief get the current dimention.
- * @return dimention requested.
- */
- const float& getValue() const {
- return m_data;
- }
- /**
- * @breif get the dimension type
- * @return the type
- */
- enum distance getType() const {
- return m_type;
- };
- /**
- * @brief set the current dimention in requested type
- * @param[in] _size Dimention to set
- * @param[in] _type Type of unit requested.
- */
- void set(float _size, enum distance _type);
-
- public:
- /**
- * @brief set the current dimention in requested type
- * @param[in] _config dimension configuration.
- */
- void set(etk::String _config);
- public:
- /**
- * @brief get the current dimention in pixel
- * @param[in] _upperSize Size in pixel of the upper value
- * @return dimention in Pixel
- */
- float getPixel(float _upperSize) const;
- /*****************************************************
- * = assigment
- *****************************************************/
- const Dimension1D& operator= (const Dimension1D& _obj ) {
- if (this!=&_obj) {
- m_data = _obj.m_data;
- m_type = _obj.m_type;
- }
- return *this;
- }
- /*****************************************************
- * == operator
- *****************************************************/
- bool operator == (const Dimension1D& _obj) const {
- if( m_data == _obj.m_data
- && m_type == _obj.m_type) {
- return true;
- }
- return false;
- }
- /*****************************************************
- * != operator
- *****************************************************/
- bool operator!= (const Dimension1D& _obj) const {
- if( m_data != _obj.m_data
- || m_type != _obj.m_type) {
- return true;
- }
- return false;
- }
- };
- etk::Stream& operator <<(etk::Stream& _os, const esvg::Dimension1D& _obj);
-}
-
+ }
\ No newline at end of file
diff --git a/src/org/atriasoft/esvg/Ellipse.cpp b/src/org/atriasoft/esvg/Ellipse.cpp
index 20c7f91..6afdc0f 100644
--- a/src/org/atriasoft/esvg/Ellipse.cpp
+++ b/src/org/atriasoft/esvg/Ellipse.cpp
@@ -17,7 +17,7 @@ esvg::Ellipse::~Ellipse() {
}
-bool esvg::Ellipse::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Ellipse::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
if (_element.exist() == false) {
return false;
}
@@ -25,77 +25,77 @@ bool esvg::Ellipse::parseXML(const exml::Element& _element, mat2x3& _parentTrans
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
- m_c.setValue(0,0);
- m_r.setValue(0,0);
+ this.c.setValue(0,0);
+ this.r.setValue(0,0);
etk::String content = _element.attributes["cx"];
if (content.size()!=0) {
- m_c.setX(parseLength(content));
+ this.c.setX(parseLength(content));
}
content = _element.attributes["cy"];
if (content.size()!=0) {
- m_c.setY(parseLength(content));
+ this.c.setY(parseLength(content));
}
content = _element.attributes["rx"];
if (content.size()!=0) {
- m_r.setX(parseLength(content));
+ this.r.setX(parseLength(content));
} else {
Log.error("(l "<<_element.getPos()<<") Ellipse \"rx\" is not present");
return false;
}
content = _element.attributes["ry"];
if (content.size()!=0) {
- m_r.setY(parseLength(content));
+ this.r.setY(parseLength(content));
} else {
Log.error("(l "<<_element.getPos()<<") Ellipse \"ry\" is not present");
return false;
}
- _sizeMax.setValue(m_c.x() + m_r.x(), m_c.y() + m_r.y());
+ _sizeMax.setValue(this.c.x() + this.r.x(), this.c.y() + this.r.y());
return true;
}
-void esvg::Ellipse::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Ellipse c=" << m_c << " r=" << m_r);
+void esvg::Ellipse::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Ellipse c=" << this.c << " r=" << this.r);
}
esvg::render::Path esvg::Ellipse::createPath() {
esvg::render::Path out;
out.clear();
- out.moveTo(false, m_c + Vector2f(m_r.x(), 0.0f));
+ out.moveTo(false, this.c + Vector2f(this.r.x(), 0.0f));
out.curveTo(false,
- m_c + Vector2f(m_r.x(), m_r.y()*esvg::kappa90),
- m_c + Vector2f(m_r.x()*esvg::kappa90, m_r.y()),
- m_c + Vector2f(0.0f, m_r.y()));
+ this.c + Vector2f(this.r.x(), this.r.y()*esvg::kappa90),
+ this.c + Vector2f(this.r.x()*esvg::kappa90, this.r.y()),
+ this.c + Vector2f(0.0f, this.r.y()));
out.curveTo(false,
- m_c + Vector2f(-m_r.x()*esvg::kappa90, m_r.y()),
- m_c + Vector2f(-m_r.x(), m_r.y()*esvg::kappa90),
- m_c + Vector2f(-m_r.x(), 0.0f));
+ this.c + Vector2f(-this.r.x()*esvg::kappa90, this.r.y()),
+ this.c + Vector2f(-this.r.x(), this.r.y()*esvg::kappa90),
+ this.c + Vector2f(-this.r.x(), 0.0f));
out.curveTo(false,
- m_c + Vector2f(-m_r.x(), -m_r.y()*esvg::kappa90),
- m_c + Vector2f(-m_r.x()*esvg::kappa90, -m_r.y()),
- m_c + Vector2f(0.0f, -m_r.y()));
+ this.c + Vector2f(-this.r.x(), -this.r.y()*esvg::kappa90),
+ this.c + Vector2f(-this.r.x()*esvg::kappa90, -this.r.y()),
+ this.c + Vector2f(0.0f, -this.r.y()));
out.curveTo(false,
- m_c + Vector2f(m_r.x()*esvg::kappa90, -m_r.y()),
- m_c + Vector2f(m_r.x(), -m_r.y()*esvg::kappa90),
- m_c + Vector2f(m_r.x(), 0.0f));
+ this.c + Vector2f(this.r.x()*esvg::kappa90, -this.r.y()),
+ this.c + Vector2f(this.r.x(), -this.r.y()*esvg::kappa90),
+ this.c + Vector2f(this.r.x(), 0.0f));
out.close();
return out;
}
-void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::Ellipse");
- if ( m_r.x()<=0.0f
- || m_r.y()<=0.0f) {
- Log.verbose(spacingDist(_level+1) << "Too small radius" << m_r);
+ if ( this.r.x()<=0.0f
+ || this.r.y()<=0.0f) {
+ Log.verbose(spacingDist(_level+1) << "Too small radius" << this.r);
return;
}
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -107,10 +107,10 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -125,10 +125,10 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -141,7 +141,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
@@ -150,21 +150,21 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
void esvg::Ellipse::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Ellipse");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Ellipse.java b/src/org/atriasoft/esvg/Ellipse.java
index fd3fcb3..674b155 100644
--- a/src/org/atriasoft/esvg/Ellipse.java
+++ b/src/org/atriasoft/esvg/Ellipse.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,26 +6,30 @@
*/
#pragma once
-#include
+#include
-namespace esvg {
- class Ellipse : public esvg::Base {
- private:
- Vector2f m_c; //!< Center property of the ellipse
- Vector2f m_r; //!< Radius property of the ellipse
- public:
- Ellipse(PaintState _parentPaintState);
- ~Ellipse();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
- float _threshold,
+namespace esvg{
+class Ellipse extends esvg::Base
+{
+ private Vector2f c; //!< Center property of the ellipse
+ private Vector2f r; //!< Radius property of the ellipse
+
+ public Ellipse(final PaintState _parentPaintState) {
+ super(_parentPaintState);
+ }
+
+ public boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ public void display(final int _spacing) override;
+
+ public void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ public void drawShapePoints(final List> _out,
+ final int _recurtionMax,
+ final float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
- private:
- esvg::render::Path createPath();
- };
-}
-
+ int _level=1) override;
+ private esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/Group.cpp b/src/org/atriasoft/esvg/Group.cpp
index c0d7472..1cc7016 100644
--- a/src/org/atriasoft/esvg/Group.cpp
+++ b/src/org/atriasoft/esvg/Group.cpp
@@ -26,7 +26,7 @@ esvg::Group::~Group() {
}
-bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
if (_element.exist() == false) {
return false;
}
@@ -36,12 +36,12 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
parseTransform(_element);
parsePosition(_element, pos, size);
parsePaintAttr(_element);
- Log.verbose("parsed G1. trans : " << m_transformMatrix);
+ Log.verbose("parsed G1. trans : " << this.transformMatrix);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
- Log.verbose("parsed G2. trans : " << m_transformMatrix);
+ Log.verbose("parsed G2. trans : " << this.transformMatrix);
_sizeMax.setValue(0,0);
Vector2f tmpPos(0,0);
@@ -54,25 +54,25 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
}
ememory::SharedPtr elementParser;
if (child.getValue() == "g") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "a") {
// TODO ...
} else if (child.getValue() == "path") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "rect") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "circle") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "ellipse") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "line") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "polyline") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "polygon") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else if (child.getValue() == "text") {
- elementParser = ememory::makeShared(m_paint);
+ elementParser = ememory::makeShared(this.paint);
} else {
Log.error("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [g,a,path,rect,circle,ellipse,line,polyline,polygon,text]");
}
@@ -80,7 +80,7 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
Log.error("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' allocation error or not supported ...");
continue;
}
- if (elementParser->parseXML(child, m_transformMatrix, tmpPos) == false) {
+ if (elementParser->parseXML(child, this.transformMatrix, tmpPos) == false) {
Log.error("(l " << child.getPos() << ") error on node: '" << child.getValue() << "' Sub Parsing ERROR");
elementParser.reset();
continue;
@@ -88,16 +88,16 @@ bool esvg::Group::parseXML(const exml::Element& _element, mat2x3& _parentTrans,
_sizeMax.setValue(etk::max(_sizeMax.x(), tmpPos.x()),
etk::max(_sizeMax.y(), tmpPos.y()));
// add element in the system
- m_subElementList.pushBack(elementParser);
+ this.subElementList.pushBack(elementParser);
}
return true;
}
-void esvg::Group::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Group (START) fill=" << m_paint.fill.first << "/" << m_paint.fill.second
- << " stroke=" << m_paint.stroke.first << "/" << m_paint.stroke.second
- << " stroke-width=" << m_paint.strokeWidth );
- for (auto &it : m_subElementList) {
+void esvg::Group::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Group (START) fill=" << this.paint.fill.first << "/" << this.paint.fill.second
+ << " stroke=" << this.paint.stroke.first << "/" << this.paint.stroke.second
+ << " stroke-width=" << this.paint.strokeWidth );
+ for (auto &it : this.subElementList) {
if (it != null) {
it->display(_spacing+1);
}
@@ -105,9 +105,9 @@ void esvg::Group::display(int32_t _spacing) {
Log.debug(spacingDist(_spacing) << "Group (STOP)");
}
-void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::group");
- for (auto &it : m_subElementList) {
+ for (auto &it : this.subElementList) {
if (it != null) {
it->draw(_myRenderer, _basicTrans, _level+1);
}
@@ -115,12 +115,12 @@ void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
}
void esvg::Group::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW shape esvg::group");
- for (auto &it : m_subElementList) {
+ for (auto &it : this.subElementList) {
if (it != null) {
it->drawShapePoints(_out, _recurtionMax, _threshold, _basicTrans, _level+1);
}
diff --git a/src/org/atriasoft/esvg/Group.java b/src/org/atriasoft/esvg/Group.java
index f025ec3..eeea1ec 100644
--- a/src/org/atriasoft/esvg/Group.java
+++ b/src/org/atriasoft/esvg/Group.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,24 +6,29 @@
*/
#pragma once
-#include
-#include
+#include#include
-namespace esvg {
- class Group : public esvg::Base {
+namespace esvg{
+class Group extends esvg::Base
+{
private:
- List> m_subElementList; //!< sub elements ...
+ List> this.subElementList; //!< sub elements ...
public:
- Group(PaintState _parentPaintState);
- ~Group();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Group(PaintState _parentPaintState);~
+
+ Group();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(final List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
};
}
-
diff --git a/src/org/atriasoft/esvg/JoinMode.java b/src/org/atriasoft/esvg/JoinMode.java
new file mode 100644
index 0000000..5eb5cb8
--- /dev/null
+++ b/src/org/atriasoft/esvg/JoinMode.java
@@ -0,0 +1,13 @@
+package org.atriasoft.esvg;
+
+/** @file
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+
+public enum JoinMode {
+ MITER,
+ ROUND,
+ BEVEL
+}
diff --git a/src/org/atriasoft/esvg/Line.cpp b/src/org/atriasoft/esvg/Line.cpp
index e934505..929156c 100644
--- a/src/org/atriasoft/esvg/Line.cpp
+++ b/src/org/atriasoft/esvg/Line.cpp
@@ -10,17 +10,17 @@
#include
esvg::Line::Line(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
- m_startPos.setValue(0,0);
- m_stopPos.setValue(0,0);
+ this.startPos.setValue(0,0);
+ this.stopPos.setValue(0,0);
}
esvg::Line::~Line() {
}
-bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
// line must have a minimum size...
- m_paint.strokeWidth = 1;
+ this.paint.strokeWidth = 1;
if (_element.exist() == false) {
return false;
}
@@ -28,48 +28,48 @@ bool esvg::Line::parseXML(const exml::Element& _element, mat2x3& _parentTrans, V
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String content = _element.attributes["x1"];
if (content.size() != 0) {
- m_startPos.setX(parseLength(content));
+ this.startPos.setX(parseLength(content));
}
content = _element.attributes["y1"];
if (content.size() != 0) {
- m_startPos.setY(parseLength(content));
+ this.startPos.setY(parseLength(content));
}
content = _element.attributes["x2"];
if (content.size() != 0) {
- m_stopPos.setX(parseLength(content));
+ this.stopPos.setX(parseLength(content));
}
content = _element.attributes["y2"];
if (content.size() != 0) {
- m_stopPos.setY(parseLength(content));
+ this.stopPos.setY(parseLength(content));
}
- _sizeMax.setValue(etk::max(m_startPos.x(), m_stopPos.x()),
- etk::max(m_startPos.y(), m_stopPos.y()));
+ _sizeMax.setValue(etk::max(this.startPos.x(), this.stopPos.x()),
+ etk::max(this.startPos.y(), this.stopPos.y()));
return true;
}
-void esvg::Line::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Line " << m_startPos << " to " << m_stopPos);
+void esvg::Line::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Line " << this.startPos << " to " << this.stopPos);
}
esvg::render::Path esvg::Line::createPath() {
esvg::render::Path out;
out.clear();
- out.moveTo(false, m_startPos);
- out.lineTo(false, m_stopPos);
+ out.moveTo(false, this.startPos);
+ out.lineTo(false, this.stopPos);
out.stop();
return out;
}
-void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::Line");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -81,20 +81,20 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
// No background ...
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -107,31 +107,31 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
- _myRenderer.addDebugSegment(listElement.m_debugInformation);
+ _myRenderer.addDebugSegment(listElement.this.debugInformation);
#endif
}
void esvg::Line::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Line");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Line.java b/src/org/atriasoft/esvg/Line.java
index 7126470..2a73886 100644
--- a/src/org/atriasoft/esvg/Line.java
+++ b/src/org/atriasoft/esvg/Line.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,26 +6,32 @@
*/
#pragma once
-#include
+#include
-namespace esvg {
- class Line : public esvg::Base {
- private:
- Vector2f m_startPos; //!< Start line position
- Vector2f m_stopPos; //!< Stop line position
+namespace esvg{
+class Line extends Base {
+ private:
+ Vector2f this.startPos; //!< Start line position
+ Vector2f this.stopPos; //!< Stop line position
public:
- Line(PaintState _parentPaintState);
- ~Line();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Line(PaintState _parentPaintState);~
+
+ Line();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
private:
- esvg::render::Path createPath();
- };
-}
-
+ esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/LinearGradient.cpp b/src/org/atriasoft/esvg/LinearGradient.cpp
index 8b2f4b3..7b40134 100644
--- a/src/org/atriasoft/esvg/LinearGradient.cpp
+++ b/src/org/atriasoft/esvg/LinearGradient.cpp
@@ -13,10 +13,10 @@
esvg::LinearGradient::LinearGradient(PaintState _parentPaintState) :
esvg::Base(_parentPaintState),
- m_pos1(Vector2f(50,50), esvg::distance_pourcent),
- m_pos2(Vector2f(50,50), esvg::distance_pourcent),
- m_unit(gradientUnits_objectBoundingBox),
- m_spread(spreadMethod_pad) {
+ this.pos1(Vector2f(50,50), esvg::distance_pourcent),
+ this.pos2(Vector2f(50,50), esvg::distance_pourcent),
+ this.unit(gradientUnits_objectBoundingBox),
+ this.spread(spreadMethod_pad) {
}
@@ -25,39 +25,39 @@ esvg::LinearGradient::~LinearGradient() {
}
-bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
// line must have a minimum size...
- //m_paint.strokeWidth = 1;
+ //this.paint.strokeWidth = 1;
if (_element.exist() == false) {
return false;
}
// ---------------- get unique ID ----------------
- m_id = _element.attributes["id"];
+ this.id = _element.attributes["id"];
//parseTransform(_element);
//parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String contentX = _element.attributes["x1"];
etk::String contentY = _element.attributes["y1"];
if ( contentX != ""
&& contentY != "") {
- m_pos1.set(contentX, contentY);
+ this.pos1.set(contentX, contentY);
}
contentX = _element.attributes["x2"];
contentY = _element.attributes["y2"];
if ( contentX != ""
&& contentY != "") {
- m_pos2.set(contentX, contentY);
+ this.pos2.set(contentX, contentY);
}
contentX = _element.attributes["gradientUnits"];
if (contentX == "userSpaceOnUse") {
- m_unit = gradientUnits_userSpaceOnUse;
+ this.unit = gradientUnits_userSpaceOnUse;
} else {
- m_unit = gradientUnits_objectBoundingBox;
+ this.unit = gradientUnits_objectBoundingBox;
if ( contentX.size() != 0
&& contentX != "objectBoundingBox") {
Log.error("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox");
@@ -65,20 +65,20 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
}
contentX = _element.attributes["spreadMethod"];
if (contentX == "reflect") {
- m_spread = spreadMethod_reflect;
+ this.spread = spreadMethod_reflect;
} else if (contentX == "repeat") {
- m_spread = spreadMethod_repeat;
+ this.spread = spreadMethod_repeat;
} else {
- m_spread = spreadMethod_pad;
+ this.spread = spreadMethod_pad;
if ( contentX.size() != 0
&& contentX != "pad") {
Log.error("Parsing error of 'spreadMethod' ==> not suported value: '" << contentX << "' not in : {reflect/repeate/pad} use pad");
}
}
// note: xlink:href is incompatible with subNode "stop"
- m_href = _element.attributes["xlink:href"];
- if (m_href.size() != 0) {
- m_href = etk::String(m_href.begin()+1, m_href.end());
+ this.href = _element.attributes["xlink:href"];
+ if (this.href.size() != 0) {
+ this.href = etk::String(this.href.begin()+1, this.href.end());
}
// parse all sub node :
for(const auto it : _element.nodes) {
@@ -92,7 +92,7 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
etk::Color stopColor = etk::color::none;
etk::String content = child.attributes["offset"];
if (content.size()!=0) {
- etk::Pair tmp = parseLength2(content);
+ Pair 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;
@@ -114,58 +114,58 @@ bool esvg::LinearGradient::parseXML(const exml::Element& _element, mat2x3& _pare
stopColor.setA(opacity);
Log.verbose(" opacity : '" << content << "' == > " << stopColor);
}
- m_data.pushBack(etk::Pair>(offset, stopColor));
+ this.data.pushBack(Pair>(offset, stopColor));
} else {
Log.error("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [stop]");
}
}
- if (m_data.size() != 0) {
- if (m_href != "") {
+ if (this.data.size() != 0) {
+ if (this.href != "") {
Log.error("(l " << _element.getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href");
- m_href = "";
+ this.href = "";
}
}
return true;
}
-void esvg::LinearGradient::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "LinearGradient " << m_pos1 << " to " << m_pos2);
- for (auto &it : m_data) {
+void esvg::LinearGradient::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "LinearGradient " << this.pos1 << " to " << this.pos2);
+ for (auto &it : this.data) {
Log.debug(spacingDist(_spacing+1) << "STOP: offset=" << it.first << " color=" << it.second);
}
}
-void esvg::LinearGradient::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::LinearGradient::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::LinearGradient");
}
const esvg::Dimension& esvg::LinearGradient::getPosition1() {
- return m_pos1;
+ return this.pos1;
}
const esvg::Dimension& esvg::LinearGradient::getPosition2() {
- return m_pos2;
+ return this.pos2;
}
-const List>>& esvg::LinearGradient::getColors(esvg::Document* _document) {
- if (m_href == "") {
- return m_data;
+const List>>& esvg::LinearGradient::getColors(esvg::Document* _document) {
+ if (this.href == "") {
+ return this.data;
}
if (_document == null) {
Log.error("Get null input for document");
- return m_data;
+ return this.data;
}
- ememory::SharedPtr base = _document->getReference(m_href);
+ ememory::SharedPtr base = _document->getReference(this.href);
if (base == null) {
- Log.error("Can not get base : '" << m_href << "'");
- return m_data;
+ Log.error("Can not get base : '" << this.href << "'");
+ return this.data;
}
ememory::SharedPtr gradientR = ememory::dynamicPointerCast(base);
if (gradientR == null) {
ememory::SharedPtr gradientL = ememory::dynamicPointerCast(base);
if (gradientL == null) {
- Log.error("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
- return m_data;
+ Log.error("Can not cast in a linear/radial gradient: '" << this.href << "' ==> wrong type");
+ return this.data;
}
return gradientL->getColors(_document);
}
diff --git a/src/org/atriasoft/esvg/LinearGradient.java b/src/org/atriasoft/esvg/LinearGradient.java
index fda45bb..48f347d 100644
--- a/src/org/atriasoft/esvg/LinearGradient.java
+++ b/src/org/atriasoft/esvg/LinearGradient.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,32 +6,30 @@
*/
#pragma once
-#include
-#include
-#include
+#include#include#include
-namespace esvg {
- class Document;
- class LinearGradient : public esvg::Base {
+namespace esvg{
+class Document;
+class LinearGradient extends esvg::Base
+{
private:
- esvg::Dimension m_pos1; //!< gradient position x1 y1
- esvg::Dimension m_pos2; //!< gradient position x2 y2
+ esvg::Dimension this.pos1; //!< gradient position x1 y1
+ esvg::Dimension this.pos2; //!< gradient position x2 y2
public:
- enum gradientUnits m_unit;
- enum spreadMethod m_spread;
+ enum gradientUnits this.unit;
+ enum spreadMethod this.spread;
private:
- etk::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
- List>> m_data; //!< incompatible with href
+ etk::String this.href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
+ List>> this.data; //!< incompatible with href
public:
LinearGradient(PaintState _parentPaintState);
~LinearGradient();
- virtual bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
- virtual void display(int32_t _spacing);
- virtual void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level);
+ virtual boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
+ virtual void display(int _spacing);
+ virtual void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level);
public:
const esvg::Dimension& getPosition1();
const esvg::Dimension& getPosition2();
- const List>>& getColors(esvg::Document* _document);
+ const List>>& getColors(esvg::Document* _document);
};
}
-
diff --git a/src/org/atriasoft/esvg/PaintMode.java b/src/org/atriasoft/esvg/PaintMode.java
new file mode 100644
index 0000000..d971674
--- /dev/null
+++ b/src/org/atriasoft/esvg/PaintMode.java
@@ -0,0 +1,12 @@
+package org.atriasoft.esvg;
+
+/**
+ * Painting mode of the Object:
+ */
+public enum PaintMode {
+ NONE, //!< No painting.
+ COLOR, //!< Painting a color.
+ GRADIENT_LINEAR, //!< Painting a linear gradient.
+ GRADIENT_RADIAL; //!< Painting a radial gradient.
+
+}
diff --git a/src/org/atriasoft/esvg/PaintState.java b/src/org/atriasoft/esvg/PaintState.java
new file mode 100644
index 0000000..c46f820
--- /dev/null
+++ b/src/org/atriasoft/esvg/PaintState.java
@@ -0,0 +1,44 @@
+package org.atriasoft.esvg;
+
+import org.atriasoft.etk.Color;
+import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.etk.util.Pair;
+
+public class PaintState {
+
+ public Pair fill;
+ public Pair stroke;
+ public float strokeWidth;
+ public boolean flagEvenOdd;
+ public CapMode lineCap;
+ public JoinMode lineJoin; //!< Fill rules
+ public float miterLimit;
+ public Pair viewPort;
+ public float opacity;
+
+ public PaintState() {
+ this.fill = new Pair(new Color(0, 0, 0, 1), "");
+ this.stroke = new Pair(new Color(0, 0, 0, 0), "");
+ this.strokeWidth = 1.0f;
+ this.viewPort.first.setValue(0.0f, 0.0f);
+ this.viewPort.first.setValue(0.0f, 0.0f);
+ this.flagEvenOdd = false;
+ this.lineJoin = JoinMode.MITER;
+ this.lineCap = CapMode.BUTT;
+ this.miterLimit = 4.0f;
+ this.opacity = 1.0f;
+ }
+
+ public void clear() {
+ this.fill = new Pair(new Color(0, 0, 0, 1), "");
+ this.stroke = new Pair(new Color(0, 0, 0, 0), "");
+ this.strokeWidth = 1.0f;
+ this.viewPort.first.setValue(0.0f, 0.0f);
+ this.viewPort.first.setValue(0.0f, 0.0f);
+ this.flagEvenOdd = false;
+ this.lineJoin = JoinMode.MITER;
+ this.lineCap = CapMode.BUTT;
+ this.miterLimit = 4.0f;
+ this.opacity = 1.0f;
+ }
+}
diff --git a/src/org/atriasoft/esvg/Path.cpp b/src/org/atriasoft/esvg/Path.cpp
index 8dcdee5..8bb2dea 100644
--- a/src/org/atriasoft/esvg/Path.cpp
+++ b/src/org/atriasoft/esvg/Path.cpp
@@ -38,11 +38,11 @@ const char * extractCmd(const char* _input, char& _cmd, List& _outputList
if (_input[1] == '\0') {
return &_input[1];
}
- int32_t iii=1;
+ int iii=1;
// extract every float separated by a ' ' or a ','
float element;
char spacer[10];
- int32_t nbElementRead;
+ int nbElementRead;
while( sscanf(&_input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|| sscanf(&_input[iii], "%f%n", &element, &nbElementRead) == 1) {
Log.verbose("Find element : " << element);
@@ -58,7 +58,7 @@ const char * extractCmd(const char* _input, char& _cmd, List& _outputList
}
etk::String cleanBadSpaces(const etk::String& _input) {
etk::String out;
- bool haveSpace = false;
+ boolean haveSpace = false;
for (auto &it : _input) {
if ( it == ' '
|| it == '\t'
@@ -76,7 +76,7 @@ etk::String cleanBadSpaces(const etk::String& _input) {
return out;
}
-bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
if (_element.exist() == false) {
return false;
}
@@ -84,7 +84,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, V
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String elementXML1 = _element.attributes["d"];
@@ -102,7 +102,7 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, V
for( const char *sss=extractCmd(elementXML, command, listDot);
sss != null;
sss=extractCmd(sss, command, listDot) ) {
- bool relative = false;
+ boolean relative = false;
switch(command) {
case 'm': // Move to (relative)
relative = true;
@@ -113,11 +113,11 @@ bool esvg::Path::parseXML(const exml::Element& _element, mat2x3& _parentTrans, V
break;
}
if (listDot.size() >= 2) {
- m_listElement.moveTo(relative,
+ this.listElement.moveTo(relative,
Vector2f(listDot[0], listDot[1]));
}
for (size_t iii=2; iii colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -301,10 +301,10 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -315,33 +315,33 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
- m_listElement.m_debugInformation.applyMatrix(mtx);
- _myRenderer.addDebugSegment(m_listElement.m_debugInformation);
+ this.listElement.this.debugInformation.applyMatrix(mtx);
+ _myRenderer.addDebugSegment(this.listElement.this.debugInformation);
#endif
}
void esvg::Path::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Path");
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
- listPoints = m_listElement.generateListPoints(_level, _recurtionMax, _threshold);
+ listPoints = this.listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Path.java b/src/org/atriasoft/esvg/Path.java
index 44e9121..6b3ca4f 100644
--- a/src/org/atriasoft/esvg/Path.java
+++ b/src/org/atriasoft/esvg/Path.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,24 +6,29 @@
*/
#pragma once
-#include
-#include
+#include#include
-namespace esvg {
- class Path : public esvg::Base {
+namespace esvg{
+class Path extends esvg::Base
+{
public:
- esvg::render::Path m_listElement;
+ esvg::render::Path this.listElement;
public:
- Path(PaintState _parentPaintState);
- ~Path();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Path(PaintState _parentPaintState);~
+
+ Path();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(final List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
};
}
-
diff --git a/src/org/atriasoft/esvg/Polygon.cpp b/src/org/atriasoft/esvg/Polygon.cpp
index de010ec..e80cac4 100644
--- a/src/org/atriasoft/esvg/Polygon.cpp
+++ b/src/org/atriasoft/esvg/Polygon.cpp
@@ -17,19 +17,19 @@ esvg::Polygon::~Polygon() {
}
-bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
if (_element.exist() == false) {
return false;
}
parseTransform(_element);
parsePaintAttr(_element);
- Log.verbose("parsed P1. trans: " << m_transformMatrix);
+ Log.verbose("parsed P1. trans: " << this.transformMatrix);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
- Log.verbose("parsed P2. trans: " << m_transformMatrix);
+ Log.verbose("parsed P2. trans: " << this.transformMatrix);
const etk::String sss1 = _element.attributes["points"];
if (sss1.size() == 0) {
@@ -41,9 +41,9 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
Log.verbose("Parse polygon : \"" << sss << "\"");
while ('\0' != sss[0]) {
Vector2f pos(0,0);
- int32_t n;
- if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
- m_listPoint.pushBack(pos);
+ int n;
+ if (sscanf(sss, "%f,%f%n", &pos.this.floats[0], &pos.this.floats[1], &n) == 2) {
+ this.listPoint.pushBack(pos);
sss += n;
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
etk::max(_sizeMax.y(), pos.y()));
@@ -57,26 +57,26 @@ bool esvg::Polygon::parseXML(const exml::Element& _element, mat2x3& _parentTrans
return true;
}
-void esvg::Polygon::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Polygon nbPoint=" << m_listPoint.size());
+void esvg::Polygon::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Polygon nbPoint=" << this.listPoint.size());
}
esvg::render::Path esvg::Polygon::createPath() {
esvg::render::Path out;
- out.moveTo(false, m_listPoint[0]);
- for(size_t iii=1; iii< m_listPoint.size(); iii++) {
- out.lineTo(false, m_listPoint[iii]);
+ out.moveTo(false, this.listPoint[0]);
+ for(size_t iii=1; iii< this.listPoint.size(); iii++) {
+ out.lineTo(false, this.listPoint[iii]);
}
out.close();
return out;
}
-void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::Polygon");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -88,10 +88,10 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -106,10 +106,10 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -122,7 +122,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
@@ -131,21 +131,21 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32
void esvg::Polygon::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Polygon");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Polygon.java b/src/org/atriasoft/esvg/Polygon.java
index 439ad1f..04fffc2 100644
--- a/src/org/atriasoft/esvg/Polygon.java
+++ b/src/org/atriasoft/esvg/Polygon.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,33 +6,39 @@
*/
#pragma once
-#include
-#include
+#include#include
-namespace esvg {
- /*
- enum polygonMode {
- polygoneModeNonZero,
- polygoneModeEvenOdd
- };
- */
- class Polygon : public esvg::Base {
+namespace esvg{
+/*
+enum polygonMode {
+ polygoneModeNonZero,
+ polygoneModeEvenOdd
+};
+*/
+class Polygon extends esvg::Base
+{
private:
- List m_listPoint; //!< list of all point of the polygone
- //enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
+ List this.listPoint; //!< list of all point of the polygone
+ //enum esvg::polygonMode this.diplayMode; //!< polygone specific display mode
public:
- Polygon(PaintState parentPaintState);
- ~Polygon();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Polygon(PaintState parentPaintState);~
+
+ Polygon();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
private:
- esvg::render::Path createPath();
- };
-}
-
+ esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/Polyline.cpp b/src/org/atriasoft/esvg/Polyline.cpp
index 01ceb61..8234403 100644
--- a/src/org/atriasoft/esvg/Polyline.cpp
+++ b/src/org/atriasoft/esvg/Polyline.cpp
@@ -17,9 +17,9 @@ esvg::Polyline::~Polyline() {
}
-bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
// line must have a minimum size...
- m_paint.strokeWidth = 1;
+ this.paint.strokeWidth = 1;
if (_element.exist() == false) {
return false;
}
@@ -27,7 +27,7 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String sss1 = _element.attributes["points"];
if (sss1.size() == 0) {
@@ -39,9 +39,9 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
const char* sss = sss1.c_str();
while ('\0' != sss[0]) {
Vector2f pos;
- int32_t n;
- if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
- m_listPoint.pushBack(pos);
+ int n;
+ if (sscanf(sss, "%f,%f %n", &pos.this.floats[0], &pos.this.floats[1], &n) == 2) {
+ this.listPoint.pushBack(pos);
_sizeMax.setValue(etk::max(_sizeMax.x(), pos.x()),
etk::max(_sizeMax.y(), pos.y()));
sss += n;
@@ -52,28 +52,28 @@ bool esvg::Polyline::parseXML(const exml::Element& _element, mat2x3& _parentTran
return true;
}
-void esvg::Polyline::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Polyline nbPoint=" << m_listPoint.size());
+void esvg::Polyline::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Polyline nbPoint=" << this.listPoint.size());
}
esvg::render::Path esvg::Polyline::createPath() {
esvg::render::Path out;
out.clear();
- out.moveTo(false, m_listPoint[0]);
- for(size_t iii=1; iii< m_listPoint.size(); iii++) {
- out.lineTo(false, m_listPoint[iii]);
+ out.moveTo(false, this.listPoint[0]);
+ for(size_t iii=1; iii< this.listPoint.size(); iii++) {
+ out.lineTo(false, this.listPoint[iii]);
}
out.stop();
return out;
}
-void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::Polyline");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -85,10 +85,10 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -103,10 +103,10 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -119,7 +119,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
@@ -128,21 +128,21 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int3
void esvg::Polyline::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Polyline");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Polyline.java b/src/org/atriasoft/esvg/Polyline.java
index 5c5266b..10313b5 100644
--- a/src/org/atriasoft/esvg/Polyline.java
+++ b/src/org/atriasoft/esvg/Polyline.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,26 +6,32 @@
*/
#pragma once
-#include
-#include
+#include#include
-namespace esvg {
- class Polyline : public esvg::Base {
+namespace esvg{
+class Polyline extends esvg::Base
+{
private:
- List m_listPoint; //!< list of all point of the polyline
+ List this.listPoint; //!< list of all point of the polyline
public:
- Polyline(PaintState _parentPaintState);
- ~Polyline();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Polyline(PaintState _parentPaintState);~
+
+ Polyline();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
private:
- esvg::render::Path createPath();
- };
-}
-
+ esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/RadialGradient.cpp b/src/org/atriasoft/esvg/RadialGradient.cpp
index ed05a04..a82ce78 100644
--- a/src/org/atriasoft/esvg/RadialGradient.cpp
+++ b/src/org/atriasoft/esvg/RadialGradient.cpp
@@ -13,11 +13,11 @@
esvg::RadialGradient::RadialGradient(PaintState _parentPaintState) :
esvg::Base(_parentPaintState),
- m_center(Vector2f(50,50), esvg::distance_pourcent),
- m_radius(50, esvg::distance_pourcent),
- m_focal(Vector2f(50,50), esvg::distance_pourcent),
- m_unit(gradientUnits_objectBoundingBox),
- m_spread(spreadMethod_pad) {
+ this.center(Vector2f(50,50), esvg::distance_pourcent),
+ this.radius(50, esvg::distance_pourcent),
+ this.focal(Vector2f(50,50), esvg::distance_pourcent),
+ this.unit(gradientUnits_objectBoundingBox),
+ this.spread(spreadMethod_pad) {
}
@@ -26,43 +26,43 @@ esvg::RadialGradient::~RadialGradient() {
}
-bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
// line must have a minimum size...
- //m_paint.strokeWidth = 1;
+ //this.paint.strokeWidth = 1;
if (_element.exist() == false) {
return false;
}
// ---------------- get unique ID ----------------
- m_id = _element.attributes["id"];
+ this.id = _element.attributes["id"];
//parseTransform(_element);
//parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
etk::String contentX = _element.attributes["cx"];
etk::String contentY = _element.attributes["cy"];
if ( contentX != ""
&& contentY != "") {
- m_center.set(contentX, contentY);
+ this.center.set(contentX, contentY);
}
contentX = _element.attributes["r"];
if (contentX != "") {
- m_radius.set(contentX);
+ this.radius.set(contentX);
}
contentX = _element.attributes["fx"];
contentY = _element.attributes["fy"];
if ( contentX != ""
&& contentY != "") {
- m_focal.set(contentX, contentY);
+ this.focal.set(contentX, contentY);
}
contentX = _element.attributes["gradientUnits"];
if (contentX == "userSpaceOnUse") {
- m_unit = gradientUnits_userSpaceOnUse;
+ this.unit = gradientUnits_userSpaceOnUse;
} else {
- m_unit = gradientUnits_objectBoundingBox;
+ this.unit = gradientUnits_objectBoundingBox;
if ( contentX.size() != 0
&& contentX != "objectBoundingBox") {
Log.error("Parsing error of 'gradientUnits' ==> not suported value: '" << contentX << "' not in : {userSpaceOnUse/objectBoundingBox} use objectBoundingBox");
@@ -70,20 +70,20 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
}
contentX = _element.attributes["spreadMethod"];
if (contentX == "reflect") {
- m_spread = spreadMethod_reflect;
+ this.spread = spreadMethod_reflect;
} else if (contentX == "repeat") {
- m_spread = spreadMethod_repeat;
+ this.spread = spreadMethod_repeat;
} else {
- m_spread = spreadMethod_pad;
+ this.spread = spreadMethod_pad;
if ( contentX.size() != 0
&& contentX != "pad") {
Log.error("Parsing error of 'spreadMethod' ==> not suported value: '" << contentX << "' not in : {reflect/repeate/pad} use pad");
}
}
// note: xlink:href is incompatible with subNode "stop"
- m_href = _element.attributes["xlink:href"];
- if (m_href.size() != 0) {
- m_href = etk::String(m_href.begin()+1, m_href.end());
+ this.href = _element.attributes["xlink:href"];
+ if (this.href.size() != 0) {
+ this.href = etk::String(this.href.begin()+1, this.href.end());
}
// parse all sub node :
for(auto it : _element.nodes) {
@@ -97,7 +97,7 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
etk::Color stopColor = etk::color::none;
etk::String content = child.attributes["offset"];
if (content.size()!=0) {
- etk::Pair tmp = parseLength2(content);
+ Pair 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;
@@ -119,62 +119,62 @@ bool esvg::RadialGradient::parseXML(const exml::Element& _element, mat2x3& _pare
stopColor.setA(opacity);
Log.verbose(" opacity : '" << content << "' == > " << stopColor);
}
- m_data.pushBack(etk::Pair>(offset, stopColor));
+ this.data.pushBack(Pair>(offset, stopColor));
} else {
Log.error("(l " << child.getPos() << ") node not suported : '" << child.getValue() << "' must be [stop]");
}
}
- if (m_data.size() != 0) {
- if (m_href != "") {
+ if (this.data.size() != 0) {
+ if (this.href != "") {
Log.error("(l " << _element.getPos() << ") node can not have an xlink:href element with sub node named: stop ==> removing href");
- m_href = "";
+ this.href = "";
}
}
return true;
}
-void esvg::RadialGradient::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "RadialGradient center=" << m_center << " focal=" << m_focal << " radius=" << m_radius);
- for (auto &it : m_data) {
+void esvg::RadialGradient::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "RadialGradient center=" << this.center << " focal=" << this.focal << " radius=" << this.radius);
+ for (auto &it : this.data) {
Log.debug(spacingDist(_spacing+1) << "STOP: offset=" << it.first << " color=" << it.second);
}
}
-void esvg::RadialGradient::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
+void esvg::RadialGradient::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
Log.verbose(spacingDist(_level) << "DRAW esvg::RadialGradient");
}
const esvg::Dimension& esvg::RadialGradient::getCenter() {
- return m_center;
+ return this.center;
}
const esvg::Dimension& esvg::RadialGradient::getFocal() {
- return m_focal;
+ return this.focal;
}
const esvg::Dimension1D& esvg::RadialGradient::getRadius() {
- return m_radius;
+ return this.radius;
}
-const List>>& esvg::RadialGradient::getColors(esvg::Document* _document) {
- if (m_href == "") {
- return m_data;
+const List>>& esvg::RadialGradient::getColors(esvg::Document* _document) {
+ if (this.href == "") {
+ return this.data;
}
if (_document == null) {
Log.error("Get null input for document");
- return m_data;
+ return this.data;
}
- ememory::SharedPtr base = _document->getReference(m_href);
+ ememory::SharedPtr base = _document->getReference(this.href);
if (base == null) {
- Log.error("Can not get base : '" << m_href << "'");
- return m_data;
+ Log.error("Can not get base : '" << this.href << "'");
+ return this.data;
}
ememory::SharedPtr gradientR = ememory::dynamicPointerCast(base);
if (gradientR == null) {
ememory::SharedPtr gradientL = ememory::dynamicPointerCast(base);
if (gradientL == null) {
- Log.error("Can not cast in a linear/radial gradient: '" << m_href << "' ==> wrong type");
- return m_data;
+ Log.error("Can not cast in a linear/radial gradient: '" << this.href << "' ==> wrong type");
+ return this.data;
}
return gradientL->getColors(_document);
}
diff --git a/src/org/atriasoft/esvg/RadialGradient.java b/src/org/atriasoft/esvg/RadialGradient.java
index 491ee8c..b391f5b 100644
--- a/src/org/atriasoft/esvg/RadialGradient.java
+++ b/src/org/atriasoft/esvg/RadialGradient.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,34 +6,32 @@
*/
#pragma once
-#include
-#include
-#include
+#include#include#include
-namespace esvg {
- class Document;
- class RadialGradient : public esvg::Base {
+namespace esvg{
+class Document;
+class RadialGradient extends esvg::Base
+{
private:
- esvg::Dimension m_center; //!< gradient position cx cy
- esvg::Dimension1D m_radius; //!< Radius of the gradient
- esvg::Dimension m_focal; //!< gradient Focal fx fy
+ esvg::Dimension this.center; //!< gradient position cx cy
+ esvg::Dimension1D this.radius; //!< Radius of the gradient
+ esvg::Dimension this.focal; //!< gradient Focal fx fy
public:
- enum gradientUnits m_unit;
- enum spreadMethod m_spread;
+ enum gradientUnits this.unit;
+ enum spreadMethod this.spread;
private:
- etk::String m_href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
- List>> m_data; //!< incompatible with href
+ etk::String this.href; //!< in case of using a single gradient in multiple gradient, the gradient is store in an other element...
+ List>> this.data; //!< incompatible with href
public:
RadialGradient(PaintState _parentPaintState);
~RadialGradient();
- virtual bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
- virtual void display(int32_t _spacing);
- virtual void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level);
+ virtual boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax);
+ virtual void display(int _spacing);
+ virtual void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level);
public:
const esvg::Dimension& getCenter();
const esvg::Dimension& getFocal();
const esvg::Dimension1D& getRadius();
- const List>>& getColors(esvg::Document* _document);
+ const List>>& getColors(esvg::Document* _document);
};
}
-
diff --git a/src/org/atriasoft/esvg/Rectangle.cpp b/src/org/atriasoft/esvg/Rectangle.cpp
index 166d47f..81be3ca 100644
--- a/src/org/atriasoft/esvg/Rectangle.cpp
+++ b/src/org/atriasoft/esvg/Rectangle.cpp
@@ -10,87 +10,87 @@
#include
esvg::Rectangle::Rectangle(PaintState _parentPaintState) : esvg::Base(_parentPaintState) {
- m_position.setValue(0,0);
- m_size.setValue(0,0);
- m_roundedCorner.setValue(0,0);
+ this.position.setValue(0,0);
+ this.size.setValue(0,0);
+ this.roundedCorner.setValue(0,0);
}
esvg::Rectangle::~Rectangle() {
}
-bool esvg::Rectangle::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
+boolean esvg::Rectangle::parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) {
if (_element.exist() == false) {
return false;
}
- m_position.setValue(0.0f, 0.0f);
- m_size.setValue(0.0f, 0.0f);
- m_roundedCorner.setValue(0.0f, 0.0f);
+ this.position.setValue(0.0f, 0.0f);
+ this.size.setValue(0.0f, 0.0f);
+ this.roundedCorner.setValue(0.0f, 0.0f);
parseTransform(_element);
parsePaintAttr(_element);
// add the property of the parrent modifications ...
- m_transformMatrix *= _parentTrans;
+ this.transformMatrix *= _parentTrans;
- parsePosition(_element, m_position, m_size);
+ parsePosition(_element, this.position, this.size);
etk::String content = _element.attributes["rx"];
if (content.size()!=0) {
- m_roundedCorner.setX(parseLength(content));
+ this.roundedCorner.setX(parseLength(content));
}
content = _element.attributes["ry"];
if (content.size()!=0) {
- m_roundedCorner.setY(parseLength(content));
+ this.roundedCorner.setY(parseLength(content));
}
- _sizeMax.setValue(m_position.x() + m_size.x() + m_paint.strokeWidth,
- m_position.y() + m_size.y() + m_paint.strokeWidth);
+ _sizeMax.setValue(this.position.x() + this.size.x() + this.paint.strokeWidth,
+ this.position.y() + this.size.y() + this.paint.strokeWidth);
return true;
}
-void esvg::Rectangle::display(int32_t _spacing) {
- Log.debug(spacingDist(_spacing) << "Rectangle : pos=" << m_position << " size=" << m_size << " corner=" << m_roundedCorner);
+void esvg::Rectangle::display(int _spacing) {
+ Log.debug(spacingDist(_spacing) << "Rectangle : pos=" << this.position << " size=" << this.size << " corner=" << this.roundedCorner);
}
esvg::render::Path esvg::Rectangle::createPath() {
esvg::render::Path out;
out.clear();
- if ( m_roundedCorner.x() == 0.0f
- || m_roundedCorner.y() == 0.0f) {
- out.moveTo(false, m_position);
- out.lineToH(true, m_size.x());
- out.lineToV(true, m_size.y());
- out.lineToH(true, -m_size.x());
+ if ( this.roundedCorner.x() == 0.0f
+ || this.roundedCorner.y() == 0.0f) {
+ out.moveTo(false, this.position);
+ out.lineToH(true, this.size.x());
+ out.lineToV(true, this.size.y());
+ out.lineToH(true, -this.size.x());
} else {
// Rounded rectangle
- out.moveTo(false, m_position + Vector2f(m_roundedCorner.x(), 0.0f));
- out.lineToH(true, m_size.x()-m_roundedCorner.x()*2.0f);
- out.curveTo(true, Vector2f(m_roundedCorner.x()*esvg::kappa90, 0.0f),
- Vector2f(m_roundedCorner.x(), m_roundedCorner.y() * (1.0f - esvg::kappa90)),
- Vector2f(m_roundedCorner.x(), m_roundedCorner.y()) );
- out.lineToV(true, m_size.y()-m_roundedCorner.y()*2.0f);
- out.curveTo(true, Vector2f(0.0f, m_roundedCorner.y() * esvg::kappa90),
- Vector2f(-m_roundedCorner.x()* (1.0f - esvg::kappa90), m_roundedCorner.y()),
- Vector2f(-m_roundedCorner.x(), m_roundedCorner.y()) );
- out.lineToH(true, -(m_size.x()-m_roundedCorner.x()*2.0f));
- out.curveTo(true, Vector2f(-m_roundedCorner.x()*esvg::kappa90, 0.0f),
- Vector2f(-m_roundedCorner.x(), -m_roundedCorner.y() * (1.0f - esvg::kappa90)),
- Vector2f(-m_roundedCorner.x(), -m_roundedCorner.y()) );
- out.lineToV(true, -(m_size.y()-m_roundedCorner.y()*2.0f));
- out.curveTo(true, Vector2f(0.0f, -m_roundedCorner.y() * esvg::kappa90),
- Vector2f(m_roundedCorner.x()* (1.0f - esvg::kappa90), -m_roundedCorner.y()),
- Vector2f(m_roundedCorner.x(), -m_roundedCorner.y()) );
+ out.moveTo(false, this.position + Vector2f(this.roundedCorner.x(), 0.0f));
+ out.lineToH(true, this.size.x()-this.roundedCorner.x()*2.0f);
+ out.curveTo(true, Vector2f(this.roundedCorner.x()*esvg::kappa90, 0.0f),
+ Vector2f(this.roundedCorner.x(), this.roundedCorner.y() * (1.0f - esvg::kappa90)),
+ Vector2f(this.roundedCorner.x(), this.roundedCorner.y()) );
+ out.lineToV(true, this.size.y()-this.roundedCorner.y()*2.0f);
+ out.curveTo(true, Vector2f(0.0f, this.roundedCorner.y() * esvg::kappa90),
+ Vector2f(-this.roundedCorner.x()* (1.0f - esvg::kappa90), this.roundedCorner.y()),
+ Vector2f(-this.roundedCorner.x(), this.roundedCorner.y()) );
+ out.lineToH(true, -(this.size.x()-this.roundedCorner.x()*2.0f));
+ out.curveTo(true, Vector2f(-this.roundedCorner.x()*esvg::kappa90, 0.0f),
+ Vector2f(-this.roundedCorner.x(), -this.roundedCorner.y() * (1.0f - esvg::kappa90)),
+ Vector2f(-this.roundedCorner.x(), -this.roundedCorner.y()) );
+ out.lineToV(true, -(this.size.y()-this.roundedCorner.y()*2.0f));
+ out.curveTo(true, Vector2f(0.0f, -this.roundedCorner.y() * esvg::kappa90),
+ Vector2f(this.roundedCorner.x()* (1.0f - esvg::kappa90), -this.roundedCorner.y()),
+ Vector2f(this.roundedCorner.x(), -this.roundedCorner.y()) );
}
out.close();
return out;
}
-void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) {
- Log.verbose(spacingDist(_level) << "DRAW esvg::Rectangle: fill=" << m_paint.fill.first << "/" << m_paint.fill.second
- << " stroke=" << m_paint.stroke.first << "/" << m_paint.stroke.second);
+void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) {
+ Log.verbose(spacingDist(_level) << "DRAW esvg::Rectangle: fill=" << this.paint.fill.first << "/" << this.paint.fill.second
+ << " stroke=" << this.paint.stroke.first << "/" << this.paint.stroke.second);
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
@@ -102,10 +102,10 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
esvg::render::SegmentList listSegmentStroke;
esvg::render::Weight tmpFill;
esvg::render::Weight tmpStroke;
- ememory::SharedPtr colorFill = esvg::render::createColor(m_paint.fill, mtx);
+ ememory::SharedPtr colorFill = esvg::render::createColor(this.paint.fill, mtx);
ememory::SharedPtr colorStroke;
- if (m_paint.strokeWidth > 0.0f) {
- colorStroke = esvg::render::createColor(m_paint.stroke, mtx);
+ if (this.paint.strokeWidth > 0.0f) {
+ colorStroke = esvg::render::createColor(this.paint.stroke, mtx);
}
// Check if we need to display background
if (colorFill != null) {
@@ -120,10 +120,10 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
// check if we need to display stroke:
if (colorStroke != null) {
listSegmentStroke.createSegmentListStroke(listPoints,
- m_paint.strokeWidth,
- m_paint.lineCap,
- m_paint.lineJoin,
- m_paint.miterLimit);
+ this.paint.strokeWidth,
+ this.paint.lineCap,
+ this.paint.lineJoin,
+ this.paint.miterLimit);
colorStroke->setViewPort(listSegmentStroke.getViewPort());
listSegmentStroke.applyMatrix(mtx);
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
@@ -136,7 +136,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
colorFill,
tmpStroke,
colorStroke,
- m_paint.opacity);
+ this.paint.opacity);
#ifdef DEBUG
_myRenderer.addDebugSegment(listSegmentFill);
_myRenderer.addDebugSegment(listSegmentStroke);
@@ -145,21 +145,21 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int
void esvg::Rectangle::drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level) {
+ int _level) {
Log.verbose(spacingDist(_level) << "DRAW Shape esvg::Rectangle");
esvg::render::Path listElement = createPath();
- mat2x3 mtx = m_transformMatrix;
+ mat2x3 mtx = this.transformMatrix;
mtx *= _basicTrans;
esvg::render::PointList listPoints;
listPoints = listElement.generateListPoints(_level, _recurtionMax, _threshold);
listPoints.applyMatrix(mtx);
- for (auto &it : listPoints.m_data) {
+ for (auto &it : listPoints.this.data) {
List listPoint;
for (auto &itDot : it) {
- listPoint.pushBack(itDot.m_pos);
+ listPoint.pushBack(itDot.this.pos);
}
_out.pushBack(listPoint);
}
diff --git a/src/org/atriasoft/esvg/Rectangle.java b/src/org/atriasoft/esvg/Rectangle.java
index c942b5f..5826adc 100644
--- a/src/org/atriasoft/esvg/Rectangle.java
+++ b/src/org/atriasoft/esvg/Rectangle.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,27 +6,34 @@
*/
#pragma once
-#include
+#include
-namespace esvg {
- class Rectangle : public esvg::Base {
+namespace esvg{
+class Rectangle extends esvg::Base
+{
private:
- Vector2f m_position; //!< position of the rectangle
- Vector2f m_size; //!< size of the rectangle
- Vector2f m_roundedCorner; //!< property of the rounded corner
+ Vector2f this.position; //!< position of the rectangle
+ Vector2f this.size; //!< size of the rectangle
+ Vector2f this.roundedCorner; //!< property of the rounded corner
public:
- Rectangle(PaintState _parentPaintState);
- ~Rectangle();
- bool parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
- void display(int32_t _spacing) override;
- void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int32_t _level) override;
- void drawShapePoints(List>& _out,
- int32_t _recurtionMax,
+
+ Rectangle(PaintState _parentPaintState);~
+
+ Rectangle();
+
+ boolean parseXML(const exml::Element& _element, mat2x3& _parentTrans, Vector2f& _sizeMax) override;
+
+ void display(final int _spacing) override;
+
+ void draw(esvg::Renderer& _myRenderer, mat2x3& _basicTrans, int _level) override;
+
+ void drawShapePoints(List>& _out,
+ int _recurtionMax,
float _threshold,
mat2x3& _basicTrans,
- int32_t _level=1) override;
+ int _level=1) override;
private:
- esvg::render::Path createPath();
- };
-}
-
+ esvg::render::
+
+ Path createPath();
+};}
diff --git a/src/org/atriasoft/esvg/Renderer.cpp b/src/org/atriasoft/esvg/Renderer.cpp
index 7f226ec..d94b216 100644
--- a/src/org/atriasoft/esvg/Renderer.cpp
+++ b/src/org/atriasoft/esvg/Renderer.cpp
@@ -9,26 +9,26 @@
#include
#include
-esvg::Renderer::Renderer(const Vector2i& _size, esvg::Document* _document, bool _visualDebug) :
+esvg::Renderer::Renderer(const Vector2i& _size, esvg::Document* _document, boolean _visualDebug) :
#ifdef DEBUG
- m_visualDebug(_visualDebug),
- m_factor(1),
+ this.visualDebug(_visualDebug),
+ this.factor(1),
#endif
- m_interpolationRecurtionMax(10),
- m_interpolationThreshold(0.25f),
- m_nbSubScanLine(8),
- m_document(_document) {
+ this.interpolationRecurtionMax(10),
+ this.interpolationThreshold(0.25f),
+ this.nbSubScanLine(8),
+ this.document(_document) {
#ifdef DEBUG
- if (m_visualDebug == true) {
- m_factor = 20;
+ if (this.visualDebug == true) {
+ this.factor = 20;
}
#endif
setSize(_size);
}
esvg::Renderer::~Renderer() {
- m_buffer.clear();
- m_size = Vector2i(0,0);
+ this.buffer.clear();
+ this.size = Vector2i(0,0);
}
etk::Color esvg::Renderer::mergeColor(etk::Color _base, etk::Color _integration) {
@@ -59,16 +59,16 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
ememory::SharedPtr& _colorStroke,
float _opacity) {
if (_colorFill != null) {
- //_colorFill->setViewPort(etk::Pair(Vector2f(0,0), Vector2f(sizeX, sizeY)));
- _colorFill->generate(m_document);
+ //_colorFill->setViewPort(Pair(Vector2f(0,0), Vector2f(sizeX, sizeY)));
+ _colorFill->generate(this.document);
}
if (_colorStroke != null) {
- //_colorStroke->setViewPort(etk::Pair(Vector2f(0,0), Vector2f(sizeX, sizeY)));
- _colorStroke->generate(m_document);
+ //_colorStroke->setViewPort(Pair(Vector2f(0,0), Vector2f(sizeX, sizeY)));
+ _colorStroke->generate(this.document);
}
// all together
- for (int32_t yyy=0; yyy intermediateColor = mergeColor(intermediateColorFill, intermediateColorStroke);
intermediateColor.setA(intermediateColor.a() * _opacity);
#if DEBUG
- for (int32_t deltaY=0; deltaYm_viewPort.first),
- esvg::render::Point(Vector2f(tmpColor->m_viewPort.first.x(), tmpColor->m_viewPort.second.y()) ),
+ listSegment.addSegment(esvg::render::Point(tmpColor->this.viewPort.first),
+ esvg::render::Point(Vector2f(tmpColor->this.viewPort.first.x(), tmpColor->this.viewPort.second.y()) ),
false);
- listSegment.addSegment(esvg::render::Point(Vector2f(tmpColor->m_viewPort.first.x(), tmpColor->m_viewPort.second.y()) ),
- esvg::render::Point(tmpColor->m_viewPort.second),
+ listSegment.addSegment(esvg::render::Point(Vector2f(tmpColor->this.viewPort.first.x(), tmpColor->this.viewPort.second.y()) ),
+ esvg::render::Point(tmpColor->this.viewPort.second),
false);
- listSegment.addSegment(esvg::render::Point(tmpColor->m_viewPort.second),
- esvg::render::Point(Vector2f(tmpColor->m_viewPort.second.x(), tmpColor->m_viewPort.first.y()) ),
+ listSegment.addSegment(esvg::render::Point(tmpColor->this.viewPort.second),
+ esvg::render::Point(Vector2f(tmpColor->this.viewPort.second.x(), tmpColor->this.viewPort.first.y()) ),
false);
- listSegment.addSegment(esvg::render::Point(Vector2f(tmpColor->m_viewPort.second.x(), tmpColor->m_viewPort.first.y()) ),
- esvg::render::Point(tmpColor->m_viewPort.first),
+ listSegment.addSegment(esvg::render::Point(Vector2f(tmpColor->this.viewPort.second.x(), tmpColor->this.viewPort.first.y()) ),
+ esvg::render::Point(tmpColor->this.viewPort.first),
false);
- listSegment.applyMatrix(tmpColor->m_matrix);
+ listSegment.applyMatrix(tmpColor->this.matrix);
// display the gradient axis
- listSegment.addSegment(esvg::render::Point(tmpColor->m_pos1),
- esvg::render::Point(tmpColor->m_pos2),
+ listSegment.addSegment(esvg::render::Point(tmpColor->this.pos1),
+ esvg::render::Point(tmpColor->this.pos2),
false);
/*
- mat2x3 m_matrix;
- etk::Pair m_viewPort;
- Vector2f m_pos1;
- Vector2f m_pos2;
+ mat2x3 this.matrix;
+ Pair this.viewPort;
+ Vector2f this.pos1;
+ Vector2f this.pos2;
*/
addDebugSegment(listSegment);
}
@@ -135,17 +135,17 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
#ifdef DEBUG
void esvg::Renderer::addDebugSegment(const esvg::render::SegmentList& _listSegment) {
- if (m_visualDebug == false) {
+ if (this.visualDebug == false) {
return;
}
- Vector2i dynamicSize = m_size * m_factor;
+ Vector2i dynamicSize = this.size * this.factor;
// for each lines:
- for (int32_t yyy=0; yyy availlableSegmentPixel;
- for (auto &it : _listSegment.m_data) {
- if ( it.p0.y() * m_factor <= float(yyy+1)
- && it.p1.y() * m_factor >= float(yyy)) {
+ for (auto &it : _listSegment.this.data) {
+ if ( it.p0.y() * this.factor <= float(yyy+1)
+ && it.p1.y() * this.factor >= float(yyy)) {
availlableSegmentPixel.pushBack(it);
}
}
@@ -154,40 +154,40 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
List availlableSegment;
// find in the subList ...
for (auto &it : availlableSegmentPixel) {
- if ( it.p0.y() * m_factor <= subSamplingCenterPos
- && it.p1.y() * m_factor >= subSamplingCenterPos ) {
+ if ( it.p0.y() * this.factor <= subSamplingCenterPos
+ && it.p1.y() * this.factor >= subSamplingCenterPos ) {
availlableSegment.pushBack(it);
}
}
// x position, angle
- List> listPosition;
+ List> listPosition;
for (auto &it : availlableSegment) {
- Vector2f delta = it.p0 * m_factor - it.p1 * m_factor;
+ Vector2f delta = it.p0 * this.factor - it.p1 * this.factor;
// x = coefficent*y+bbb;
float coefficient = delta.x()/delta.y();
- float bbb = it.p0.x() * m_factor - coefficient*it.p0.y() * m_factor;
+ float bbb = it.p0.x() * this.factor - coefficient*it.p0.y() * this.factor;
float xpos = coefficient * subSamplingCenterPos + bbb;
if ( xpos >= 0
&& xpos < dynamicSize.x()
&& yyy >= 0
&& yyy < dynamicSize.y() ) {
if (it.direction == 1.0f) {
- m_buffer[(dynamicSize.x()*yyy + int32_t(xpos))] = etk::color::blue;
+ this.buffer[(dynamicSize.x()*yyy + int(xpos))] = etk::color::blue;
} else {
- m_buffer[(dynamicSize.x()*yyy + int32_t(xpos))] = etk::color::darkRed;
+ this.buffer[(dynamicSize.x()*yyy + int(xpos))] = etk::color::darkRed;
}
}
}
}
// for each colomn:
- for (int32_t xxx=0; xxx 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) ) ) {
+ for (auto &it : _listSegment.this.data) {
+ if ( ( it.p0.x() * this.factor <= float(xxx+1)
+ && it.p1.x() * this.factor >= float(xxx) )
+ || ( it.p0.x() * this.factor >= float(xxx+1)
+ && it.p1.x() * this.factor <= float(xxx) ) ) {
availlableSegmentPixel.pushBack(it);
}
}
@@ -196,32 +196,32 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
List 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) ) {
+ if ( ( it.p0.x() * this.factor <= subSamplingCenterPos
+ && it.p1.x() * this.factor >= subSamplingCenterPos)
+ || ( it.p0.x() * this.factor >= subSamplingCenterPos
+ && it.p1.x() * this.factor <= subSamplingCenterPos) ) {
availlableSegment.pushBack(it);
}
}
// x position, angle
- List> listPosition;
+ List> listPosition;
for (auto &it : availlableSegment) {
- Vector2f delta = it.p0 * m_factor - it.p1 * m_factor;
+ Vector2f delta = it.p0 * this.factor - it.p1 * this.factor;
// x = coefficent*y+bbb;
if (delta.x() == 0) {
continue;
}
float coefficient = delta.y()/delta.x();
- float bbb = it.p0.y() * m_factor - coefficient*it.p0.x() * m_factor;
+ float bbb = it.p0.y() * this.factor - coefficient*it.p0.x() * this.factor;
float ypos = coefficient * subSamplingCenterPos + bbb;
if ( ypos >= 0
&& ypos < dynamicSize.y()
&& xxx >= 0
&& xxx < dynamicSize.y() ) {
if (it.direction == 1.0f) {
- m_buffer[(dynamicSize.x()*int32_t(ypos) + xxx)] = etk::color::blue;
+ this.buffer[(dynamicSize.x()*int(ypos) + xxx)] = etk::color::blue;
} else {
- m_buffer[(dynamicSize.x()*int32_t(ypos) + xxx)] = etk::color::darkRed;
+ this.buffer[(dynamicSize.x()*int(ypos) + xxx)] = etk::color::darkRed;
}
}
}
@@ -231,7 +231,7 @@ void esvg::Renderer::print(const esvg::render::Weight& _weightFill,
void esvg::Renderer::writePPM(const etk::Uri& _uri) {
- if (m_buffer.size() == 0) {
+ if (this.buffer.size() == 0) {
return;
}
auto fileIo = etk::uri::get(_uri);
@@ -243,18 +243,18 @@ void esvg::Renderer::writePPM(const etk::Uri& _uri) {
Log.error("Can not open (r) the file : " << _uri);
return;
}
- int32_t sizeX = m_size.x();
- int32_t sizeY = m_size.y();
+ int sizeX = this.size.x();
+ int sizeY = this.size.y();
#if DEBUG
- sizeX *= m_factor;
- sizeY *= m_factor;
+ sizeX *= this.factor;
+ sizeY *= this.factor;
#endif
- Log.debug("Generate ppm : " << m_size << " debug size=" << Vector2i(sizeX,sizeY));
+ Log.debug("Generate ppm : " << this.size << " debug size=" << Vector2i(sizeX,sizeY));
char tmpValue[1024];
sprintf(tmpValue, "P6 %d %d 255 ", sizeX, sizeY);
fileIo->write(tmpValue,1,sizeof(tmpValue));
- for (int32_t iii=0 ; iii tmp = m_buffer[iii];
+ for (int iii=0 ; iii tmp = this.buffer[iii];
fileIo->write(&tmp, 1, 3);
}
fileIo->close();
@@ -264,39 +264,39 @@ extern "C" {
#pragma pack(push,1)
struct bitmapFileHeader {
int16_t bfType;
- int32_t bfSize;
- int32_t bfReserved;
- int32_t bfOffBits;
+ int bfSize;
+ int bfReserved;
+ int bfOffBits;
};
struct bitmapInfoHeader {
- int32_t biSize;
- int32_t biWidth;
- int32_t biHeight;
+ int biSize;
+ int biWidth;
+ int biHeight;
int16_t biPlanes;
int16_t biBitCount;
- int32_t biCompression;
- int32_t biSizeImage;
- int32_t biXPelsPerMeter;
- int32_t biYPelsPerMeter;
+ int biCompression;
+ int biSizeImage;
+ int biXPelsPerMeter;
+ int biYPelsPerMeter;
#ifndef PLOPPP
- int32_t biClrUsed;
- int32_t biClrImportant;
+ int biClrUsed;
+ int biClrImportant;
#else
// https://en.wikipedia.org/wiki/BMP_file_format / example 2
- int32_t biPaletteNumber;
- int32_t biImportantColor;
- int32_t biBitMaskRed;
- int32_t biBitMaskGreen;
- int32_t biBitMaskBlue;
- int32_t biBitMaskAlpha;
- int32_t biLCSColorSpace;
- int32_t biUnused[16];
+ int biPaletteNumber;
+ int biImportantColor;
+ int biBitMaskRed;
+ int biBitMaskGreen;
+ int biBitMaskBlue;
+ int biBitMaskAlpha;
+ int biLCSColorSpace;
+ int biUnused[16];
#endif
};
#pragma pack(pop)
}
void esvg::Renderer::writeBMP(const etk::Uri& _uri) {
- if (m_buffer.size() == 0) {
+ if (this.buffer.size() == 0) {
return;
}
auto fileIo = etk::uri::get(_uri);
@@ -311,11 +311,11 @@ void esvg::Renderer::writeBMP(const etk::Uri& _uri) {
struct bitmapFileHeader fileHeader;
struct bitmapInfoHeader infoHeader;
- int32_t sizeX = m_size.x();
- int32_t sizeY = m_size.y();
+ int sizeX = this.size.x();
+ int sizeY = this.size.y();
#if DEBUG
- sizeX *= m_factor;
- sizeY *= m_factor;
+ sizeX *= this.factor;
+ sizeY *= this.factor;
#endif
fileHeader.bfType = 0x4D42;
@@ -348,7 +348,7 @@ void esvg::Renderer::writeBMP(const etk::Uri& _uri) {
infoHeader.biBitMaskBlue =0x0000FF00;
infoHeader.biBitMaskAlpha = 0x000000FF;
infoHeader.biLCSColorSpace = 0x73524742; // "Win "
- for (int32_t jjj=0; jjj<16; ++jjj) {
+ for (int jjj=0; jjj<16; ++jjj) {
infoHeader.biUnused[jjj] = 0;
}
infoHeader.biUnused[12] = 0x00000002;
@@ -358,9 +358,9 @@ void esvg::Renderer::writeBMP(const etk::Uri& _uri) {
fileIo->write(&infoHeader, sizeof(struct bitmapInfoHeader), 1);
uint8_t data[16];
- for(int32_t yyy=sizeY-1; yyy>=0; --yyy) {
- for(int32_t xxx=0; xxx& tmpColor = m_buffer[sizeX*yyy + xxx];
+ for(int yyy=sizeY-1; yyy>=0; --yyy) {
+ for(int xxx=0; xxx& tmpColor = this.buffer[sizeX*yyy + xxx];
uint8_t* pointer = data;
#ifndef PLOPPP
*pointer++ = tmpColor.a();
@@ -381,47 +381,47 @@ void esvg::Renderer::writeBMP(const etk::Uri& _uri) {
void esvg::Renderer::setSize(const Vector2i& _size) {
- m_size = _size;
- m_buffer.resize(m_size.x() * m_size.y()
+ this.size = _size;
+ this.buffer.resize(this.size.x() * this.size.y()
#if DEBUG
- * m_factor * m_factor
+ * this.factor * this.factor
#endif
, etk::color::none);
}
const Vector2i& esvg::Renderer::getSize() const {
- return m_size;
+ return this.size;
}
List> esvg::Renderer::getData() {
- return m_buffer;
+ return this.buffer;
}
-void esvg::Renderer::setInterpolationRecurtionMax(int32_t _value) {
- m_interpolationRecurtionMax = etk::avg(1, _value, 200);
+void esvg::Renderer::setInterpolationRecurtionMax(int _value) {
+ this.interpolationRecurtionMax = etk::avg(1, _value, 200);
}
-int32_t esvg::Renderer::getInterpolationRecurtionMax() const {
- return m_interpolationRecurtionMax;
+int esvg::Renderer::getInterpolationRecurtionMax() const {
+ return this.interpolationRecurtionMax;
}
void esvg::Renderer::setInterpolationThreshold(float _value) {
- m_interpolationThreshold = etk::avg(0.0f, _value, 20000.0f);
+ this.interpolationThreshold = etk::avg(0.0f, _value, 20000.0f);
}
float esvg::Renderer::getInterpolationThreshold() const {
- return m_interpolationThreshold;
+ return this.interpolationThreshold;
}
-void esvg::Renderer::setNumberSubScanLine(int32_t _value) {
- m_nbSubScanLine = etk::avg(1, _value, 200);
+void esvg::Renderer::setNumberSubScanLine(int _value) {
+ this.nbSubScanLine = etk::avg(1, _value, 200);
}
-int32_t esvg::Renderer::getNumberSubScanLine() const {
- return m_nbSubScanLine;
+int esvg::Renderer::getNumberSubScanLine() const {
+ return this.nbSubScanLine;
}
diff --git a/src/org/atriasoft/esvg/Renderer.java b/src/org/atriasoft/esvg/Renderer.java
index aa84ec1..fca48dc 100644
--- a/src/org/atriasoft/esvg/Renderer.java
+++ b/src/org/atriasoft/esvg/Renderer.java
@@ -1,3 +1,4 @@
+package org.atriasoft.esvg;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -5,69 +6,78 @@
*/
#pragma once
-#include
-#include
-#include
-#include
-#include
-#include
+#include#include