From fa10779da55ff13c95a0cd39bffdf57dcdfc9cc5 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 20 Mar 2021 09:56:18 +1100 Subject: Implement LineDraw and PolyLine. --- qt/ScintillaEditBase/PlatQt.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'qt/ScintillaEditBase/PlatQt.cpp') 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 qpts; + std::transform(pts, pts + npts, std::back_inserter(qpts), QPointFFromPoint); + GetPainter()->drawPolyline(&qpts[0], static_cast(npts)); +} + void SurfaceImpl::Polygon(Point *pts, size_t npts, ColourDesired fore, -- cgit v1.2.3