aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase/PlatQt.cpp
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-25 11:16:04 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-25 11:16:04 +1100
commit3d45c4bf974b6fdcce9712bbd3f0071a9618b89f (patch)
tree0e648f92f248247953cc6e0e4bed30e83c443765 /qt/ScintillaEditBase/PlatQt.cpp
parent921df6efca5b385790a2806f8b8844becb36e773 (diff)
downloadscintilla-mirror-3d45c4bf974b6fdcce9712bbd3f0071a9618b89f.tar.gz
Translucent text.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index d61abf7b2..248fcf194 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -249,6 +249,13 @@ void SurfaceImpl::PenColour(ColourDesired fore)
GetPainter()->setPen(penOutline);
}
+void SurfaceImpl::PenColour(ColourAlpha fore)
+{
+ QPen penOutline(QColorFromColourAlpha(fore));
+ penOutline.setCapStyle(Qt::FlatCap);
+ GetPainter()->setPen(penOutline);
+}
+
void SurfaceImpl::PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth) {
QPen penOutline(QColorFromColourAlpha(fore));
penOutline.setCapStyle(Qt::FlatCap);
@@ -639,13 +646,13 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore,
- ColourDesired back)
+ ColourAlpha fore,
+ ColourAlpha back)
{
SetFont(font);
PenColour(fore);
- GetPainter()->setBackground(QColorFromCA(back));
+ GetPainter()->setBackground(QColorFromColourAlpha(back));
GetPainter()->setBackgroundMode(Qt::OpaqueMode);
QString su = UnicodeFromText(codec, text);
GetPainter()->drawText(QPointF(rc.left, ybase), su);
@@ -655,8 +662,8 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore,
- ColourDesired back)
+ ColourAlpha fore,
+ ColourAlpha back)
{
SetClip(rc);
DrawTextNoClip(rc, font, ybase, text, fore, back);
@@ -667,7 +674,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore)
+ ColourAlpha fore)
{
SetFont(font);
PenColour(fore);
@@ -751,13 +758,13 @@ void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore,
- ColourDesired back)
+ ColourAlpha fore,
+ ColourAlpha back)
{
SetFont(font);
PenColour(fore);
- GetPainter()->setBackground(QColorFromCA(back));
+ GetPainter()->setBackground(QColorFromColourAlpha(back));
GetPainter()->setBackgroundMode(Qt::OpaqueMode);
QString su = QString::fromUtf8(text.data(), static_cast<int>(text.length()));
GetPainter()->drawText(QPointF(rc.left, ybase), su);
@@ -767,8 +774,8 @@ void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore,
- ColourDesired back)
+ ColourAlpha fore,
+ ColourAlpha back)
{
SetClip(rc);
DrawTextNoClip(rc, font, ybase, text, fore, back);
@@ -779,7 +786,7 @@ void SurfaceImpl::DrawTextTransparentUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourDesired fore)
+ ColourAlpha fore)
{
SetFont(font);
PenColour(fore);