diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-20 09:56:18 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-20 09:56:18 +1100 |
commit | fa10779da55ff13c95a0cd39bffdf57dcdfc9cc5 (patch) | |
tree | f29c68da031bbc4219f96a9e023380adfaa21cec /qt/ScintillaEditBase/PlatQt.cpp | |
parent | 7fe8bb0dba466798ca9efc448f772d37f360efe2 (diff) | |
download | scintilla-mirror-fa10779da55ff13c95a0cd39bffdf57dcdfc9cc5.tar.gz |
Implement LineDraw and PolyLine.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 7e2fd3e98..120b75052 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -301,6 +301,22 @@ void SurfaceImpl::LineTo(int x_, int y_) y = y_; } +void SurfaceImpl::LineDraw(Point start, Point end, Stroke stroke) +{ + PenColourWidth(stroke.colour, stroke.width); + QLineF line(start.x, start.y, end.x, end.y); + GetPainter()->drawLine(line); +} + +void SurfaceImpl::PolyLine(const Point *pts, size_t npts, Stroke stroke) +{ + // TODO: set line joins and caps + PenColourWidth(stroke.colour, stroke.width); + std::vector<QPointF> qpts; + std::transform(pts, pts + npts, std::back_inserter(qpts), QPointFFromPoint); + GetPainter()->drawPolyline(&qpts[0], static_cast<int>(npts)); +} + void SurfaceImpl::Polygon(Point *pts, size_t npts, ColourDesired fore, |