[DEV] start think of the rescaling ...
This commit is contained in:
parent
4496e42c22
commit
83c8b7ed39
@ -97,6 +97,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -102,6 +102,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -76,6 +76,7 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -266,6 +266,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
listPoints = m_listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -83,6 +83,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -80,6 +80,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
@ -97,6 +97,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
|
19
esvg/esvg.h
19
esvg/esvg.h
@ -15,7 +15,6 @@
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
#include <esvg/Base.h>
|
||||
//#include <draw/Image.h>
|
||||
|
||||
namespace esvg {
|
||||
class Document : public esvg::Base {
|
||||
@ -24,7 +23,7 @@ namespace esvg {
|
||||
bool m_loadOK;
|
||||
std::string m_version;
|
||||
std::string m_title;
|
||||
std::vector<esvg::Base*> m_subElementList;
|
||||
std::vector<esvg::Base*> m_subElementList; // TODO: LEAK ...
|
||||
vec2 m_size;
|
||||
public:
|
||||
Document();
|
||||
@ -59,18 +58,28 @@ namespace esvg {
|
||||
*/
|
||||
bool store(const std::string& _file);
|
||||
protected:
|
||||
bool parseXMLData(const std::shared_ptr<exml::Element>& _root);
|
||||
virtual bool parseXMLData(const std::shared_ptr<exml::Element>& _root);
|
||||
public:
|
||||
bool isLoadOk() {
|
||||
return m_loadOK;
|
||||
};
|
||||
/**
|
||||
* @brief Display all the node in the svg file.
|
||||
*/
|
||||
void displayDebug();
|
||||
// TODO: remove this fucntion : use generic function ...
|
||||
void generateAnImage(const ivec2& _size, const std::string& _fileName, bool _visualDebug=false);
|
||||
//void generateAnImage(ivec2 _size, draw::Image& _output);
|
||||
//void generateAnImage(draw::Image& _output);
|
||||
/**
|
||||
* @brief Generate Image in a specific format.
|
||||
* @param[in,out] _size Size expected of the rendered image (value <=0 if it need to be automatic.) return the size generate
|
||||
* @return Vector of the data used to display (simple vector: generic to transmit)
|
||||
*/
|
||||
std::vector<etk::Color<float,4>> renderImageFloatRGBA(ivec2& _size);
|
||||
//! @previous
|
||||
std::vector<etk::Color<float,3>> renderImageFloatRGB(ivec2& _size);
|
||||
//! @previous
|
||||
std::vector<etk::Color<uint8_t,4>> renderImageU8RGBA(ivec2& _size);
|
||||
//! @previous
|
||||
std::vector<etk::Color<uint8_t,3>> renderImageU8RGB(ivec2& _size);
|
||||
protected:
|
||||
virtual void draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level=0);
|
||||
|
@ -25,6 +25,7 @@ namespace esvg {
|
||||
type_interpolation, //!< This point is dynamicly calculated to create an interpolation
|
||||
};
|
||||
public:
|
||||
// TODO : Clean all element here ...
|
||||
vec2 m_pos; //!< position of the point
|
||||
enum esvg::render::Point::type m_type;
|
||||
vec2 m_miterAxe;
|
||||
|
@ -18,6 +18,14 @@ void esvg::render::PointList::addList(std::vector<esvg::render::Point>& _list) {
|
||||
// TODO : Add a checker of correct list ...
|
||||
}
|
||||
|
||||
void esvg::render::PointList::applyMatrix(const mat2& _transformationMatrix) {
|
||||
for (auto &it : m_data) {
|
||||
for (auto &val : it) {
|
||||
val.m_pos = _transformationMatrix * val.m_pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void esvg::render::PointList::display() {
|
||||
SVG_VERBOSE(" Display list of points : size=" << m_data.size());
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Matrix2.h>
|
||||
#include <esvg/render/Element.h>
|
||||
#include <esvg/render/Point.h>
|
||||
|
||||
@ -23,6 +24,7 @@ namespace esvg {
|
||||
PointList();
|
||||
void addList(std::vector<esvg::render::Point>& _list);
|
||||
void display();
|
||||
void applyMatrix(const mat2& _transformationMatrix);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user