[DEV] update the position of scaling and rotate
This commit is contained in:
parent
c1358b6d1b
commit
b1a2dec4d9
@ -21,7 +21,7 @@ addons:
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9"
|
||||
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9" GCOV=--gcov
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||
@ -41,7 +41,6 @@ matrix:
|
||||
|
||||
|
||||
install:
|
||||
- printenv
|
||||
- cd ..
|
||||
- pip install --user lutin
|
||||
- if [ "$TAG" == "Android" ]; then
|
||||
@ -53,8 +52,8 @@ install:
|
||||
|
||||
before_script:
|
||||
- cd ..
|
||||
- git clone https://github.com/atria-soft/etk.git
|
||||
- git clone https://github.com/atria-soft/exml.git
|
||||
- git clone https://github.com/atria-soft/etk.git -b $TRAVIS_BRANCH
|
||||
- git clone https://github.com/atria-soft/exml.git -b $TRAVIS_BRANCH
|
||||
- git clone https://github.com/generic-library/gtest-lutin.git --recursive
|
||||
- git clone https://github.com/generic-library/z-lutin.git --recursive
|
||||
- pwd
|
||||
@ -75,7 +74,7 @@ after_script:
|
||||
- ./out/Linux_x86_64/$CONF/staging/$BUILDER/esvg-test/esvg-test.app/bin/esvg-test --etk-log-level=6 | tee out_test.txt
|
||||
- if [ "$GCOV" != "" ]; then
|
||||
./ci/test_send.py --file=out_test.txt;
|
||||
lutin -C -P $TARGET -c $BUILDER $COMPILATOR_OPTION -m $CONF -p esvg?gcov;
|
||||
lutin -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF -p esvg?gcov;
|
||||
./ci/coverage_send.py --json=out/Linux_x86_64/$CONF/build/$BUILDER/esvg/esvg_coverage.json;
|
||||
fi
|
||||
|
||||
|
@ -50,6 +50,7 @@ download the software:
|
||||
cd WORKING_DIRECTORY
|
||||
git clone https://github.com/atria-soft/etk.git
|
||||
git clone https://github.com/atria-soft/exml.git
|
||||
git clone https://github.com/atria-soft/esvg.git
|
||||
git clone https://github.com/generic-library/gtest-lutin.git --recursive
|
||||
git clone https://github.com/generic-library/z-lutin.git --recursive
|
||||
|
||||
|
@ -97,7 +97,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -105,6 +105,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
@ -118,6 +119,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -102,7 +102,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -110,6 +110,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
@ -123,6 +124,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -101,8 +101,8 @@ bool esvg::Group::parseXML(const std::shared_ptr<exml::Element>& _element, mat2&
|
||||
|
||||
void esvg::Group::display(int32_t _spacing) {
|
||||
SVG_DEBUG(spacingDist(_spacing) << "Group (START) fill=" << m_paint.fill << " stroke=" << m_paint.stroke << " stroke-width=" << m_paint.strokeWidth );
|
||||
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
|
||||
if (NULL != m_subElementList[iii]) {
|
||||
for (size_t iii=0; iii<m_subElementList.size(); ++iii) {
|
||||
if (m_subElementList[iii] != nullptr) {
|
||||
m_subElementList[iii]->display(_spacing+1);
|
||||
}
|
||||
}
|
||||
@ -111,8 +111,8 @@ void esvg::Group::display(int32_t _spacing) {
|
||||
|
||||
void esvg::Group::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _level) {
|
||||
SVG_VERBOSE(spacingDist(_level) << "DRAW esvg::group");
|
||||
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
|
||||
if (NULL != m_subElementList[iii]) {
|
||||
for (size_t iii=0; iii<m_subElementList.size(); ++iii) {
|
||||
if (m_subElementList[iii] != nullptr) {
|
||||
m_subElementList[iii]->draw(_myRenderer, _basicTrans, _level+1);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +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);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -91,6 +91,7 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -266,7 +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);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -274,6 +274,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(), _myRenderer.getNumberSubScanLine(), listSegmentFill);
|
||||
}
|
||||
@ -285,6 +286,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(), _myRenderer.getNumberSubScanLine(), listSegmentStroke);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -91,6 +91,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
@ -104,6 +105,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -80,7 +80,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -88,6 +88,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
@ -101,6 +102,7 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -97,7 +97,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
|
||||
listPoints = listElement.generateListPoints(_level,
|
||||
_myRenderer.getInterpolationRecurtionMax(),
|
||||
_myRenderer.getInterpolationThreshold());
|
||||
listPoints.applyMatrix(mtx);
|
||||
//listPoints.applyMatrix(mtx);
|
||||
esvg::render::SegmentList listSegmentFill;
|
||||
esvg::render::SegmentList listSegmentStroke;
|
||||
esvg::render::Weight tmpFill;
|
||||
@ -105,6 +105,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
|
||||
// Check if we need to display background
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
listSegmentFill.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
@ -118,6 +119,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
|
||||
m_paint.lineCap,
|
||||
m_paint.lineJoin,
|
||||
m_paint.miterLimit);
|
||||
listSegmentStroke.applyMatrix(mtx);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -14,15 +14,25 @@
|
||||
|
||||
esvg::render::Segment::Segment(const vec2& _p0, const vec2& _p1) {
|
||||
// segment register all time the lower at P0n then we need to register the sens of the path
|
||||
if (_p0.y() < _p1.y()) {
|
||||
p0 = _p0;
|
||||
p1 = _p1;
|
||||
p0 = _p0;
|
||||
p1 = _p1;
|
||||
direction = 0;
|
||||
}
|
||||
|
||||
void esvg::render::Segment::applyMatrix(const mat2& _transformationMatrix) {
|
||||
p0 = _transformationMatrix * p0;
|
||||
p1 = _transformationMatrix * p1;
|
||||
createDirection();
|
||||
}
|
||||
|
||||
void esvg::render::Segment::createDirection() {
|
||||
if (p0.y() < p1.y()) {
|
||||
direction = 1; // direction like clock
|
||||
} else {
|
||||
p0 = _p1;
|
||||
p1 = _p0;
|
||||
vec2 tmp(p0);
|
||||
p0 = p1;
|
||||
p1 = tmp;
|
||||
direction = -1; // direction like anti-clock
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Matrix2.h>
|
||||
|
||||
namespace esvg {
|
||||
namespace render {
|
||||
@ -20,6 +21,8 @@ namespace esvg {
|
||||
vec2 p0;
|
||||
vec2 p1;
|
||||
int32_t direction;
|
||||
void applyMatrix(const mat2& _transformationMatrix);
|
||||
void createDirection();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -440,3 +440,9 @@ void esvg::render::SegmentList::startStopPoint(vec2& _leftPoint,
|
||||
}
|
||||
}
|
||||
|
||||
void esvg::render::SegmentList::applyMatrix(const mat2& _transformationMatrix) {
|
||||
for (auto &it : m_data) {
|
||||
it.applyMatrix(_transformationMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,8 @@ namespace esvg {
|
||||
const vec2& _center,
|
||||
float _width,
|
||||
bool _isStart);
|
||||
public:
|
||||
void applyMatrix(const mat2& _transformationMatrix);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user