basicDraw.h
Go to the documentation of this file.00001 #ifndef BASIC_DRAW_H
00002 #define BASIC_DRAW_H
00003
00013 #include "ttfDraw.h"
00014 #include "drawSurface.h"
00015 #include "labelComponent.h"
00016 #include <vector>
00017 #include <deque>
00018
00019
00026 class BasicDrawInterface {
00027 protected:
00028 static VXV::Grid view_pos;
00029 static VXV::Rect view_range;
00030 static double view_magnify;
00032 public:
00033 virtual ~BasicDrawInterface(void) {}
00034
00042 static void setDrawPosition(const VXV::Grid& pos, const VXV::Rect& range,
00043 double magnify);
00044
00048 virtual void draw(void) = 0;
00049
00057 void draw(const VXV::Grid& pos, const VXV::Rect& range, double magnify);
00058
00067 VXV::Rect calcPixelRange(const VXV::Grid& pos, const VXV::Rect& range,
00068 double magnify);
00069
00077 void drawRangedPixel(const VXV::Rect& pixel_range, int x, int y);
00078 };
00079
00080
00084 class PixelDraw : public BasicDrawInterface {
00085 VXV::Grid draw_pos;
00086 unsigned long draw_color;
00087 static unsigned long static_draw_color;
00088
00089 public:
00097 PixelDraw(int x, int y, unsigned long color = White);
00098 virtual ~PixelDraw(void) {}
00099 void draw(void);
00100
00106 static void setColor(unsigned long color);
00107
00114 static void setPixel(int x, int y);
00115 };
00116
00117
00121 class PixelGroupDraw : public BasicDrawInterface {
00122 std::vector<VXV::Grid> draw_points;
00123 unsigned long draw_color;
00124
00125 public:
00132 PixelGroupDraw(std::vector<VXV::Grid>& points,
00133 unsigned long color = White);
00134 virtual ~PixelGroupDraw(void) {}
00135 void draw(void);
00136 };
00137
00138
00142 class LineDraw : public BasicDrawInterface {
00143 VXV::Grid draw_p0, draw_p1;
00144 unsigned long draw_color;
00145
00146 public:
00154 LineDraw(const VXV::Grid& p0, const VXV::Grid& p1,
00155 unsigned long color = White);
00156 virtual ~LineDraw(void) {}
00157 void draw(void);
00158 };
00159
00160
00164 class ContLineDraw : public BasicDrawInterface {
00165 std::deque<LineDraw*> draw_lines;
00166
00167 public:
00174 ContLineDraw(const std::deque<VXV::Grid>& points,
00175 unsigned long color = White);
00176 virtual ~ContLineDraw(void);
00177 void draw(void);
00178 };
00179
00180
00184 class CircleDraw : public BasicDrawInterface {
00185 VXV::Grid draw_p;
00186 int draw_r;
00187 unsigned long draw_color;
00188
00189 public:
00197 CircleDraw(const VXV::Grid& p, int r, unsigned long color = White);
00198 virtual ~CircleDraw(void) {}
00199 void draw(void);
00200 };
00201
00202
00206 class TextDraw : public BasicDrawInterface {
00207 DrawSurface* surface;
00208 LabelComponent* label;
00209 VXV::Grid draw_pos;
00210 bool pined;
00211
00212 public:
00224 TextDraw(TTF_Draw& ttf, const char* text,
00225 const VXV::Grid& text_pos, int pxSize = 16, bool pin = false,
00226 unsigned long color = White, unsigned long background = Black,
00227 bool transparent = false);
00228 virtual ~TextDraw(void);
00229 void draw(void);
00230 };
00231
00232 #endif
00233