summaryrefslogtreecommitdiff
path: root/plugingui/painter.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-11-07 10:39:46 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-11-07 10:39:46 +0100
commita65ca7af57feaf7a4ea73f7e071a72eb9b3a1e24 (patch)
tree6cf9fa3b8b57513b8eae030bdc6e1a18495d7e75 /plugingui/painter.h
parent60109b8a737059058d2b0664c7ea88ec501490f7 (diff)
Refactored Painter.
Diffstat (limited to 'plugingui/painter.h')
-rw-r--r--plugingui/painter.h89
1 files changed, 42 insertions, 47 deletions
diff --git a/plugingui/painter.h b/plugingui/painter.h
index 0a93f50..40747a7 100644
--- a/plugingui/painter.h
+++ b/plugingui/painter.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_PAINTER_H__
-#define __DRUMGIZMO_PAINTER_H__
+#pragma once
#include <string>
@@ -39,59 +38,55 @@ namespace GUI {
class Painter {
public:
- Painter(Widget *widget);
- ~Painter();
+ Painter(Widget& widget);
+ ~Painter();
- void flush();
+ void flush();
- void setColour(Colour colour);
+ void setColour(const Colour& colour);
- void drawLine(int x1, int y1, int x2, int y2);
- void drawText(int x, int y, Font &font, std::string text,
- bool nocolour = false);
- void drawRectangle(int x1, int y1, int x2, int y2);
- void drawFilledRectangle(int x1, int y1, int x2, int y2);
- void drawPoint(int x, int y);
- void drawCircle(int x, int y, double r);
- void drawFilledCircle(int x, int y, int r);
- void drawImage(int x, int y, Image *image);
- void drawImageStretched(int x0, int y0, GUI::Image *image,
- int width, int height);
+ void drawLine(int x1, int y1, int x2, int y2);
+ void drawText(int x, int y, const Font &font, const std::string& text,
+ bool nocolour = false);
+ void drawRectangle(int x1, int y1, int x2, int y2);
+ void drawFilledRectangle(int x1, int y1, int x2, int y2);
+ void drawPoint(int x, int y);
+ void drawCircle(int x, int y, double r);
+ void drawFilledCircle(int x, int y, int r);
+ void drawImage(int x, int y, const Image& image);
+ void drawImageStretched(int x, int y, const Image& image,
+ int width, int height);
- typedef struct {
- Image *topLeft;
- Image *top;
- Image *topRight;
- Image *left;
- Image *right;
- Image *bottomLeft;
- Image *bottom;
- Image *bottomRight;
- Image *center;
- } Box;
- void drawBox(int x, int y, Box *box, int width, int height);
+ typedef struct {
+ Image *topLeft;
+ Image *top;
+ Image *topRight;
+ Image *left;
+ Image *right;
+ Image *bottomLeft;
+ Image *bottom;
+ Image *bottomRight;
+ Image *center;
+ } Box;
+ void drawBox(int x, int y, const Box& box, int width, int height);
- typedef struct {
- Image *left;
- Image *right;
- Image *center;
- } Bar;
- void drawBar(int x, int y, Bar *bar, int width, int height);
+ typedef struct {
+ Image *left;
+ Image *right;
+ Image *center;
+ } Bar;
+ void drawBar(int x, int y, const Bar& bar, int width, int height);
- void clear();
+ void clear();
private:
- void plot(int x, int y, double c);
- double ipart(double x);
- double round(double x);
- double fpart(double x);
- double rfpart(double x);
+ void plot(int x, int y, double c);
+ double fpart(double x);
+ double rfpart(double x);
- Widget *widget;
- PixelBufferAlpha *pixbuf;
- Colour colour;
+ Widget& widget;
+ PixelBufferAlpha* pixbuf;
+ Colour colour;
};
-};
-
-#endif/*__DRUMGIZMO_PAINTER_H__*/
+} // GUI::