.developing SVG parser

git-svn-id: svn://ultimatepp.org/upp/trunk@7978 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-12-15 18:40:16 +00:00
parent 8b287b4d9b
commit f9de394bf5
5 changed files with 54 additions and 4 deletions

View file

@ -224,6 +224,8 @@ protected:
virtual void FillOp(const Pointf& p1, const RGBA& color1,
const Pointf& p2, const RGBA& color2,
int style);
virtual void FillOp(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc,
int style);
virtual void FillOp(const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style);
@ -234,6 +236,9 @@ protected:
virtual void StrokeOp(double width, const Pointf& p1, const RGBA& color1,
const Pointf& p2, const RGBA& color2,
int style);
virtual void StrokeOp(double width, const RGBA& color1, const RGBA& color2,
const Xform2D& transsrc,
int style);
virtual void StrokeOp(double width, const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style);

View file

@ -48,7 +48,16 @@ void BufferPainter::FillOp(const Pointf& p1, const RGBA& color1, const Pointf& p
{
Gradient(color1, color2, p1, p2);
Fill(gradient, p1, p2,
FILL_VPAD | FILL_FAST |
FILL_VPAD |
(style == GRADIENT_PAD ? FILL_HPAD : style == GRADIENT_REPEAT
? FILL_HREPEAT : FILL_HREFLECT));
}
void BufferPainter::FillOp(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, int style)
{
MakeGradient(color1, color2, 500);
Fill(gradient, transsrc * Xform2D::Scale(1.0 / 500),
FILL_VPAD |
(style == GRADIENT_PAD ? FILL_HPAD : style == GRADIENT_REPEAT
? FILL_HREPEAT : FILL_HREFLECT));
}
@ -57,7 +66,16 @@ void BufferPainter::StrokeOp(double width, const Pointf& p1, const RGBA& color1,
{
Gradient(color1, color2, p1, p2);
Stroke(width, gradient, p1, p2,
FILL_VPAD | FILL_FAST |
FILL_VPAD |
(style == GRADIENT_PAD ? FILL_HPAD : style == GRADIENT_REPEAT
? FILL_HREPEAT : FILL_HREFLECT));
}
void BufferPainter::StrokeOp(double width, const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, int style)
{
MakeGradient(color1, color2, 500);
Stroke(width, gradient, transsrc * Xform2D::Scale(1.0 / 500),
FILL_VPAD |
(style == GRADIENT_PAD ? FILL_HPAD : style == GRADIENT_REPEAT
? FILL_HREPEAT : FILL_HREFLECT));
}

View file

@ -31,8 +31,8 @@ int LinearInterpolator::Dda2::Get()
void LinearInterpolator::Begin(int x, int y, int len)
{
Pointf p1 = xform.Transform(Pointf(x, y)/* + 0.5*/);
Pointf p2 = xform.Transform(Pointf(x + len, y)/* + 0.5*/);
Pointf p1 = xform.Transform(Pointf(x, y));
Pointf p2 = xform.Transform(Pointf(x + len, y));
ddax.Set(Q8(p1.x), Q8(p2.x), len);
dday.Set(Q8(p1.y), Q8(p2.y), len);
}

View file

@ -362,6 +362,12 @@ Painter& Painter::Fill(double x1, double y1, const RGBA& color1, double x2, doub
return Fill(Pointf(x1, y1), color1, Pointf(x2, y2), color2, style);
}
Painter& Painter::Fill(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, dword flags)
{
FillOp(color1, color2, transsrc, flags);
return *this;
}
Painter& Painter::Fill(double fx, double fy, const RGBA& color1, double cx, double cy, double r, const RGBA& color2, int style)
{
return Fill(Pointf(fx, fy), color1, Pointf(cx, cy), r, color2, style);
@ -403,6 +409,12 @@ Painter& Painter::Stroke(double width, double x1, double y1, const RGBA& color1,
return Stroke(width, Pointf(x1, y1), color1, Pointf(x2, y2), color2, style);
}
Painter& Painter::Stroke(double width, const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, dword flags)
{
StrokeOp(width, color1, color2, transsrc, flags);
return *this;
}
Painter& Painter::Stroke(double width, double fx, double fy, const RGBA& color1, double cx, double cy, double r, const RGBA& color2, int style)
{
return Stroke(width, Pointf(fx, fy), color1, Pointf(cx, cy), r, color2, style);
@ -555,10 +567,12 @@ void NilPainter::CloseOp() {}
void NilPainter::DivOp() {}
void NilPainter::FillOp(const RGBA& color) {}
void NilPainter::FillOp(const Image& image, const Xform2D& transsrc, dword flags) {}
void NilPainter::FillOp(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, int style) {}
void NilPainter::FillOp(const Pointf& p1, const RGBA& color1, const Pointf& p2, const RGBA& color2, int style) {}
void NilPainter::FillOp(const Pointf& f, const RGBA& color1, const Pointf& c, double r, const RGBA& color2, int style) {}
void NilPainter::StrokeOp(double width, const RGBA& rgba) {}
void NilPainter::StrokeOp(double width, const Image& image, const Xform2D& transsrc, dword flags) {}
void NilPainter::StrokeOp(double width, const RGBA& color1, const RGBA& color2, const Xform2D& transsrc, int style) {}
void NilPainter::StrokeOp(double width, const Pointf& p1, const RGBA& color1, const Pointf& p2, const RGBA& color2, int style) {}
void NilPainter::StrokeOp(double width, const Pointf& f, const RGBA& color1, const Pointf& c, double r, const RGBA& color2, int style) {}
void NilPainter::ClipOp() {}

View file

@ -107,6 +107,8 @@ protected:
virtual void FillOp(const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style) = 0;
virtual void FillOp(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc,
int style) = 0;
virtual void StrokeOp(double width, const RGBA& rgba) = 0;
virtual void StrokeOp(double width, const Image& image, const Xform2D& transsrc,
@ -114,6 +116,8 @@ protected:
virtual void StrokeOp(double width, const Pointf& p1, const RGBA& color1,
const Pointf& p2, const RGBA& color2,
int style) = 0;
virtual void StrokeOp(double width, const RGBA& color1, const RGBA& color2,
const Xform2D& transsrc, int style) = 0;
virtual void StrokeOp(double width, const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style) = 0;
@ -237,6 +241,8 @@ public:
const Pointf& p2, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Fill(double x1, double y1, const RGBA& color1,
double x2, double y2, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Fill(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc,
dword flags = 0);
Painter& Fill(const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Fill(double fx, double fy, const RGBA& color1,
@ -256,6 +262,8 @@ public:
const Pointf& p2, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Stroke(double width, double x1, double y1, const RGBA& color1,
double x2, double y2, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Stroke(double width, const RGBA& color1, const RGBA& color2, const Xform2D& transsrc,
dword flags = 0);
Painter& Stroke(double width, const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2, int style = GRADIENT_PAD);
Painter& Stroke(double width, double fx, double fy, const RGBA& color1,
@ -365,6 +373,8 @@ protected:
virtual void FillOp(const Pointf& p1, const RGBA& color1,
const Pointf& p2, const RGBA& color2,
int style);
virtual void FillOp(const RGBA& color1, const RGBA& color2, const Xform2D& transsrc,
int style);
virtual void FillOp(const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style);
@ -375,6 +385,9 @@ protected:
virtual void StrokeOp(double width, const Pointf& p1, const RGBA& color1,
const Pointf& p2, const RGBA& color2,
int style);
virtual void StrokeOp(double width, const RGBA& color1, const RGBA& color2,
const Xform2D& transsrc,
int style);
virtual void StrokeOp(double width, const Pointf& f, const RGBA& color1,
const Pointf& c, double r, const RGBA& color2,
int style);