[DEV] set stroke size in the all element
This commit is contained in:
parent
fec137abfb
commit
3ddc118c4c
@ -112,7 +112,7 @@ void esvg::Circle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -117,7 +117,7 @@ void esvg::Ellipse::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -85,7 +85,7 @@ void esvg::Line::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -277,7 +277,7 @@ void esvg::Path::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t _l
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(), _myRenderer.getNumberSubScanLine(), listSegmentStroke);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ void esvg::Polygon::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_t
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -85,11 +85,17 @@ void esvg::Polyline::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32_
|
||||
esvg::render::Weight tmpFill;
|
||||
esvg::render::Weight tmpStroke;
|
||||
// Check if we need to display background
|
||||
// No background ...
|
||||
if (m_paint.fill.a() != 0x00) {
|
||||
listSegmentFill.createSegmentList(listPoints);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpFill.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
listSegmentFill);
|
||||
}
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -112,7 +112,7 @@ void esvg::Rectangle::draw(esvg::Renderer& _myRenderer, mat2& _basicTrans, int32
|
||||
// check if we need to display stroke:
|
||||
if ( m_paint.strokeWidth > 0
|
||||
&& m_paint.stroke.a() != 0x00) {
|
||||
listSegmentStroke.createSegmentListStroke(listPoints);
|
||||
listSegmentStroke.createSegmentListStroke(listPoints, m_paint.strokeWidth);
|
||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||
tmpStroke.generate(_myRenderer.getSize(),
|
||||
_myRenderer.getNumberSubScanLine(),
|
||||
|
@ -43,7 +43,7 @@ void esvg::render::SegmentList::createSegmentList(const esvg::render::PointList&
|
||||
std::sort(m_data.begin(), m_data.end(), sortSegmentFunction);
|
||||
}
|
||||
|
||||
void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& _listPoint) {
|
||||
void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& _listPoint, float _width) {
|
||||
for (auto &itListPoint : _listPoint.m_data) {
|
||||
// generate for every point all the orthogonal elements
|
||||
//
|
||||
@ -110,7 +110,6 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
SVG_TODO("lklklklklkl");
|
||||
}
|
||||
}
|
||||
float lineWidth = 5.0f;
|
||||
// create segment list:
|
||||
bool haveStartLine;
|
||||
vec2 leftPoint;
|
||||
@ -121,9 +120,9 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
if ( itListPoint.back().m_type == esvg::render::Point::type_join
|
||||
|| itListPoint.back().m_type == esvg::render::Point::type_interpolation) {
|
||||
leftPoint = itListPoint.back().m_pos
|
||||
+ itListPoint.back().m_miterAxe*lineWidth*0.5f;
|
||||
+ itListPoint.back().m_miterAxe*_width*0.5f;
|
||||
rightPoint = itListPoint.back().m_pos
|
||||
- itListPoint.back().m_miterAxe*lineWidth*0.5f;
|
||||
- itListPoint.back().m_miterAxe*_width*0.5f;
|
||||
} else {
|
||||
SVG_ERROR("Start list point with a join, but last lement is not a join");
|
||||
}
|
||||
@ -146,9 +145,9 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
haveStartLine = true;
|
||||
// TODO : Calculate intersection ... (now we do a simple fast test of path display ...)
|
||||
leftPoint = it.m_pos
|
||||
+ it.m_miterAxe*lineWidth*0.5f;
|
||||
+ it.m_miterAxe*_width*0.5f;
|
||||
rightPoint = it.m_pos
|
||||
- it.m_miterAxe*lineWidth*0.5f;
|
||||
- it.m_miterAxe*_width*0.5f;
|
||||
addSegment(leftPoint, rightPoint);
|
||||
SVG_VERBOSE(" segment :" << leftPoint << " -> " << rightPoint);
|
||||
}
|
||||
@ -163,9 +162,9 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
haveStartLine = false;
|
||||
// TODO : Calculate intersection ... (now we do a simple fast test of path display ...)
|
||||
vec2 left = it.m_pos
|
||||
+ it.m_miterAxe*lineWidth*0.5f;
|
||||
+ it.m_miterAxe*_width*0.5f;
|
||||
vec2 right = it.m_pos
|
||||
- it.m_miterAxe*lineWidth*0.5f;
|
||||
- it.m_miterAxe*_width*0.5f;
|
||||
//Draw from previous point:
|
||||
addSegment(leftPoint, left);
|
||||
SVG_VERBOSE(" segment :" << leftPoint << " -> " << left);
|
||||
@ -183,9 +182,9 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
SVG_VERBOSE("Find interpolation " << it.m_pos);
|
||||
// TODO : Calculate intersection ... (now we do a simple fast test of path display ...)
|
||||
vec2 left = it.m_pos
|
||||
+ it.m_miterAxe*lineWidth*0.5f;
|
||||
+ it.m_miterAxe*_width*0.5f;
|
||||
vec2 right = it.m_pos
|
||||
- it.m_miterAxe*lineWidth*0.5f;
|
||||
- it.m_miterAxe*_width*0.5f;
|
||||
//Draw from previous point:
|
||||
addSegment(leftPoint, left);
|
||||
SVG_VERBOSE(" segment :" << leftPoint << " -> " << left);
|
||||
@ -200,9 +199,9 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
|
||||
SVG_VERBOSE("Find Join " << it.m_pos);
|
||||
// TODO : Calculate intersection ... (now we do a simple fast test of path display ...)
|
||||
vec2 left = it.m_pos
|
||||
+ it.m_miterAxe*lineWidth*0.5f;
|
||||
+ it.m_miterAxe*_width*0.5f;
|
||||
vec2 right = it.m_pos
|
||||
- it.m_miterAxe*lineWidth*0.5f;
|
||||
- it.m_miterAxe*_width*0.5f;
|
||||
//Draw from previous point:
|
||||
addSegment(leftPoint, left);
|
||||
SVG_VERBOSE(" segment :" << leftPoint << " -> " << left);
|
||||
|
@ -23,7 +23,7 @@ namespace esvg {
|
||||
SegmentList();
|
||||
void addSegment(const esvg::render::Point& _pos0, const esvg::render::Point& _pos1);
|
||||
void createSegmentList(const esvg::render::PointList& _listPoint);
|
||||
void createSegmentListStroke(esvg::render::PointList& _listPoint);
|
||||
void createSegmentListStroke(esvg::render::PointList& _listPoint, float _width);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user