Imagine++
Draw.h
1 // ===========================================================================
2 // Imagine++ Libraries
3 // Copyright (C) Imagine
4 // For detailed information: http://imagine.enpc.fr/software
5 // ===========================================================================
6 
7 #ifndef IMAGINE_GRAPHICS_DRAW2D_H
8 #define IMAGINE_GRAPHICS_DRAW2D_H
9 
10 #include "Types.h"
11 class QPolygonF;
12 namespace Imagine {
13  class Mesh;
16 
17  // Drawing commands
26  void drawPoint(int x, int y, const Color& col, bool xorMode = false);
35  inline void drawPoint(const IntPoint2& p, const Color& col, bool xorMode = false)
36  { drawPoint(p.x(), p.y(), col, xorMode); }
47  void drawCircle(int xc, int yc, int r, const Color& col, int penWidth = 1, bool xorMode = false);
58  inline void drawCircle(const IntPoint2& c, int r, const Color &col, int penWidth = 1, bool xorMode = false)
59  { drawCircle(c.x(), c.y(), r, col, penWidth, xorMode); }
70  void drawEllipse(int x, int y, int w, int h, const Color &col, int penWidth = 1, bool xorMode = false);
81  inline void drawEllipse(const IntPoint2& p, int w, int h, const Color &col, int penWidth = 1, bool xorMode = false)
82  { drawEllipse(p.x(), p.y(), w, h, col, penWidth, xorMode); }
93  void drawLine(int x1, int y1, int x2, int y2, const Color &col, int penWidth = 1, bool xorMode = false);
104  inline void drawLine(const IntPoint2& p1, const IntPoint2& p2, const Color &col, int penWidth = 1, bool xorMode = false)
105  { drawLine(p1.x(), p1.y(), p2.x(), p2.y(), col, penWidth, xorMode); }
116  void drawRect(int x, int y, int w, int h, const Color &col, int penWidth = 1, bool xorMode = false);
127  inline void drawRect(const IntPoint2& p, int w, int h, const Color &col, int penWidth = 1, bool xorMode = false)
128  { drawRect(p.x(), p.y(), w, h, col, penWidth, xorMode); }
134  void setCamera(const DoublePoint3& pos,
135  const DoublePoint3& dir,
136  const DoubleVector3& up);
137 #ifndef DOXYGEN_SHOULD_SKIP_THIS
138  void drawPoly(const QPolygonF& poly, const Color& col, int width = 1, bool xorMode = false); // Private : do not use.
139 #endif
140 
152  void drawPoly(const int x[], const int y[], int n, const Color& col, int width = 1, bool xorMode = false);
164  void drawPoly(const IntPoint2* p, int n, const Color& col,int width = 1, bool xorMode = false);
176  inline void drawPoly(const int xy[], int n, const Color &col, int width = 1, bool xorMode = false)
177  { drawPoly((const IntPoint2*)xy,n,col,width, xorMode); }
191  void drawString(int x, int y, const std::string &s, const AlphaColor &col, int fontSize = 12,
192  double alpha = 0, bool italic = false, bool bold = false, bool underlined = false, bool xorMode = false);
206  inline void drawString(const IntPoint2& p, const std::string &s, const AlphaColor& col, int fontSize = 12,
207  double alpha = 0, bool italic = false, bool bold = false, bool underlined = false, bool xorMode = false)
208  { drawString(p.x(), p.y(), s, col, fontSize, alpha, italic, bold, underlined, xorMode); }
221  void drawArrow(int x1, int y1, int x2, int y2, const AlphaColor &col, int arrowWidth = 8, int arrowHeight = 5,
222  int style = 0, int width = 1, bool xorMode = false);
235  inline void drawArrow(const IntPoint2& p1, const IntPoint2& p2, const AlphaColor& col, int arrowWidth = 8, int arrowHeight = 5,
236  int style = 0, int width = 1, bool xorMode = false)
237  { drawArrow(p1.x(), p1.y(), p2.x(), p2.y(), col, arrowWidth, arrowHeight,
238  style, width, xorMode); }
251  inline void drawArrow(int x1, int y1, int x2, int y2, const AlphaColor& col, double ta, double tl, int style = 0, int width = 1, bool xorMode = false)
252  { drawArrow(x1, y1, x2, y2, col,
253  int(tl*cos(ta*3.14/180)), int(2*tl*sin(ta*3.14/180)),
254  style, width, xorMode); }
267  inline void drawArrow(const IntPoint2& p1, const IntPoint2& p2, const AlphaColor& col, double ta, double tl, int style = 0, int width = 1, bool xorMode = false)
268  { drawArrow(p1.x(), p1.y(), p2.x(), p2.y(), col, ta, tl, style, width, xorMode); }
278  void fillEllipse(int x, int y, int w, int h, const AlphaColor &col, bool xorMode = false);
288  inline void fillEllipse(const IntPoint2& p, int w, int h, const AlphaColor& col, bool xorMode = false)
289  { fillEllipse(p.x(), p.y(), w, h, col, xorMode); }
299  void fillRect(int x, int y, int w, int h, const AlphaColor &col, bool xorMode = false);
309  inline void fillRect(const IntPoint2& p, int w, int h, const AlphaColor& col, bool xorMode = false)
310  { fillRect(p.x(), p.y(), w, h, col, xorMode); }
320  void fillCircle(int xc, int yc, int r, const AlphaColor &col, bool xorMode = false);
330  inline void fillCircle(const IntPoint2& c, int r, const AlphaColor& col, bool xorMode = false)
331  { fillCircle(c.x(), c.y(), r, col, xorMode); }
332 
333 #ifndef DOXYGEN_SHOULD_SKIP_THIS
334  void fillPoly(const QPolygonF& polygon, const AlphaColor &col, bool xorMode = false); // Private : do not use.
335 #endif
336  void fillPoly(const int x[], const int y[], int n, const AlphaColor &col, bool xorMode = false);
357  void fillPoly(const IntPoint2* p, int n, const AlphaColor &col, bool xorMode = false);
368  void fillPoly(const int xy[], int n, const AlphaColor &col, bool xorMode = false);
369 
370  // No refresh functions
371 #ifndef DOXYGEN_SHOULD_SKIP_THIS
372  int noRefreshStack(int i); // Private : do not use.
373 #endif
374 
382  void noRefreshBegin();
389  void noRefreshEnd();
398  inline void noRefreshPush()
399  { if(noRefreshStack(1) == 1) noRefreshBegin(); }
406  inline void noRefreshPop()
407  { if(noRefreshStack(-1) == 0) noRefreshEnd(); }
408 
410 } /* namespace Imagine */
411 
412 #endif // IMAGINE_GRAPHICS_DRAW2D_H
void drawPoint(int x, int y, const Color &col, bool xorMode=false)
Point.
void drawLine(int x1, int y1, int x2, int y2, const Color &col, int penWidth=1, bool xorMode=false)
Line.
Coords< 2 > IntPoint2
Plane point with integral coordinates.
Definition: Types.h:17
RGBA< byte > AlphaColor
RGBA alias.
Definition: Color.h:354
void noRefreshPush()
Norefresh push.
Definition: Draw.h:398
RGB< byte > Color
RGB alias.
Definition: Color.h:281
void noRefreshBegin()
Norefresh begin.
void drawPoly(const int x[], const int y[], int n, const Color &col, int width=1, bool xorMode=false)
Polygon.
DoublePoint3 DoubleVector3
Double space vector.
Definition: Types.h:21
void fillPoly(const int x[], const int y[], int n, const AlphaColor &col, bool xorMode=false)
Filled Polygon.
void fillRect(int x, int y, int w, int h, const AlphaColor &col, bool xorMode=false)
Filled rectangle.
RED GREEN BLUE Alpha color.
Definition: Color.h:138
void drawEllipse(int x, int y, int w, int h, const Color &col, int penWidth=1, bool xorMode=false)
Ellipse.
void fillCircle(int xc, int yc, int r, const AlphaColor &col, bool xorMode=false)
Filled Circle.
void drawString(int x, int y, const std::string &s, const AlphaColor &col, int fontSize=12, double alpha=0, bool italic=false, bool bold=false, bool underlined=false, bool xorMode=false)
String.
void setCamera(const DoublePoint3 &pos, const DoublePoint3 &dir, const DoubleVector3 &up)
Camera Sets the camera.
const T & x() const
Read alias.
Definition: FVector.h:104
Imagine++ namespace.
Definition: Array.h:7
void drawArrow(int x1, int y1, int x2, int y2, const AlphaColor &col, int arrowWidth=8, int arrowHeight=5, int style=0, int width=1, bool xorMode=false)
Arrow.
RED GREEN BLUE color.
Definition: Color.h:26
const T & y() const
Read alias.
Definition: FVector.h:118
void noRefreshEnd()
Norefresh end.
void noRefreshPop()
Norefresh pop.
Definition: Draw.h:406
FVector< double, 3 > DoublePoint3
Double space point.
Definition: Types.h:19
void fillEllipse(int x, int y, int w, int h, const AlphaColor &col, bool xorMode=false)
Filled Ellipse.
void drawRect(int x, int y, int w, int h, const Color &col, int penWidth=1, bool xorMode=false)
Rectangle.
void drawCircle(int xc, int yc, int r, const Color &col, int penWidth=1, bool xorMode=false)
Circle.