11 #include <wx/dcclient.h>
12 #include <wx/dcmemory.h>
13 #include <wx/graphics.h>
20 wxGraphicsMatrix matrix;
28 path = gc->CreatePath();
33 double x = point.
x, y = point.
y;
34 matrix.TransformPoint(&x, &y);
36 path.MoveToPoint(x, y);
39 path.AddLineToPoint(x, y);
59 wxGraphicsMatrix matrix;
62 const Float ps = 3._f;
70 : gc(wxGraphicsContext::Create(dc))
73 matrix = gc->CreateMatrix();
78 : gc(wxGraphicsContext::Create(dc))
81 matrix = gc->CreateMatrix();
85 double x = point.
x, y = point.
y;
86 matrix.TransformPoint(&x, &y);
87 gc->DrawEllipse(x - ps / 2, y - ps / 2, ps, ps);
95 double x1 = from.
x, y1 = from.
y;
96 matrix.TransformPoint(&x1, &y1);
97 double x2 = to.
x, y2 = to.
y;
98 matrix.TransformPoint(&x2, &y2);
99 gc->StrokeLine(x1, y1, x2, y2);
103 return makeAuto<GraphicsPath>(gc, matrix);
112 pen.SetColour(wxColour(color));
115 pen.SetColour(*wxBLACK);
121 matrix.Set(m(0, 0), m(0, 1), m(1, 0), m(1, 1), m(0, 2), m(1, 2));
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
#define NAMESPACE_SPH_END
Drawing quantity values as functions of time or spatial coordinates.
Wrapper of pointer that deletes the resource from destructor.
Drawing context using wxWidgets implementation of Cairo backend.
GraphicsContext(wxMemoryDC &dc, const Rgba color)
Constructs the drawing context from wxMemoryDC.
virtual void drawLine(const PlotPoint &from, const PlotPoint &to) override
Draws a line connecting two points.
GraphicsContext(wxPaintDC &dc, const Rgba color)
Constructs the drawing context from wxPaintDC.
virtual void drawPoint(const PlotPoint &point) override
Adds a single point to the plot.
virtual void drawErrorPoint(const ErrorPlotPoint &point) override
Adds a point with error bars to the plot.
virtual void setTransformMatrix(const AffineMatrix2 &m) override
Applies the given tranformation matrix on all primitives.
virtual void setStyle(const Size index) override
Changes the current drawing style.
virtual AutoPtr< IDrawPath > drawPath() override
Draws a path connecting points.
virtual void endPath() override
Finalizes the path. Does not connect the last point to anything.
GraphicsPath(const SharedPtr< wxGraphicsContext > &gc, const wxGraphicsMatrix &matrix)
virtual void closePath() override
Closes the path, connecting to the first point on the path.
virtual void addPoint(const PlotPoint &point) override
Adds a next point on the path.
Abstraction of a drawing context.
2D point and other primitives for 2D geometry