diff --git a/uppsrc/Painter/BufferPainter.h b/uppsrc/Painter/BufferPainter.h index 40a3e7214..fc0bcff6e 100644 --- a/uppsrc/Painter/BufferPainter.h +++ b/uppsrc/Painter/BufferPainter.h @@ -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); diff --git a/uppsrc/Painter/Gradient.cpp b/uppsrc/Painter/Gradient.cpp index 30b4f52d1..21765dafb 100644 --- a/uppsrc/Painter/Gradient.cpp +++ b/uppsrc/Painter/Gradient.cpp @@ -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)); } diff --git a/uppsrc/Painter/Interpolator.cpp b/uppsrc/Painter/Interpolator.cpp index e2e5d5090..1c7afdf64 100644 --- a/uppsrc/Painter/Interpolator.cpp +++ b/uppsrc/Painter/Interpolator.cpp @@ -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); } diff --git a/uppsrc/Painter/Painter.cpp b/uppsrc/Painter/Painter.cpp index 2ab4d6ad8..15434780b 100644 --- a/uppsrc/Painter/Painter.cpp +++ b/uppsrc/Painter/Painter.cpp @@ -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() {} diff --git a/uppsrc/Painter/Painter.h b/uppsrc/Painter/Painter.h index 78517259e..4e5520372 100644 --- a/uppsrc/Painter/Painter.h +++ b/uppsrc/Painter/Painter.h @@ -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);