aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase/PlatQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index a8553e658..6c7f789ce 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -230,11 +230,24 @@ void SurfaceImpl::PenColour(ColourDesired fore)
GetPainter()->setPen(penOutline);
}
+void SurfaceImpl::PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth) {
+ QPen penOutline(QColorFromColourAlpha(fore));
+ penOutline.setCapStyle(Qt::FlatCap);
+ penOutline.setJoinStyle(Qt::MiterJoin);
+ penOutline.setWidthF(strokeWidth);
+ GetPainter()->setPen(penOutline);
+}
+
void SurfaceImpl::BrushColour(ColourDesired back)
{
GetPainter()->setBrush(QBrush(QColorFromCA(back)));
}
+void SurfaceImpl::BrushColour(ColourAlpha back)
+{
+ GetPainter()->setBrush(QBrush(QColorFromColourAlpha(back)));
+}
+
void SurfaceImpl::SetCodec(const Font *font)
{
const FontAndCharacterSet *pfacs = AsFontAndCharacterSet(font);
@@ -304,6 +317,17 @@ void SurfaceImpl::Polygon(Point *pts,
GetPainter()->drawPolygon(&qpts[0], static_cast<int>(npts));
}
+void SurfaceImpl::Polygon(const Point *pts, size_t npts, FillStroke fillStroke)
+{
+ PenColourWidth(fillStroke.stroke.colour, fillStroke.stroke.width);
+ BrushColour(fillStroke.fill.colour);
+
+ std::vector<QPointF> qpts;
+ std::transform(pts, pts + npts, std::back_inserter(qpts), QPointFFromPoint);
+
+ GetPainter()->drawPolygon(&qpts[0], static_cast<int>(npts));
+}
+
void SurfaceImpl::RectangleDraw(PRectangle rc,
ColourDesired fore,
ColourDesired back)
@@ -314,6 +338,14 @@ void SurfaceImpl::RectangleDraw(PRectangle rc,
GetPainter()->drawRect(rect);
}
+void SurfaceImpl::RectangleDraw(PRectangle rc, FillStroke fillStroke)
+{
+ PenColourWidth(fillStroke.stroke.colour, fillStroke.stroke.width);
+ BrushColour(fillStroke.fill.colour);
+ const QRectF rect = QRectFFromPRect(rc.Inset(fillStroke.stroke.width / 2));
+ GetPainter()->drawRect(rect);
+}
+
void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back)
{
GetPainter()->fillRect(QRectFFromPRect(rc), QColorFromCA(back));
@@ -352,6 +384,13 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc,
GetPainter()->drawRoundedRect(QRectFFromPRect(RectangleInset(rc, 0.5f)), 3.0f, 3.0f);
}
+void SurfaceImpl::RoundedRectangle(PRectangle rc, FillStroke fillStroke)
+{
+ PenColourWidth(fillStroke.stroke.colour, fillStroke.stroke.width);
+ BrushColour(fillStroke.fill.colour);
+ GetPainter()->drawRoundedRect(QRectFFromPRect(rc), 3.0f, 3.0f);
+}
+
void SurfaceImpl::AlphaRectangle(PRectangle rc,
int cornerSize,
ColourDesired fill,
@@ -469,6 +508,14 @@ void SurfaceImpl::Ellipse(PRectangle rc,
GetPainter()->drawEllipse(QRectFFromPRect(rc));
}
+void SurfaceImpl::Ellipse(PRectangle rc, FillStroke fillStroke)
+{
+ PenColourWidth(fillStroke.stroke.colour, fillStroke.stroke.width);
+ BrushColour(fillStroke.fill.colour);
+ const QRectF rect = QRectFFromPRect(rc.Inset(fillStroke.stroke.width / 2));
+ GetPainter()->drawEllipse(rect);
+}
+
void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource)
{
SurfaceImpl *source = dynamic_cast<SurfaceImpl *>(&surfaceSource);