Draw: DDARasterizer FatLine fixed/improved

git-svn-id: svn://ultimatepp.org/upp/trunk@6073 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-05-15 21:44:01 +00:00
parent 236ccbfa7c
commit efd09c8218
6 changed files with 34 additions and 33 deletions

View file

@ -109,13 +109,15 @@ struct DDARasterizer::Segments : DDARasterizer {
void DDARasterizer::FatLine(Point p2)
{
Point v = p2 - p1;
Pointf shift = (double)width * Orthogonal(Pointf(v) / Length((Pointf(v))));
Point p = Pointf(p1) + shift / 2.0;
if(p1 == p2)
return;
Point pp = p0;
p0 = p1; // avoid Close
Polygon();
Point v = p2 - p1;
Point shift = (width - 0.5) * Orthogonal(Pointf(v) / Length((Pointf(v))));
Point p = p1 + shift / 2;
Point bj2 = j2;
Polygon();
if(!IsNull(j1)) {
Move(j1);
Line(p);
@ -125,14 +127,14 @@ void DDARasterizer::FatLine(Point p2)
if(IsNull(b1))
b1 = p;
Line(p += v);
// if(close && !IsNull(b1))
// Line(b1);
j1 = p;
if(close && !IsNull(b1)) {
Line(b1);
Line(b2);
}
Line(p -= shift);
// if(close && !IsNull(b2))
// Line(b2);
j2 = p;
Line(p - v);
Line(p -= v);
if(!IsNull(bj2))
Line(bj2);
if(IsNull(b2))
@ -176,7 +178,8 @@ DDARasterizer& DDARasterizer::Close()
close = true;
Line(p0);
close = false;
b1 = b2 = Null;
if(!pseg)
b1 = b2 = Null;
}
return *this;
}

View file

@ -4,7 +4,7 @@ class DDARasterizer {
int h;
bool flag;
bool operator<(const Segment& b) const { return l < b.l; }
bool operator<(const Segment& b) const { return h < b.h; }
};
struct Segments;
@ -40,7 +40,7 @@ public:
DDARasterizer& Ellipse(const Rect& rect);
DDARasterizer& Width(int width_) { width = width_; return *this; }
DDARasterizer& Width(int width_) { width = width_; return *this; }
void Cy(int cy_) { cy = cy_; }

View file

@ -73,8 +73,8 @@ ygon]()&]
[s3; &]
[s4; &]
[s5;:DDARasterizer`:`:Width`(int`):%- [_^DDARasterizer^ DDARasterizer][@(0.0.255) `&]_[* Wi
dth]([@(0.0.255) int]_[*@3 width`_])&]
[s2; [%-*@3 width`_] .&]
dth]([@(0.0.255) int]_[*@3 width])&]
[s2; Sets the line thickness to [%-*@3 width] .&]
[s3; &]
[s4; &]
[s5;:DDARasterizer`:`:Cy`(int`):%- [@(0.0.255) void]_[* Cy]([@(0.0.255) int]_[*@3 cy])&]

View file

@ -54,10 +54,8 @@ void IconDraw::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor
}
if(!IsNull(pen) && !IsNull(pencolor)) {
docolor = pencolor;
if(pen == 1)
Ellipse(r);
else
Polygon().Ellipse(r).Ellipse(r.Deflated(pen - 1)).Fill();
Width(pen);
Ellipse(r);
}
}

View file

@ -69,19 +69,19 @@ IMAGE_DATA(143,72,182,240,209,6,235,149,255,0,26,103,43,124,0,0,0,0,0,0,0,0,0,0,
IMAGE_END_DATA(1344, 16)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,152,81,78,195,48,12,134,115,1,164,189,33,113,35,196,1,118,21,30,119,160,137,3,245,6,32,241,2,143)
IMAGE_DATA(60,24,82,72,227,56,118,108,39,237,232,164,121,250,213,108,205,103,59,110,234,86,11,135,112,8,27,24,24,212,228,91)
IMAGE_DATA(102,240,161,242,200,207,72,124,201,71,147,103,124,177,124,8,167,234,152,100,229,235,249,121,236,141,239,229,215,88,255,249)
IMAGE_DATA(252,202,230,97,229,143,199,247,33,158,30,61,245,31,89,191,83,235,216,173,25,12,197,223,244,102,152,207,159,218,227,22)
IMAGE_DATA(175,177,151,228,71,243,239,225,139,121,29,249,91,76,226,157,218,135,253,83,51,80,121,165,248,221,205,36,157,83,124,88)
IMAGE_DATA(226,119,55,19,101,35,45,60,247,36,195,191,111,205,151,115,185,183,132,253,243,18,235,225,37,107,241,14,237,199,98,51)
IMAGE_DATA(128,125,165,68,109,232,13,163,249,81,26,2,51,215,19,223,19,203,150,187,207,71,207,154,47,227,99,180,22,90,221,57)
IMAGE_DATA(245,94,119,127,238,215,115,243,83,195,205,0,238,239,32,10,159,127,123,4,136,74,223,225,243,1,162,24,87,160,241,45)
IMAGE_DATA(54,212,5,155,199,127,236,194,179,236,199,75,197,225,238,141,186,56,229,127,217,204,67,139,39,79,131,204,34,30,199,106)
IMAGE_DATA(240,37,199,196,23,57,46,103,52,158,166,105,22,245,85,252,110,224,37,105,249,167,121,95,63,55,14,22,225,197,250,37)
IMAGE_DATA(54,142,19,155,198,220,186,36,158,83,181,126,37,62,150,24,95,168,179,97,253,146,177,215,65,216,191,170,31,23,71,222)
IMAGE_DATA(12,212,197,42,142,227,182,133,167,103,200,199,16,10,105,124,100,176,28,175,102,171,196,39,243,188,181,40,242,204,107,40)
IMAGE_DATA(115,74,98,121,20,159,99,240,119,142,199,162,44,245,161,213,130,196,233,168,69,142,195,93,75,229,186,46,185,150,181,180)
IMAGE_DATA(243,88,173,61,101,217,87,5,79,246,148,103,95,115,172,149,151,88,11,111,210,70,255,25,172,97,158,46,88,177,0,106)
IMAGE_DATA(129,154,108,146,211,71,193,174,225,195,201,22,62,58,217,197,199,0,123,179,43,180,111,11,3,169,236,0,0,0,0,0)
IMAGE_DATA(120,156,237,152,81,78,195,48,12,134,115,1,164,189,33,113,35,196,1,118,21,222,216,129,38,14,180,27,128,196,11,60)
IMAGE_DATA(242,96,72,71,26,199,177,99,59,105,71,39,205,211,175,102,107,62,219,113,83,183,90,216,133,93,88,193,192,160,38,223)
IMAGE_DATA(50,131,15,149,71,126,70,226,75,62,154,60,227,139,229,67,56,84,199,36,43,95,207,207,99,111,124,47,191,196,250,143)
IMAGE_DATA(199,55,54,15,43,191,223,127,12,241,244,232,169,255,200,250,157,90,198,110,205,96,40,254,170,55,195,116,254,208,30,183)
IMAGE_DATA(120,141,189,36,63,154,127,15,95,204,235,200,223,98,18,239,212,54,236,159,154,129,202,43,197,239,110,38,233,156,226,195)
IMAGE_DATA(18,191,187,153,40,27,105,230,185,39,25,254,125,109,190,156,203,189,37,108,159,151,88,15,47,89,139,119,104,59,22,155)
IMAGE_DATA(1,108,43,37,106,67,111,24,205,143,210,16,152,185,158,248,158,88,182,220,125,62,122,214,124,25,31,163,181,208,234,206)
IMAGE_DATA(169,247,186,251,115,191,158,155,159,218,212,12,94,206,99,184,191,131,40,124,254,253,17,32,42,125,135,175,7,136,98,92)
IMAGE_DATA(129,198,183,216,80,23,108,26,255,177,51,207,178,159,175,21,135,187,55,234,226,148,63,179,153,135,22,79,158,6,153,69)
IMAGE_DATA(60,142,213,224,75,142,137,47,114,92,206,104,124,58,157,38,81,95,197,239,6,94,146,150,127,154,247,253,123,227,96,17)
IMAGE_DATA(94,172,95,98,227,56,177,105,204,173,75,226,57,85,235,87,226,99,137,241,133,58,27,214,47,25,123,29,132,253,171,250)
IMAGE_DATA(113,113,228,205,64,93,172,226,56,110,91,120,122,134,124,12,161,144,198,71,6,203,241,106,182,72,124,50,207,91,139,34)
IMAGE_DATA(207,188,134,50,167,36,150,71,241,57,6,127,231,120,44,202,82,31,90,45,72,156,142,90,228,56,220,181,84,174,235,156)
IMAGE_DATA(107,89,75,59,143,213,218,83,150,125,85,240,100,79,121,246,53,199,90,121,137,181,240,38,173,244,159,193,18,230,233,130)
IMAGE_DATA(21,11,160,22,168,201,38,57,125,20,236,18,62,156,108,225,163,147,157,125,12,176,55,187,66,251,1,250,26,169,108,0)
IMAGE_END_DATA(480, 7)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After