From cf49b305a0c9e10a8b08ac626019f1502c5f12ee Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 31 May 2019 15:50:24 +0200 Subject: Stretched drumkit image test. --- plugingui/painter.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'plugingui/painter.h') diff --git a/plugingui/painter.h b/plugingui/painter.h index b38bf88..3bdbe2d 100644 --- a/plugingui/painter.h +++ b/plugingui/painter.h @@ -39,6 +39,12 @@ class Drawable; class Image; class Canvas; +enum class Filter +{ + Nearest, + Linear, +}; + class Painter { public: @@ -59,10 +65,11 @@ public: void drawRestrictedImage(int x0, int y0, const Colour& restriction_colour, const Drawable& image); void drawImageStretched(int x, int y, const Drawable& image, - int width, int height); + int width, int height, + Filter filter = Filter::Nearest); template - void draw(Iterator begin, Iterator end, int x_offset, int y_offset, Colour const& colour); + void draw(Iterator begin, Iterator end, int x_offset, int y_offset, Colour const& colour, double scale = 1.0); typedef struct { Image* topLeft; @@ -92,11 +99,11 @@ private: }; template -void Painter::draw(Iterator begin, Iterator end, int x_offset, int y_offset, Colour const& colour) +void Painter::draw(Iterator begin, Iterator end, int x_offset, int y_offset, Colour const& colour, double scale) { for (auto it = begin; it != end; ++it) { - pixbuf.addPixel(x_offset + it->x, y_offset + it->y, colour); + pixbuf.addPixel(x_offset + it->x * scale, y_offset + it->y * scale, colour); } } -- cgit v1.2.3