aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-22 08:18:01 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-22 08:18:01 +1000
commitc8235ba0e0292f209a8233613669e2cff8de80da (patch)
tree117df121f92601300eeb2e9a047860384eb17d79
parent7f8a8cfb32aecb70fe10ef26fe096f4092f7e673 (diff)
downloadscintilla-mirror-c8235ba0e0292f209a8233613669e2cff8de80da.tar.gz
Rename ColourAlpha to ColourRGBA to avoid clashes when a ColourAlpha typedef
will be published in externally visible header.
-rw-r--r--cocoa/PlatCocoa.h24
-rw-r--r--cocoa/PlatCocoa.mm28
-rw-r--r--cocoa/ScintillaCocoa.mm14
-rwxr-xr-xgtk/PlatGTK.cxx44
-rwxr-xr-xgtk/ScintillaGTK.cxx8
-rw-r--r--gtk/ScintillaGTKAccessible.cxx2
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp52
-rw-r--r--qt/ScintillaEditBase/PlatQt.h20
-rw-r--r--qt/ScintillaEditBase/ScintillaEditBase.cpp8
-rw-r--r--src/CallTip.cxx18
-rw-r--r--src/CallTip.h12
-rw-r--r--src/EditView.cxx94
-rw-r--r--src/EditView.h6
-rw-r--r--src/Editor.cxx46
-rw-r--r--src/Geometry.h50
-rw-r--r--src/Indicator.cxx24
-rw-r--r--src/Indicator.h6
-rw-r--r--src/LineMarker.cxx26
-rw-r--r--src/LineMarker.h8
-rw-r--r--src/MarginView.cxx10
-rw-r--r--src/MarginView.h4
-rw-r--r--src/Platform.h24
-rw-r--r--src/ScintillaBase.cxx6
-rw-r--r--src/Style.cxx8
-rw-r--r--src/Style.h6
-rw-r--r--src/ViewStyle.cxx52
-rw-r--r--src/ViewStyle.h32
-rw-r--r--src/XPM.cxx16
-rw-r--r--src/XPM.h8
-rw-r--r--win32/PlatWin.cxx86
-rw-r--r--win32/ScintillaWin.cxx10
31 files changed, 376 insertions, 376 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index 70a9b68f1..29c908baa 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -56,9 +56,9 @@ private:
int bitmapHeight;
/** Set the CGContext's fill colour to the specified desired colour. */
- void FillColour(ColourAlpha fill);
+ void FillColour(ColourRGBA fill);
- void PenColourAlpha(ColourAlpha fore);
+ void PenColourAlpha(ColourRGBA fore);
void SetFillStroke(FillStroke fillStroke);
@@ -111,19 +111,19 @@ public:
void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) override;
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
- void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore,
- ColourAlpha back) override;
- void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore,
- ColourAlpha back) override;
- void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore,
+ ColourRGBA back) override;
+ void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore,
+ ColourRGBA back) override;
+ void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthText(const Font *font_, std::string_view text) override;
- void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore,
- ColourAlpha back) override;
- void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore,
- ColourAlpha back) override;
- void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore,
+ ColourRGBA back) override;
+ void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore,
+ ColourRGBA back) override;
+ void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override;
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 100ea44b0..1cb4f9f65 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -497,7 +497,7 @@ int SurfaceImpl::Supports(int feature) noexcept {
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::FillColour(ColourAlpha fill) {
+void SurfaceImpl::FillColour(ColourRGBA fill) {
// Set the Fill color to match
CGContextSetRGBFillColor(gc,
fill.GetRedComponent(),
@@ -508,7 +508,7 @@ void SurfaceImpl::FillColour(ColourAlpha fill) {
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::PenColourAlpha(ColourAlpha fore) {
+void SurfaceImpl::PenColourAlpha(ColourRGBA fore) {
// Set the Stroke color to match
CGContextSetRGBStrokeColor(gc,
fore.GetRedComponent(),
@@ -741,7 +741,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) {
// For now, assume that copy can only be called on PixMap surfaces. Shows up black.
CGImageRef image = patternSurface.CreateImage();
if (image == NULL) {
- FillRectangle(rc, ColourAlpha::FromRGB(0));
+ FillRectangle(rc, ColourRGBA::FromRGB(0));
return;
}
@@ -1147,7 +1147,7 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou
CGImageRef image = source.CreateImage();
// If we could not get an image reference, fill the rectangle black
if (image == NULL) {
- FillRectangle(rc, ColourAlpha::FromRGB(0));
+ FillRectangle(rc, ColourRGBA::FromRGB(0));
return;
}
@@ -1179,7 +1179,7 @@ std::unique_ptr<IScreenLineLayout> SurfaceImpl::Layout(const IScreenLine *screen
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextTransparent(rc, font_, ybase, text, fore);
}
@@ -1187,7 +1187,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yb
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
CGContextSaveGState(gc);
CGContextClipToRect(gc, PRectangleToCGRect(rc));
DrawTextNoClip(rc, font_, ybase, text, fore, back);
@@ -1252,7 +1252,7 @@ CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) {
}
void SurfaceImpl::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
QuartzTextStyle *style = TextStyleFromFont(font_);
if (!style) {
return;
@@ -1351,7 +1351,7 @@ XYPOSITION SurfaceImpl::WidthText(const Font *font_, std::string_view text) {
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextTransparentUTF8(rc, font_, ybase, text, fore);
}
@@ -1359,7 +1359,7 @@ void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITIO
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
CGContextSaveGState(gc);
CGContextClipToRect(gc, PRectangleToCGRect(rc));
DrawTextNoClipUTF8(rc, font_, ybase, text, fore, back);
@@ -1369,7 +1369,7 @@ void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITI
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
QuartzTextStyle *style = TextStyleFromFont(font_);
if (!style) {
return;
@@ -2287,14 +2287,14 @@ void Menu::Show(Point, const Window &) {
//----------------- Platform -----------------------------------------------------------------------
-ColourAlpha Platform::Chrome() {
- return ColourAlpha(0xE0, 0xE0, 0xE0);
+ColourRGBA Platform::Chrome() {
+ return ColourRGBA(0xE0, 0xE0, 0xE0);
}
//--------------------------------------------------------------------------------------------------
-ColourAlpha Platform::ChromeHighlight() {
- return ColourAlpha(0xFF, 0xFF, 0xFF);
+ColourRGBA Platform::ChromeHighlight() {
+ return ColourRGBA(0xFF, 0xFF, 0xFF);
}
//--------------------------------------------------------------------------------------------------
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index 602ca30d6..fab06f3e6 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -2528,10 +2528,10 @@ void ScintillaCocoa::SetFocusActiveState() {
namespace {
/**
- * Convert from an NSColor into a ColourAlpha
+ * Convert from an NSColor into a ColourRGBA
*/
-ColourAlpha ColourFromNSColor(NSColor *value) {
- return ColourAlpha(static_cast<unsigned int>(value.redComponent * componentMaximum),
+ColourRGBA ColourFromNSColor(NSColor *value) {
+ return ColourRGBA(static_cast<unsigned int>(value.redComponent * componentMaximum),
static_cast<unsigned int>(value.greenComponent * componentMaximum),
static_cast<unsigned int>(value.blueComponent * componentMaximum),
static_cast<unsigned int>(value.alphaComponent * componentMaximum));
@@ -2565,10 +2565,10 @@ void ScintillaCocoa::UpdateBaseElements() {
const int alpha = textBack.brightnessComponent > 0.5 ? 0x40 : 0x60;
// Make a translucent colour that approximates selectedTextBackgroundColor
NSColor *accent = [NSColor.controlAccentColor colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
- const ColourAlpha colourAccent = ColourFromNSColor(accent);
- changed = vs.SetElementBase(SC_ELEMENT_SELECTION_BACK, ColourAlpha(colourAccent, alpha));
- changed = vs.SetElementBase(SC_ELEMENT_SELECTION_ADDITIONAL_BACK, ColourAlpha(colourAccent, alpha/2)) || changed;
- changed = vs.SetElementBase(SC_ELEMENT_SELECTION_NO_FOCUS_BACK, ColourAlpha(ColourFromNSColor(noFocusBack), alpha)) || changed;
+ const ColourRGBA colourAccent = ColourFromNSColor(accent);
+ changed = vs.SetElementBase(SC_ELEMENT_SELECTION_BACK, ColourRGBA(colourAccent, alpha));
+ changed = vs.SetElementBase(SC_ELEMENT_SELECTION_ADDITIONAL_BACK, ColourRGBA(colourAccent, alpha/2)) || changed;
+ changed = vs.SetElementBase(SC_ELEMENT_SELECTION_NO_FOCUS_BACK, ColourRGBA(ColourFromNSColor(noFocusBack), alpha)) || changed;
}
}
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 07a6f5539..db1afc170 100755
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -146,7 +146,7 @@ class SurfaceImpl : public Surface {
PangoLayout *layout = nullptr;
Converter conv;
int characterSet = -1;
- void PenColourAlpha(ColourAlpha fore) noexcept;
+ void PenColourAlpha(ColourRGBA fore) noexcept;
void SetConverter(int characterSet_);
void CairoRectangle(PRectangle rc) noexcept;
public:
@@ -190,17 +190,17 @@ public:
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
- void DrawTextBase(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore);
- void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextBase(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore);
+ void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthText(const Font *font_, std::string_view text) override;
- void DrawTextBaseUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore);
- void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextBaseUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore);
+ void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override;
@@ -276,7 +276,7 @@ const char *CharacterSetID(int characterSet) noexcept {
}
}
-void SurfaceImpl::PenColourAlpha(ColourAlpha fore) noexcept {
+void SurfaceImpl::PenColourAlpha(ColourRGBA fore) noexcept {
if (context) {
cairo_set_source_rgba(context,
fore.GetRedComponent(),
@@ -767,7 +767,7 @@ size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t len) n
}
void SurfaceImpl::DrawTextBase(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
if (context) {
PenColourAlpha(fore);
const XYPOSITION xText = rc.left;
@@ -793,20 +793,20 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, const Font *font_, XYPOSITION ybas
}
void SurfaceImpl::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextBase(rc, font_, ybase, text, fore);
}
// On GTK+, exactly same as DrawTextNoClip
void SurfaceImpl::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextBase(rc, font_, ybase, text, fore);
}
void SurfaceImpl::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (size_t i=0; i<text.length(); i++) {
if (text[i] != ' ') {
@@ -983,7 +983,7 @@ XYPOSITION SurfaceImpl::WidthText(const Font *font_, std::string_view text) {
}
void SurfaceImpl::DrawTextBaseUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
if (context) {
PenColourAlpha(fore);
const XYPOSITION xText = rc.left;
@@ -999,20 +999,20 @@ void SurfaceImpl::DrawTextBaseUTF8(PRectangle rc, const Font *font_, XYPOSITION
}
void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextBaseUTF8(rc, font_, ybase, text, fore);
}
// On GTK+, exactly same as DrawTextNoClip
void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
FillRectangleAligned(rc, back);
DrawTextBaseUTF8(rc, font_, ybase, text, fore);
}
void SurfaceImpl::DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (size_t i = 0; i < text.length(); i++) {
if (text[i] != ' ') {
@@ -2104,12 +2104,12 @@ void Menu::Show(Point pt, const Window &w) {
#endif
}
-ColourAlpha Platform::Chrome() {
- return ColourAlpha(0xe0, 0xe0, 0xe0);
+ColourRGBA Platform::Chrome() {
+ return ColourRGBA(0xe0, 0xe0, 0xe0);
}
-ColourAlpha Platform::ChromeHighlight() {
- return ColourAlpha(0xff, 0xff, 0xff);
+ColourRGBA Platform::ChromeHighlight() {
+ return ColourRGBA(0xff, 0xff, 0xff);
}
const char *Platform::DefaultFont() {
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 9a70ed463..7f7521423 100755
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -686,10 +686,10 @@ void ScintillaGTK::Init() {
timers[tr].reason = static_cast<TickReason>(tr);
timers[tr].scintilla = this;
}
- vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourAlpha(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourRGBA(0, 0, 0xff));
fontOptionsPrevious = FontOptions(PWidget(wText));
}
diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx
index e8bf2af77..25490277b 100644
--- a/gtk/ScintillaGTKAccessible.cxx
+++ b/gtk/ScintillaGTKAccessible.cxx
@@ -524,7 +524,7 @@ static AtkAttributeSet *AddTextIntAttribute(AtkAttributeSet *attributes, AtkText
return AddTextAttribute(attributes, attr, g_strdup(atk_text_attribute_get_value(attr, i)));
}
-static AtkAttributeSet *AddTextColorAttribute(AtkAttributeSet *attributes, AtkTextAttribute attr, ColourAlpha colour) {
+static AtkAttributeSet *AddTextColorAttribute(AtkAttributeSet *attributes, AtkTextAttribute attr, ColourRGBA colour) {
return AddTextAttribute(attributes, attr,
g_strdup_printf("%u,%u,%u", colour.GetRed() * 257, colour.GetGreen() * 257, colour.GetBlue() * 257));
}
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index ee4d7be80..d5475f4bd 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -230,24 +230,24 @@ bool SurfaceImpl::Initialised()
return device != nullptr;
}
-void SurfaceImpl::PenColour(ColourAlpha fore)
+void SurfaceImpl::PenColour(ColourRGBA fore)
{
- QPen penOutline(QColorFromColourAlpha(fore));
+ QPen penOutline(QColorFromColourRGBA(fore));
penOutline.setCapStyle(Qt::FlatCap);
GetPainter()->setPen(penOutline);
}
-void SurfaceImpl::PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth) {
- QPen penOutline(QColorFromColourAlpha(fore));
+void SurfaceImpl::PenColourWidth(ColourRGBA fore, XYPOSITION strokeWidth) {
+ QPen penOutline(QColorFromColourRGBA(fore));
penOutline.setCapStyle(Qt::FlatCap);
penOutline.setJoinStyle(Qt::MiterJoin);
penOutline.setWidthF(strokeWidth);
GetPainter()->setPen(penOutline);
}
-void SurfaceImpl::BrushColour(ColourAlpha back)
+void SurfaceImpl::BrushColour(ColourRGBA back)
{
- GetPainter()->setBrush(QBrush(QColorFromColourAlpha(back)));
+ GetPainter()->setBrush(QBrush(QColorFromColourRGBA(back)));
}
void SurfaceImpl::SetCodec(const Font *font)
@@ -334,7 +334,7 @@ void SurfaceImpl::RectangleFrame(PRectangle rc, Stroke stroke) {
void SurfaceImpl::FillRectangle(PRectangle rc, Fill fill)
{
- GetPainter()->fillRect(QRectFFromPRect(rc), QColorFromColourAlpha(fill.colour));
+ GetPainter()->fillRect(QRectFFromPRect(rc), QColorFromColourRGBA(fill.colour));
}
void SurfaceImpl::FillRectangleAligned(PRectangle rc, Fill fill)
@@ -370,7 +370,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, FillStroke fillStroke)
void SurfaceImpl::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke)
{
- QColor qFill = QColorFromColourAlpha(fillStroke.fill.colour);
+ QColor qFill = QColorFromColourRGBA(fillStroke.fill.colour);
QBrush brushFill(qFill);
GetPainter()->setBrush(brushFill);
if (fillStroke.fill.colour == fillStroke.stroke.colour) {
@@ -384,7 +384,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStrok
GetPainter()->fillRect(rect, brushFill);
}
} else {
- QColor qOutline = QColorFromColourAlpha(fillStroke.stroke.colour);
+ QColor qOutline = QColorFromColourRGBA(fillStroke.stroke.colour);
QPen penOutline(qOutline);
penOutline.setWidthF(fillStroke.stroke.width);
GetPainter()->setPen(penOutline);
@@ -414,7 +414,7 @@ void SurfaceImpl::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
}
linearGradient.setSpread(QGradient::RepeatSpread);
for (const ColourStop &stop : stops) {
- linearGradient.setColorAt(stop.position, QColorFromColourAlpha(stop.colour));
+ linearGradient.setColorAt(stop.position, QColorFromColourRGBA(stop.colour));
}
QBrush brush = QBrush(linearGradient);
GetPainter()->fillRect(rect, brush);
@@ -521,13 +521,13 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore,
- ColourAlpha back)
+ ColourRGBA fore,
+ ColourRGBA back)
{
SetFont(font);
PenColour(fore);
- GetPainter()->setBackground(QColorFromColourAlpha(back));
+ GetPainter()->setBackground(QColorFromColourRGBA(back));
GetPainter()->setBackgroundMode(Qt::OpaqueMode);
QString su = UnicodeFromText(codec, text);
GetPainter()->drawText(QPointF(rc.left, ybase), su);
@@ -537,8 +537,8 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore,
- ColourAlpha back)
+ ColourRGBA fore,
+ ColourRGBA back)
{
SetClip(rc);
DrawTextNoClip(rc, font, ybase, text, fore, back);
@@ -549,7 +549,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore)
+ ColourRGBA fore)
{
SetFont(font);
PenColour(fore);
@@ -633,13 +633,13 @@ void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore,
- ColourAlpha back)
+ ColourRGBA fore,
+ ColourRGBA back)
{
SetFont(font);
PenColour(fore);
- GetPainter()->setBackground(QColorFromColourAlpha(back));
+ GetPainter()->setBackground(QColorFromColourRGBA(back));
GetPainter()->setBackgroundMode(Qt::OpaqueMode);
QString su = QString::fromUtf8(text.data(), static_cast<int>(text.length()));
GetPainter()->drawText(QPointF(rc.left, ybase), su);
@@ -649,8 +649,8 @@ void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore,
- ColourAlpha back)
+ ColourRGBA fore,
+ ColourRGBA back)
{
SetClip(rc);
DrawTextNoClip(rc, font, ybase, text, fore, back);
@@ -661,7 +661,7 @@ void SurfaceImpl::DrawTextTransparentUTF8(PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
- ColourAlpha fore)
+ ColourRGBA fore)
{
SetFont(font);
PenColour(fore);
@@ -1284,16 +1284,16 @@ void Menu::Show(Point pt, const Window & /*w*/)
//----------------------------------------------------------------------
-ColourAlpha Platform::Chrome()
+ColourRGBA Platform::Chrome()
{
QColor c(Qt::gray);
- return ColourAlpha(c.red(), c.green(), c.blue());
+ return ColourRGBA(c.red(), c.green(), c.blue());
}
-ColourAlpha Platform::ChromeHighlight()
+ColourRGBA Platform::ChromeHighlight()
{
QColor c(Qt::lightGray);
- return ColourAlpha(c.red(), c.green(), c.blue());
+ return ColourRGBA(c.red(), c.green(), c.blue());
}
const char *Platform::DefaultFont()
diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h
index 3b74a1306..446e07ebb 100644
--- a/qt/ScintillaEditBase/PlatQt.h
+++ b/qt/ScintillaEditBase/PlatQt.h
@@ -31,7 +31,7 @@ namespace Scintilla {
const char *CharacterSetID(int characterSet);
-inline QColor QColorFromColourAlpha(ColourAlpha ca)
+inline QColor QColorFromColourRGBA(ColourRGBA ca)
{
return QColor(ca.GetRed(), ca.GetGreen(), ca.GetBlue(), ca.GetAlpha());
}
@@ -91,8 +91,8 @@ public:
void Release() noexcept override;
int Supports(int feature) noexcept override;
bool Initialised() override;
- void PenColour(ColourAlpha fore);
- void PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth);
+ void PenColour(ColourRGBA fore);
+ void PenColourWidth(ColourRGBA fore, XYPOSITION strokeWidth);
int LogPixelsY() override;
int PixelDivisions() override;
int DeviceHeightFont(int points) override;
@@ -116,21 +116,21 @@ public:
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
void DrawTextNoClip(PRectangle rc, const Font *font, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore, ColourAlpha back) override;
+ std::string_view text, ColourRGBA fore, ColourRGBA back) override;
void DrawTextClipped(PRectangle rc, const Font *font, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore, ColourAlpha back) override;
+ std::string_view text, ColourRGBA fore, ColourRGBA back) override;
void DrawTextTransparent(PRectangle rc, const Font *font, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore) override;
+ std::string_view text, ColourRGBA fore) override;
void MeasureWidths(const Font *font, std::string_view text,
XYPOSITION *positions) override;
XYPOSITION WidthText(const Font *font, std::string_view text) override;
void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore, ColourAlpha back) override;
+ std::string_view text, ColourRGBA fore, ColourRGBA back) override;
void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore, ColourAlpha back) override;
+ std::string_view text, ColourRGBA fore, ColourRGBA back) override;
void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase,
- std::string_view text, ColourAlpha fore) override;
+ std::string_view text, ColourRGBA fore) override;
void MeasureWidthsUTF8(const Font *font_, std::string_view text,
XYPOSITION *positions) override;
XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override;
@@ -146,7 +146,7 @@ public:
void FlushCachedState() override;
void FlushDrawing() override;
- void BrushColour(ColourAlpha back);
+ void BrushColour(ColourRGBA back);
void SetCodec(const Font *font);
void SetFont(const Font *font);
diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp
index f6da07fe9..c94cd13f7 100644
--- a/qt/ScintillaEditBase/ScintillaEditBase.cpp
+++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp
@@ -59,10 +59,10 @@ ScintillaEditBase::ScintillaEditBase(QWidget *parent)
setAttribute(Qt::WA_KeyCompression);
setAttribute(Qt::WA_InputMethodEnabled);
- sqt->vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourAlpha(0, 0, 0xff));
- sqt->vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourAlpha(0, 0, 0xff));
- sqt->vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourAlpha(0, 0, 0xff));
- sqt->vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourAlpha(0, 0, 0xff));
+ sqt->vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourRGBA(0, 0, 0xff));
+ sqt->vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourRGBA(0, 0, 0xff));
+ sqt->vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourRGBA(0, 0, 0xff));
+ sqt->vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourRGBA(0, 0, 0xff));
connect(sqt, SIGNAL(notifyParent(SCNotification)),
this, SLOT(notifyParent(SCNotification)));
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 56cf3c2fd..8229fc82c 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -54,15 +54,15 @@ CallTip::CallTip() noexcept {
#ifdef __APPLE__
// proper apple colours for the default
- colourBG = ColourAlpha(0xff, 0xff, 0xc6);
- colourUnSel = ColourAlpha(0, 0, 0);
+ colourBG = ColourRGBA(0xff, 0xff, 0xc6);
+ colourUnSel = ColourRGBA(0, 0, 0);
#else
- colourBG = ColourAlpha(0xff, 0xff, 0xff);
- colourUnSel = ColourAlpha(0x80, 0x80, 0x80);
+ colourBG = ColourRGBA(0xff, 0xff, 0xff);
+ colourUnSel = ColourRGBA(0x80, 0x80, 0x80);
#endif
- colourSel = ColourAlpha(0, 0, 0x80);
- colourShade = ColourAlpha(0, 0, 0);
- colourLight = ColourAlpha(0xc0, 0xc0, 0xc0);
+ colourSel = ColourRGBA(0, 0, 0x80);
+ colourShade = ColourRGBA(0, 0, 0);
+ colourLight = ColourRGBA(0xc0, 0xc0, 0xc0);
codePage = 0;
clickPlace = 0;
}
@@ -93,7 +93,7 @@ constexpr bool IsArrowCharacter(char ch) noexcept {
return (ch == 0) || (ch == '\001') || (ch == '\002');
}
-void DrawArrow(Scintilla::Surface *surface, const PRectangle &rc, bool upArrow, ColourAlpha colourBG, ColourAlpha colourUnSel) {
+void DrawArrow(Scintilla::Surface *surface, const PRectangle &rc, bool upArrow, ColourRGBA colourBG, ColourRGBA colourUnSel) {
surface->FillRectangle(rc, colourBG);
const PRectangle rcClientInner = Clamp(rc.Inset(1), Edge::right, rc.right - 2);
surface->FillRectangle(rcClientInner, colourUnSel);
@@ -348,7 +348,7 @@ bool CallTip::UseStyleCallTip() const noexcept {
// It might be better to have two access functions for this and to use
// them for all settings of colours.
-void CallTip::SetForeBack(const ColourAlpha &fore, const ColourAlpha &back) noexcept {
+void CallTip::SetForeBack(const ColourRGBA &fore, const ColourRGBA &back) noexcept {
colourBG = back;
colourUnSel = fore;
}
diff --git a/src/CallTip.h b/src/CallTip.h
index 78518a995..998bdabf5 100644
--- a/src/CallTip.h
+++ b/src/CallTip.h
@@ -44,11 +44,11 @@ public:
Window wDraw;
bool inCallTipMode;
Sci::Position posStartCallTip;
- ColourAlpha colourBG;
- ColourAlpha colourUnSel;
- ColourAlpha colourSel;
- ColourAlpha colourShade;
- ColourAlpha colourLight;
+ ColourRGBA colourBG;
+ ColourRGBA colourUnSel;
+ ColourRGBA colourSel;
+ ColourRGBA colourShade;
+ ColourRGBA colourLight;
int codePage;
int clickPlace;
@@ -91,7 +91,7 @@ public:
bool UseStyleCallTip() const noexcept;
// Modify foreground and background colours
- void SetForeBack(const ColourAlpha &fore, const ColourAlpha &back) noexcept;
+ void SetForeBack(const ColourRGBA &fore, const ColourRGBA &back) noexcept;
};
}
diff --git a/src/EditView.cxx b/src/EditView.cxx
index c9343b0cd..c71c3ce60 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -824,11 +824,11 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m
namespace {
-constexpr ColourAlpha bugColour = ColourAlpha(0xff, 0, 0xff, 0xf0);
+constexpr ColourRGBA bugColour = ColourRGBA(0xff, 0, 0xff, 0xf0);
// Selection background colours are always defined, the value_or is to show if bug
-ColourAlpha SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
+ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
if (inSelection == InSelection::inNone)
return bugColour; // Not selected is a bug
@@ -842,7 +842,7 @@ ColourAlpha SelectionBackground(const EditModel &model, const ViewStyle &vsDraw,
return vsDraw.ElementColour(element).value_or(bugColour);
}
-std::optional<ColourAlpha> SelectionForeground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
+std::optional<ColourRGBA> SelectionForeground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) {
if (inSelection == InSelection::inNone)
return {};
int element = SC_ELEMENT_SELECTION_TEXT;
@@ -862,8 +862,8 @@ std::optional<ColourAlpha> SelectionForeground(const EditModel &model, const Vie
}
-static ColourAlpha TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
- std::optional<ColourAlpha> background, InSelection inSelection, bool inHotspot, int styleMain, Sci::Position i) {
+static ColourRGBA TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
+ std::optional<ColourRGBA> background, InSelection inSelection, bool inHotspot, int styleMain, Sci::Position i) {
if (inSelection && (vsDraw.selection.layer == Layer::base)) {
return SelectionBackground(model, vsDraw, inSelection).Opaque();
}
@@ -889,7 +889,7 @@ void EditView::DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int line
}
static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment,
- std::string_view text, ColourAlpha textBack, ColourAlpha textFore, bool fillBackground) {
+ std::string_view text, ColourRGBA textBack, ColourRGBA textFore, bool fillBackground) {
if (rcSegment.Empty())
return;
if (fillBackground) {
@@ -914,12 +914,12 @@ static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle r
}
static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, int subLine) {
- const std::optional<ColourAlpha> caretlineBack = vsDraw.ElementColour(SC_ELEMENT_CARET_LINE_BACK);
+ const std::optional<ColourRGBA> caretlineBack = vsDraw.ElementColour(SC_ELEMENT_CARET_LINE_BACK);
if (!caretlineBack) {
return;
}
- const ColourAlpha colourFrame = (vsDraw.caretLine.layer == Layer::base) ?
+ const ColourRGBA colourFrame = (vsDraw.caretLine.layer == Layer::base) ?
caretlineBack->Opaque() : *caretlineBack;
const int width = vsDraw.GetFrameWidth();
@@ -947,7 +947,7 @@ static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const
void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
PRectangle rcLine, Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
- std::optional<ColourAlpha> background) {
+ std::optional<ColourRGBA> background) {
const Sci::Position posLineStart = model.pdoc->LineStart(line);
PRectangle rcSegment = rcLine;
@@ -964,7 +964,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
if (virtualSpace > 0.0f) {
rcSegment.left = xEol + xStart;
rcSegment.right = xEol + xStart + virtualSpace;
- const ColourAlpha backgroundFill = background.value_or(vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
+ const ColourRGBA backgroundFill = background.value_or(vsDraw.styles[ll->styles[ll->numCharsInLine]].back);
surface->FillRectangleAligned(rcSegment, backgroundFill);
if (!hideSelection && (vsDraw.selection.layer == Layer::base)) {
const SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)),
@@ -992,7 +992,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
eolInSelection = model.LineEndInSelection(line);
}
- const ColourAlpha selectionBack = SelectionBackground(model, vsDraw, eolInSelection);
+ const ColourRGBA selectionBack = SelectionBackground(model, vsDraw, eolInSelection);
// Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on
XYPOSITION blobsWidth = 0;
@@ -1005,7 +1005,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
const char *ctrlChar;
const unsigned char chEOL = ll->chars[eolPos];
const int styleMain = ll->styles[eolPos];
- const ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, styleMain, eolPos);
+ const ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, styleMain, eolPos);
if (UTF8IsAscii(chEOL)) {
ctrlChar = ControlCharacterString(chEOL);
} else {
@@ -1018,8 +1018,8 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
ctrlChar = hexits;
}
}
- const std::optional<ColourAlpha> selectionFore = SelectionForeground(model, vsDraw, eolInSelection);
- const ColourAlpha textFore = selectionFore.value_or(vsDraw.styles[styleMain].fore);
+ const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, eolInSelection);
+ const ColourRGBA textFore = selectionFore.value_or(vsDraw.styles[styleMain].fore);
if (eolInSelection && (line < model.pdoc->LinesTotal() - 1)) {
if (vsDraw.selection.layer == Layer::base) {
surface->FillRectangleAligned(rcSegment, Fill(selectionBack.Opaque()));
@@ -1030,7 +1030,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
surface->FillRectangleAligned(rcSegment, Fill(textBack));
}
const bool drawEOLSelection = eolInSelection && (line < model.pdoc->LinesTotal() - 1);
- ColourAlpha blobText = textBack;
+ ColourRGBA blobText = textBack;
if (drawEOLSelection && (vsDraw.selection.layer == Layer::under)) {
surface->FillRectangleAligned(rcSegment, selectionBack);
blobText = textBack.MixedWith(selectionBack, selectionBack.GetAlphaComponent());
@@ -1236,10 +1236,10 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
rcSegment.left = xStart + static_cast<XYPOSITION>(ll->positions[ll->numCharsInLine] - subLineStart) + virtualSpace + vsDraw.aveCharWidth;
rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthFoldDisplayText);
- const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
- const std::optional<ColourAlpha> selectionFore = SelectionForeground(model, vsDraw, eolInSelection);
- const ColourAlpha textFore = selectionFore.value_or(vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore);
- const ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, eolInSelection,
+ const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
+ const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, eolInSelection);
+ const ColourRGBA textFore = selectionFore.value_or(vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore);
+ const ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, eolInSelection,
false, STYLE_FOLDDISPLAYTEXT, -1);
if (model.trackLineWidth) {
@@ -1361,9 +1361,9 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
}
rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthEOLAnnotationText);
- const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
- const ColourAlpha textFore = vsDraw.styles[style].fore;
- const ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, InSelection::inNone,
+ const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
+ const ColourRGBA textFore = vsDraw.styles[style].fore;
+ const ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, InSelection::inNone,
false, static_cast<int>(style), -1);
if (model.trackLineWidth) {
@@ -1407,7 +1407,7 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
} else {
if (phasesDraw == PhasesDraw::one) {
// Draw an outline around the text
- surface->Stadium(rcBox, FillStroke(ColourAlpha(textBack, 0), textFore, 1.0), ends);
+ surface->Stadium(rcBox, FillStroke(ColourRGBA(textBack, 0), textFore, 1.0), ends);
} else {
// Draw with a fill to fill the edges of the shape.
surface->Stadium(rcBox, FillStroke(textBack, textFore, 1.0), ends);
@@ -1470,7 +1470,7 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi
DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText,
stAnnotation, start, lengthAnnotation, phase);
if ((FlagSet(phase, DrawPhase::back)) && (vsDraw.annotationVisible == ANNOTATION_BOXED)) {
- const ColourAlpha colourBorder = vsDraw.styles[vsDraw.annotationStyleOffset].fore;
+ const ColourRGBA colourBorder = vsDraw.styles[vsDraw.annotationStyleOffset].fore;
const PRectangle rcBorder = PixelAlignOutside(rcSegment, surface->PixelDivisions());
surface->FillRectangle(Side(rcBorder, Edge::left, 1), colourBorder);
surface->FillRectangle(Side(rcBorder, Edge::right, 1), colourBorder);
@@ -1485,7 +1485,7 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi
}
static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
- int subLine, int xStart, Sci::Position offset, Sci::Position posCaret, PRectangle rcCaret, ColourAlpha caretColour) {
+ int subLine, int xStart, Sci::Position offset, Sci::Position posCaret, PRectangle rcCaret, ColourRGBA caretColour) {
const Sci::Position lineStart = ll->LineStart(subLine);
Sci::Position posBefore = posCaret;
@@ -1642,7 +1642,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
rcCaret.right = rcCaret.left + vsDraw.caret.width;
}
const int elementCaret = mainCaret ? SC_ELEMENT_CARET : SC_ELEMENT_CARET_ADDITIONAL;
- const ColourAlpha caretColour = *vsDraw.ElementColour(elementCaret);
+ const ColourRGBA caretColour = *vsDraw.ElementColour(elementCaret);
//assert(caretColour.IsOpaque());
if (drawBlockCaret) {
DrawBlockCaret(surface, model, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour);
@@ -1657,7 +1657,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
}
static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll,
- int xStart, PRectangle rcLine, std::optional<ColourAlpha> background, DrawWrapMarkerFn customDrawWrapMarker,
+ int xStart, PRectangle rcLine, std::optional<ColourRGBA> background, DrawWrapMarkerFn customDrawWrapMarker,
bool caretActive) {
// default bgnd here..
surface->FillRectangleAligned(rcLine, Fill(background ? *background :
@@ -1692,7 +1692,7 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart,
- int subLine, std::optional<ColourAlpha> background) const {
+ int subLine, std::optional<ColourRGBA> background) const {
const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn();
bool inIndentation = subLine == 0; // Do not handle indentation except on first subline.
@@ -1725,7 +1725,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi
const InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc);
const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
- ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, inSelection,
+ ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection,
inHotspot, ll->styles[i], i);
if (ts.representation) {
if (ll->chars[i] == '\t') {
@@ -1821,7 +1821,7 @@ static void DrawTranslucentSelection(Surface *surface, const EditModel &model, c
for (size_t r = 0; r < model.sel.Count(); r++) {
const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange);
if (!portion.Empty()) {
- const ColourAlpha selectionBack = SelectionBackground(
+ const ColourRGBA selectionBack = SelectionBackground(
model, vsDraw, model.sel.RangeType(r));
const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth;
if (model.BidirectionalEnabled()) {
@@ -1903,7 +1903,7 @@ static void DrawTranslucentLineState(Surface *surface, const EditModel &model, c
void EditView::DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line lineVisible, PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart,
- int subLine, std::optional<ColourAlpha> background) {
+ int subLine, std::optional<ColourRGBA> background) {
const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn();
const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background;
@@ -1932,7 +1932,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
// draw strings that are completely past the right side of the window.
if (rcSegment.Intersects(rcLine)) {
const int styleMain = ll->styles[i];
- ColourAlpha textFore = vsDraw.styles[styleMain].fore;
+ ColourRGBA textFore = vsDraw.styles[styleMain].fore;
const Font *textFont = vsDraw.styles[styleMain].font.get();
// Hot-spot foreground
const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc);
@@ -1959,7 +1959,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
} else {
if (indicator.sacNormal.style == INDIC_TEXTFORE) {
if (indicator.Flags() & SC_INDICFLAG_VALUEFORE)
- textFore = ColourAlpha::FromRGB(indicatorValue & SC_INDICVALUEMASK);
+ textFore = ColourRGBA::FromRGB(indicatorValue & SC_INDICVALUEMASK);
else
textFore = indicator.sacNormal.fore;
}
@@ -1968,11 +1968,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
}
const InSelection inSelection = hideSelection ? InSelection::inNone : model.sel.CharacterInSelection(iDoc);
- const std::optional<ColourAlpha> selectionFore = SelectionForeground(model, vsDraw, inSelection);
+ const std::optional<ColourRGBA> selectionFore = SelectionForeground(model, vsDraw, inSelection);
if (selectionFore) {
textFore = *selectionFore;
}
- ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i);
+ ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i);
if (ts.representation) {
if (ll->chars[i] == '\t') {
// Tab display
@@ -1997,7 +1997,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
const PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight,
rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);
const int segmentTop = static_cast<int>(rcSegment.top) + vsDraw.lineHeight / 2;
- const ColourAlpha whiteSpaceFore = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(textFore);
+ const ColourRGBA whiteSpaceFore = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(textFore);
if (!customDrawTabArrow)
DrawTabArrow(surface, rcTab, segmentTop, vsDraw, Stroke(whiteSpaceFore, 1.0f));
else
@@ -2053,7 +2053,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f);
rcDot.right = rcDot.left + vsDraw.whitespaceSize;
rcDot.bottom = rcDot.top + vsDraw.whitespaceSize;
- const ColourAlpha whiteSpaceFore = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(textFore);
+ const ColourRGBA whiteSpaceFore = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(textFore);
surface->FillRectangleAligned(rcDot, Fill(whiteSpaceFore));
}
}
@@ -2157,7 +2157,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
}
// See if something overrides the line background colour.
- const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
+ const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
const Sci::Position posLineStart = model.pdoc->LineStart(line);
@@ -2461,7 +2461,7 @@ void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const
eolInSelection = model.LineEndInSelection(line);
}
- const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
+ const std::optional<ColourRGBA> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
if (eolInSelection && vsDraw.selection.eolFilled && (line < model.pdoc->LinesTotal() - 1) && (vsDraw.selection.layer == Layer::base)) {
surface->FillRectangleAligned(rcArea, Fill(SelectionBackground(model, vsDraw, eolInSelection).Opaque()));
@@ -2482,18 +2482,18 @@ void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const
// Space (3 space characters) between line numbers and text when printing.
#define lineNumberPrintSpace " "
-static ColourAlpha InvertedLight(ColourAlpha orig) noexcept {
+static ColourRGBA InvertedLight(ColourRGBA orig) noexcept {
unsigned int r = orig.GetRed();
unsigned int g = orig.GetGreen();
unsigned int b = orig.GetBlue();
const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye
const unsigned int il = 0xff - l;
if (l == 0)
- return ColourAlpha(0xff, 0xff, 0xff);
+ return ColourRGBA(0xff, 0xff, 0xff);
r = r * il / l;
g = g * il / l;
b = b * il / l;
- return ColourAlpha(std::min(r, 0xffu), std::min(g, 0xffu), std::min(b, 0xffu));
+ return ColourRGBA(std::min(r, 0xffu), std::min(g, 0xffu), std::min(b, 0xffu));
}
Sci::Position EditView::FormatRange(bool draw, const Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure,
@@ -2533,19 +2533,19 @@ Sci::Position EditView::FormatRange(bool draw, const Sci_RangeToFormat *pfr, Sur
vsPrint.styles[sty].fore = InvertedLight(vsPrint.styles[sty].fore);
vsPrint.styles[sty].back = InvertedLight(vsPrint.styles[sty].back);
} else if (printParameters.colourMode == SC_PRINT_BLACKONWHITE) {
- vsPrint.styles[sty].fore = ColourAlpha(0, 0, 0);
- vsPrint.styles[sty].back = ColourAlpha(0xff, 0xff, 0xff);
+ vsPrint.styles[sty].fore = ColourRGBA(0, 0, 0);
+ vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff);
} else if (printParameters.colourMode == SC_PRINT_COLOURONWHITE) {
- vsPrint.styles[sty].back = ColourAlpha(0xff, 0xff, 0xff);
+ vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff);
} else if (printParameters.colourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) {
if (sty <= STYLE_DEFAULT) {
- vsPrint.styles[sty].back = ColourAlpha(0xff, 0xff, 0xff);
+ vsPrint.styles[sty].back = ColourRGBA(0xff, 0xff, 0xff);
}
}
}
// White background for the line numbers if SC_PRINT_SCREENCOLOURS isn't used
if (printParameters.colourMode != SC_PRINT_SCREENCOLOURS)
- vsPrint.styles[STYLE_LINENUMBER].back = ColourAlpha(0xff, 0xff, 0xff);
+ vsPrint.styles[STYLE_LINENUMBER].back = ColourRGBA(0xff, 0xff, 0xff);
// Printing uses different margins, so reset screen margins
vsPrint.leftMarginWidth = 0;
diff --git a/src/EditView.h b/src/EditView.h
index bea42cbe9..f936a8a56 100644
--- a/src/EditView.h
+++ b/src/EditView.h
@@ -131,7 +131,7 @@ public:
void DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, XYPOSITION start, PRectangle rcSegment, bool highlight);
void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
Sci::Line line, Sci::Position lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
- std::optional<ColourAlpha> background);
+ std::optional<ColourRGBA> background);
void DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase);
void DrawEOLAnnotationText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
@@ -142,10 +142,10 @@ public:
int xStart, PRectangle rcLine, int subLine) const;
void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
Range lineRange, Sci::Position posLineStart, int xStart,
- int subLine, std::optional<ColourAlpha> background) const;
+ int subLine, std::optional<ColourRGBA> background) const;
void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line lineVisible,
PRectangle rcLine, Range lineRange, Sci::Position posLineStart, int xStart,
- int subLine, std::optional<ColourAlpha> background);
+ int subLine, std::optional<ColourRGBA> background);
void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line line, Sci::Line lineVisible, PRectangle rcLine, int xStart, int subLine);
void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line,
diff --git a/src/Editor.cxx b/src/Editor.cxx
index edcf946cc..fbda7a44e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5705,10 +5705,10 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
vs.EnsureStyle(wParam);
switch (iMessage) {
case SCI_STYLESETFORE:
- vs.styles[wParam].fore = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.styles[wParam].fore = ColourRGBA::FromRGB(static_cast<int>(lParam));
break;
case SCI_STYLESETBACK:
- vs.styles[wParam].back = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.styles[wParam].back = ColourRGBA::FromRGB(static_cast<int>(lParam));
break;
case SCI_STYLESETBOLD:
vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL;
@@ -6954,37 +6954,37 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_MARKERSETFORE:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].fore = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.markers[wParam].fore = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETBACK:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].back = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.markers[wParam].back = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETBACKSELECTED:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].backSelected = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.markers[wParam].backSelected = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETFORETRANSLUCENT:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].fore = ColourAlpha(static_cast<int>(lParam));
+ vs.markers[wParam].fore = ColourRGBA(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETBACKTRANSLUCENT:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].back = ColourAlpha(static_cast<int>(lParam));
+ vs.markers[wParam].back = ColourRGBA(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
case SCI_MARKERSETBACKSELECTEDTRANSLUCENT:
if (wParam <= MARKER_MAX)
- vs.markers[wParam].backSelected = ColourAlpha(static_cast<int>(lParam));
+ vs.markers[wParam].backSelected = ColourRGBA(static_cast<int>(lParam));
InvalidateStyleData();
RedrawSelMargin();
break;
@@ -7149,7 +7149,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SETMARGINBACKN:
if (ValidMargin(wParam)) {
- vs.ms[wParam].back = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.ms[wParam].back = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleRedraw();
}
break;
@@ -7214,13 +7214,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_SETELEMENTCOLOUR:
- if (vs.SetElementColour(static_cast<int>(wParam), ColourAlpha(static_cast<int>(lParam)))) {
+ if (vs.SetElementColour(static_cast<int>(wParam), ColourRGBA(static_cast<int>(lParam)))) {
InvalidateStyleRedraw();
}
break;
case SCI_GETELEMENTCOLOUR:
- return vs.ElementColour(static_cast<int>(wParam)).value_or(ColourAlpha()).AsInteger();
+ return vs.ElementColour(static_cast<int>(wParam)).value_or(ColourRGBA()).AsInteger();
case SCI_RESETELEMENTCOLOUR:
if (vs.ResetElement(static_cast<int>(wParam))) {
@@ -7235,7 +7235,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.ElementAllowsTranslucent(static_cast<int>(wParam));
case SCI_GETELEMENTBASECOLOUR:
- return vs.elementBaseColours[static_cast<int>(wParam)].value_or(ColourAlpha()).AsInteger();
+ return vs.elementBaseColours[static_cast<int>(wParam)].value_or(ColourRGBA()).AsInteger();
case SCI_SETFONTLOCALE:
if (lParam) {
@@ -7270,7 +7270,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SETCARETLINEVISIBLE:
if (wParam) {
if (!vs.elementColours.count(SC_ELEMENT_CARET_LINE_BACK)) {
- vs.elementColours[SC_ELEMENT_CARET_LINE_BACK] = ColourAlpha(0xFF, 0xFF, 0);
+ vs.elementColours[SC_ELEMENT_CARET_LINE_BACK] = ColourRGBA(0xFF, 0xFF, 0);
InvalidateStyleRedraw();
}
} else {
@@ -7317,7 +7317,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETCARETLINEBACKALPHA:
if (vs.caretLine.layer == Layer::base)
return SC_ALPHA_NOALPHA;
- return vs.ElementColour(SC_ELEMENT_CARET_LINE_BACK).value_or(ColourAlpha()).GetAlpha();
+ return vs.ElementColour(SC_ELEMENT_CARET_LINE_BACK).value_or(ColourRGBA()).GetAlpha();
case SCI_SETCARETLINEBACKALPHA: {
const Layer layerNew = (wParam == SC_ALPHA_NOALPHA) ? Layer::base : Layer::over;
@@ -7542,7 +7542,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return static_cast<sptr_t>(vs.selection.layer);
case SCI_SETCARETFORE:
- vs.elementColours[SC_ELEMENT_CARET] = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.elementColours[SC_ELEMENT_CARET] = ColourRGBA::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
@@ -7596,8 +7596,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICSETFORE:
if (wParam <= INDICATOR_MAX) {
- vs.indicators[wParam].sacNormal.fore = ColourAlpha::FromRGB(static_cast<int>(lParam));
- vs.indicators[wParam].sacHover.fore = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.indicators[wParam].sacNormal.fore = ColourRGBA::FromRGB(static_cast<int>(lParam));
+ vs.indicators[wParam].sacHover.fore = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleRedraw();
}
break;
@@ -7617,7 +7617,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICSETHOVERFORE:
if (wParam <= INDICATOR_MAX) {
- vs.indicators[wParam].sacHover.fore = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.indicators[wParam].sacHover.fore = ColourRGBA::FromRGB(static_cast<int>(lParam));
InvalidateStyleRedraw();
}
break;
@@ -7877,7 +7877,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.theEdge.colour.OpaqueRGB();
case SCI_SETEDGECOLOUR:
- vs.theEdge.colour = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.theEdge.colour = ColourRGBA::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
@@ -8127,7 +8127,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETHOTSPOTACTIVEFORE:
- return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE).value_or(ColourAlpha()).OpaqueRGB();
+ return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE).value_or(ColourRGBA()).OpaqueRGB();
case SCI_SETHOTSPOTACTIVEBACK:
if (vs.SetElementColourOptional(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK, wParam, lParam)) {
@@ -8136,7 +8136,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETHOTSPOTACTIVEBACK:
- return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK).value_or(ColourAlpha()).OpaqueRGB();
+ return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK).value_or(ColourRGBA()).OpaqueRGB();
case SCI_SETHOTSPOTACTIVEUNDERLINE:
vs.hotspotUnderline = wParam != 0;
@@ -8506,7 +8506,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return virtualSpaceOptions;
case SCI_SETADDITIONALSELFORE:
- vs.elementColours[SC_ELEMENT_SELECTION_ADDITIONAL_TEXT] = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.elementColours[SC_ELEMENT_SELECTION_ADDITIONAL_TEXT] = ColourRGBA::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
@@ -8526,7 +8526,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.ElementColour(SC_ELEMENT_SELECTION_ADDITIONAL_BACK)->GetAlpha();
case SCI_SETADDITIONALCARETFORE:
- vs.elementColours[SC_ELEMENT_CARET_ADDITIONAL] = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.elementColours[SC_ELEMENT_CARET_ADDITIONAL] = ColourRGBA::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
diff --git a/src/Geometry.h b/src/Geometry.h
index e28cf861e..40289dc89 100644
--- a/src/Geometry.h
+++ b/src/Geometry.h
@@ -165,33 +165,33 @@ PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept;
* Holds an RGBA colour with 8 bits for each component.
*/
constexpr const float componentMaximum = 255.0f;
-class ColourAlpha {
+class ColourRGBA {
int co;
constexpr static unsigned int Mixed(unsigned char a, unsigned char b, double proportion) noexcept {
return static_cast<unsigned int>(a + proportion * (b - a));
}
public:
- constexpr explicit ColourAlpha(int co_ = 0) noexcept : co(co_) {
+ constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) {
}
- constexpr ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=0xff) noexcept :
- ColourAlpha(red | (green << 8) | (blue << 16) | (alpha << 24)) {
+ constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=0xff) noexcept :
+ ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) {
}
- constexpr ColourAlpha(ColourAlpha cd, unsigned int alpha) noexcept :
- ColourAlpha(cd.OpaqueRGB() | (alpha << 24)) {
+ constexpr ColourRGBA(ColourRGBA cd, unsigned int alpha) noexcept :
+ ColourRGBA(cd.OpaqueRGB() | (alpha << 24)) {
}
- static constexpr ColourAlpha FromRGB(int co_) noexcept {
- return ColourAlpha(co_ | (0xffu << 24));
+ static constexpr ColourRGBA FromRGB(int co_) noexcept {
+ return ColourRGBA(co_ | (0xffu << 24));
}
- constexpr ColourAlpha WithoutAlpha() const noexcept {
- return ColourAlpha(co & 0xffffff);
+ constexpr ColourRGBA WithoutAlpha() const noexcept {
+ return ColourRGBA(co & 0xffffff);
}
- constexpr ColourAlpha Opaque() const noexcept {
- return ColourAlpha(co | (0xffu << 24));
+ constexpr ColourRGBA Opaque() const noexcept {
+ return ColourRGBA(co | (0xffu << 24));
}
constexpr int AsInteger() const noexcept {
@@ -230,7 +230,7 @@ public:
return GetAlpha() / componentMaximum;
}
- constexpr bool operator==(const ColourAlpha &other) const noexcept {
+ constexpr bool operator==(const ColourRGBA &other) const noexcept {
return co == other.co;
}
@@ -238,16 +238,16 @@ public:
return GetAlpha() == 0xff;
}
- constexpr ColourAlpha MixedWith(ColourAlpha other) const noexcept {
+ constexpr ColourRGBA MixedWith(ColourRGBA other) const noexcept {
const unsigned int red = (GetRed() + other.GetRed()) / 2;
const unsigned int green = (GetGreen() + other.GetGreen()) / 2;
const unsigned int blue = (GetBlue() + other.GetBlue()) / 2;
const unsigned int alpha = (GetAlpha() + other.GetAlpha()) / 2;
- return ColourAlpha(red, green, blue, alpha);
+ return ColourRGBA(red, green, blue, alpha);
}
- constexpr ColourAlpha MixedWith(ColourAlpha other, double proportion) const noexcept {
- return ColourAlpha(
+ constexpr ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept {
+ return ColourRGBA(
Mixed(GetRed(), other.GetRed(), proportion),
Mixed(GetGreen(), other.GetGreen(), proportion),
Mixed(GetBlue(), other.GetBlue(), proportion),
@@ -260,9 +260,9 @@ public:
*/
class Stroke {
public:
- ColourAlpha colour;
+ ColourRGBA colour;
XYPOSITION width;
- constexpr Stroke(ColourAlpha colour_, XYPOSITION width_=1.0) noexcept :
+ constexpr Stroke(ColourRGBA colour_, XYPOSITION width_=1.0) noexcept :
colour(colour_), width(width_) {
}
constexpr float WidthF() const noexcept {
@@ -275,8 +275,8 @@ public:
*/
class Fill {
public:
- ColourAlpha colour;
- constexpr Fill(ColourAlpha colour_) noexcept :
+ ColourRGBA colour;
+ constexpr Fill(ColourRGBA colour_) noexcept :
colour(colour_) {
}
};
@@ -288,10 +288,10 @@ class FillStroke {
public:
Fill fill;
Stroke stroke;
- constexpr FillStroke(ColourAlpha colourFill_, ColourAlpha colourStroke_, XYPOSITION widthStroke_=1.0) noexcept :
+ constexpr FillStroke(ColourRGBA colourFill_, ColourRGBA colourStroke_, XYPOSITION widthStroke_=1.0) noexcept :
fill(colourFill_), stroke(colourStroke_, widthStroke_) {
}
- constexpr FillStroke(ColourAlpha colourBoth, XYPOSITION widthStroke_=1.0) noexcept :
+ constexpr FillStroke(ColourRGBA colourBoth, XYPOSITION widthStroke_=1.0) noexcept :
fill(colourBoth), stroke(colourBoth, widthStroke_) {
}
};
@@ -302,8 +302,8 @@ public:
class ColourStop {
public:
XYPOSITION position;
- ColourAlpha colour;
- constexpr ColourStop(XYPOSITION position_, ColourAlpha colour_) noexcept :
+ ColourRGBA colour;
+ constexpr ColourStop(XYPOSITION position_, ColourRGBA colour_) noexcept :
position(position_), colour(colour_) {
}
};
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index e43027837..c93855af5 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -28,7 +28,7 @@ using namespace Scintilla;
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State state, int value) const {
StyleAndColour sacDraw = sacNormal;
if (Flags() & SC_INDICFLAG_VALUEFORE) {
- sacDraw.fore = ColourAlpha::FromRGB(value & SC_INDICVALUEMASK);
+ sacDraw.fore = ColourRGBA::FromRGB(value & SC_INDICVALUEMASK);
}
if (state == State::hover) {
sacDraw = sacHover;
@@ -80,13 +80,13 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
for (int x = 0; x < width; x++) {
if (x%2) {
// Two halfway columns have a full pixel in middle flanked by light pixels
- image.SetPixel(x, 0, ColourAlpha(sacDraw.fore, alphaSide));
- image.SetPixel(x, 1, ColourAlpha(sacDraw.fore, alphaFull));
- image.SetPixel(x, 2, ColourAlpha(sacDraw.fore, alphaSide));
+ image.SetPixel(x, 0, ColourRGBA(sacDraw.fore, alphaSide));
+ image.SetPixel(x, 1, ColourRGBA(sacDraw.fore, alphaFull));
+ image.SetPixel(x, 2, ColourRGBA(sacDraw.fore, alphaSide));
} else {
// Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre
- image.SetPixel(x, (x % 4) ? 0 : 2, ColourAlpha(sacDraw.fore, alphaFull));
- image.SetPixel(x, 1, ColourAlpha(sacDraw.fore, alphaSide2));
+ image.SetPixel(x, (x % 4) ? 0 : 2, ColourRGBA(sacDraw.fore, alphaFull));
+ image.SetPixel(x, 1, ColourRGBA(sacDraw.fore, alphaSide2));
}
}
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
@@ -161,7 +161,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
PRectangle rcBox = rcFullHeightAligned;
rcBox.top = rcBox.top + 1.0f;
rcBox.bottom = ymid + 1.0f;
- surface->RectangleFrame(rcBox, Stroke(ColourAlpha(sacDraw.fore, outlineAlpha), strokeWidth));
+ surface->RectangleFrame(rcBox, Stroke(ColourRGBA(sacDraw.fore, outlineAlpha), strokeWidth));
}
break;
@@ -172,7 +172,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
if (sacDraw.style != INDIC_FULLBOX)
rcBox.top = rcBox.top + 1;
surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1.0f : 0.0f,
- FillStroke(ColourAlpha(sacDraw.fore, fillAlpha), ColourAlpha(sacDraw.fore, outlineAlpha), strokeWidth));
+ FillStroke(ColourRGBA(sacDraw.fore, fillAlpha), ColourRGBA(sacDraw.fore, outlineAlpha), strokeWidth));
}
break;
@@ -181,8 +181,8 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
PRectangle rcBox = rcFullHeightAligned;
rcBox.top = rcBox.top + 1;
const Surface::GradientOptions options = Surface::GradientOptions::topToBottom;
- const ColourAlpha start(sacDraw.fore, fillAlpha);
- const ColourAlpha end(sacDraw.fore, 0);
+ const ColourRGBA start(sacDraw.fore, fillAlpha);
+ const ColourRGBA end(sacDraw.fore, 0);
std::vector<ColourStop> stops;
switch (sacDraw.style) {
case INDIC_GRADIENT:
@@ -209,13 +209,13 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
// Draw horizontal lines top and bottom
for (int x=0; x<width; x++) {
for (int y = 0; y< height; y += height - 1) {
- image.SetPixel(x, y, ColourAlpha(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
+ image.SetPixel(x, y, ColourRGBA(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
}
}
// Draw vertical lines left and right
for (int y = 1; y<height; y++) {
for (int x=0; x<width; x += width-1) {
- image.SetPixel(x, y, ColourAlpha(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
+ image.SetPixel(x, y, ColourRGBA(sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha));
}
}
surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
diff --git a/src/Indicator.h b/src/Indicator.h
index abceec061..11851476e 100644
--- a/src/Indicator.h
+++ b/src/Indicator.h
@@ -12,10 +12,10 @@ namespace Scintilla {
struct StyleAndColour {
int style;
- ColourAlpha fore;
+ ColourRGBA fore;
StyleAndColour() noexcept : style(INDIC_PLAIN), fore(0, 0, 0) {
}
- StyleAndColour(int style_, ColourAlpha fore_ = ColourAlpha(0, 0, 0)) noexcept : style(style_), fore(fore_) {
+ StyleAndColour(int style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) {
}
bool operator==(const StyleAndColour &other) const noexcept {
return (style == other.style) && (fore == other.fore);
@@ -36,7 +36,7 @@ public:
XYPOSITION strokeWidth = 1.0f;
Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) {
}
- Indicator(int style_, ColourAlpha fore_= ColourAlpha(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
+ Indicator(int style_, ColourRGBA fore_= ColourRGBA(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State drawState, int value) const;
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index a3ab16b1d..4b9037215 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -73,8 +73,8 @@ LineMarker &LineMarker::operator=(const LineMarker &other) {
return *this;
}
-ColourAlpha LineMarker::BackWithAlpha() const noexcept {
- return ColourAlpha(back, alpha);
+ColourRGBA LineMarker::BackWithAlpha() const noexcept {
+ return ColourRGBA(back, alpha);
}
void LineMarker::SetXPM(const char *textForm) {
@@ -98,7 +98,7 @@ enum class Expansion { Minus, Plus };
enum class Shape { Square, Circle };
void DrawSymbol(Surface *surface, Shape shape, Expansion expansion, PRectangle rcSymbol, XYPOSITION widthStroke,
- ColourAlpha colourFill, ColourAlpha colourFrame, ColourAlpha colourFrameRight, ColourAlpha colourExpansion) {
+ ColourRGBA colourFill, ColourRGBA colourFrame, ColourRGBA colourFrameRight, ColourRGBA colourExpansion) {
const FillStroke fillStroke(colourFill, colourFrame, widthStroke);
const PRectangle rcSymbolLeft = Side(rcSymbol, Edge::left, (rcSymbol.Width() + widthStroke) / 2.0f);
@@ -137,7 +137,7 @@ void DrawSymbol(Surface *surface, Shape shape, Expansion expansion, PRectangle r
}
}
-void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOSITION centreY, XYPOSITION widthSymbolStroke, ColourAlpha fill) {
+void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOSITION centreY, XYPOSITION widthSymbolStroke, ColourRGBA fill) {
const XYPOSITION slopeLength = 2.0f + widthSymbolStroke;
const XYPOSITION strokeTop = centreY + slopeLength;
const XYPOSITION halfWidth = widthSymbolStroke / 2.0f;
@@ -158,9 +158,9 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
// Assume: edges of rcWhole are integers.
// Code can only really handle integer strokeWidth.
- ColourAlpha colourHead = back;
- ColourAlpha colourBody = back;
- ColourAlpha colourTail = back;
+ ColourRGBA colourHead = back;
+ ColourRGBA colourBody = back;
+ ColourRGBA colourTail = back;
switch (part) {
case FoldPart::head:
@@ -258,11 +258,11 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
break;
case SC_MARK_BOXPLUSCONNECTED: {
- const ColourAlpha colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
+ const ColourRGBA colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
surface->FillRectangle(rcBelowSymbol, colourBelow);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourRGBA colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Square, Expansion::Plus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -278,7 +278,7 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
surface->FillRectangle(rcBelowSymbol, colourHead);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourRGBA colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Square, Expansion::Minus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -290,11 +290,11 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
break;
case SC_MARK_CIRCLEPLUSCONNECTED: {
- const ColourAlpha colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
+ const ColourRGBA colourBelow = (part == FoldPart::headWithTail) ? colourTail : colourBody;
surface->FillRectangle(rcBelowSymbol, colourBelow);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourRGBA colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Circle, Expansion::Plus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
@@ -309,7 +309,7 @@ void LineMarker::DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, Fo
case SC_MARK_CIRCLEMINUSCONNECTED: {
surface->FillRectangle(rcBelowSymbol, colourHead);
surface->FillRectangle(rcAboveSymbol, colourBody);
- const ColourAlpha colourRight = (part == FoldPart::body) ? colourTail : colourHead;
+ const ColourRGBA colourRight = (part == FoldPart::body) ? colourTail : colourHead;
DrawSymbol(surface, Shape::Circle, Expansion::Minus, rcSymbol, widthStroke,
fore, colourHead, colourRight, colourTail);
}
diff --git a/src/LineMarker.h b/src/LineMarker.h
index e0921b2b3..e0c4100a5 100644
--- a/src/LineMarker.h
+++ b/src/LineMarker.h
@@ -24,9 +24,9 @@ public:
enum class FoldPart { undefined, head, body, tail, headWithTail };
int markType = SC_MARK_CIRCLE;
- ColourAlpha fore = ColourAlpha(0, 0, 0);
- ColourAlpha back = ColourAlpha(0xff, 0xff, 0xff);
- ColourAlpha backSelected = ColourAlpha(0xff, 0x00, 0x00);
+ ColourRGBA fore = ColourRGBA(0, 0, 0);
+ ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff);
+ ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00);
Layer layer = Layer::base;
int alpha = SC_ALPHA_NOALPHA;
XYPOSITION strokeWidth = 1.0f;
@@ -45,7 +45,7 @@ public:
LineMarker &operator=(LineMarker&&) noexcept = default;
virtual ~LineMarker() = default;
- ColourAlpha BackWithAlpha() const noexcept;
+ ColourRGBA BackWithAlpha() const noexcept;
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 05e25bc13..0c2910a03 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -59,7 +59,7 @@ using namespace Scintilla;
namespace Scintilla {
void DrawWrapMarker(Surface *surface, PRectangle rcPlace,
- bool isEndMarker, ColourAlpha wrapColour) {
+ bool isEndMarker, ColourRGBA wrapColour) {
const XYPOSITION extraFinalPixel = surface->Supports(SC_SUPPORTS_LINE_DRAWS_FINAL) ? 0.0f : 1.0f;
@@ -132,10 +132,10 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw)
const PRectangle rcPattern = PRectangle::FromInts(0, 0, patternSize, patternSize);
// Initialize default colours based on the chrome colour scheme. Typically the highlight is white.
- ColourAlpha colourFMFill = vsDraw.selbar;
- ColourAlpha colourFMStripes = vsDraw.selbarlight;
+ ColourRGBA colourFMFill = vsDraw.selbar;
+ ColourRGBA colourFMStripes = vsDraw.selbarlight;
- if (!(vsDraw.selbarlight == ColourAlpha(0xff, 0xff, 0xff))) {
+ if (!(vsDraw.selbarlight == ColourRGBA(0xff, 0xff, 0xff))) {
// User has chosen an unusual chrome colour scheme so just use the highlight edge colour.
// (Typically, the highlight colour is white.)
colourFMFill = vsDraw.selbarlight;
@@ -195,7 +195,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc,
surface->FillRectangle(rcSelMargin,
invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1);
} else {
- ColourAlpha colour;
+ ColourRGBA colour;
switch (vs.ms[margin].style) {
case SC_MARGIN_BACK:
colour = vs.styles[STYLE_DEFAULT].back;
diff --git a/src/MarginView.h b/src/MarginView.h
index 9e52e533b..054765a02 100644
--- a/src/MarginView.h
+++ b/src/MarginView.h
@@ -10,9 +10,9 @@
namespace Scintilla {
-void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAlpha wrapColour);
+void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourRGBA wrapColour);
-typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAlpha wrapColour);
+typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourRGBA wrapColour);
/**
* MarginView draws the margins.
diff --git a/src/Platform.h b/src/Platform.h
index 2d14da96e..f279b80cd 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -225,15 +225,15 @@ public:
virtual std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) = 0;
- virtual void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
- virtual void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
- virtual void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) = 0;
+ virtual void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) = 0;
+ virtual void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) = 0;
+ virtual void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) = 0;
virtual void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) = 0;
virtual XYPOSITION WidthText(const Font *font_, std::string_view text) = 0;
- virtual void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
- virtual void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
- virtual void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) = 0;
+ virtual void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) = 0;
+ virtual void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) = 0;
+ virtual void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) = 0;
virtual void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) = 0;
virtual XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) = 0;
@@ -304,10 +304,10 @@ public:
};
struct ListOptions {
- std::optional<ColourAlpha> fore;
- std::optional<ColourAlpha> back;
- std::optional<ColourAlpha> foreSelected;
- std::optional<ColourAlpha> backSelected;
+ std::optional<ColourRGBA> fore;
+ std::optional<ColourRGBA> back;
+ std::optional<ColourRGBA> foreSelected;
+ std::optional<ColourRGBA> backSelected;
};
class ListBox : public Window {
@@ -357,8 +357,8 @@ public:
*/
namespace Platform {
-ColourAlpha Chrome();
-ColourAlpha ChromeHighlight();
+ColourRGBA Chrome();
+ColourRGBA ChromeHighlight();
const char *DefaultFont();
int DefaultFontSize();
unsigned int DoubleClickTime();
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index a82f3dc4c..4c1e9a803 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -1004,19 +1004,19 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
break;
case SCI_CALLTIPSETBACK:
- ct.colourBG = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ ct.colourBG = ColourRGBA::FromRGB(static_cast<int>(wParam));
vs.styles[STYLE_CALLTIP].back = ct.colourBG;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFORE:
- ct.colourUnSel = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ ct.colourUnSel = ColourRGBA::FromRGB(static_cast<int>(wParam));
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFOREHLT:
- ct.colourSel = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ ct.colourSel = ColourRGBA::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
diff --git a/src/Style.cxx b/src/Style.cxx
index 00cf698ab..5d926bf92 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -59,13 +59,13 @@ void FontMeasurements::ClearMeasurements() noexcept {
}
Style::Style() : FontSpecification() {
- Clear(ColourAlpha(0, 0, 0), ColourAlpha(0xff, 0xff, 0xff),
+ Clear(ColourRGBA(0, 0, 0), ColourRGBA(0xff, 0xff, 0xff),
Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, nullptr, SC_CHARSET_DEFAULT,
SC_WEIGHT_NORMAL, false, false, false, CaseForce::mixed, true, true, false);
}
Style::Style(const Style &source) noexcept : FontSpecification(), FontMeasurements() {
- Clear(ColourAlpha(0, 0, 0), ColourAlpha(0xff, 0xff, 0xff),
+ Clear(ColourRGBA(0, 0, 0), ColourRGBA(0xff, 0xff, 0xff),
0, nullptr, 0,
SC_WEIGHT_NORMAL, false, false, false, CaseForce::mixed, true, true, false);
fore = source.fore;
@@ -88,7 +88,7 @@ Style::~Style() = default;
Style &Style::operator=(const Style &source) noexcept {
if (this == &source)
return * this;
- Clear(ColourAlpha(0, 0, 0), ColourAlpha(0xff, 0xff, 0xff),
+ Clear(ColourRGBA(0, 0, 0), ColourRGBA(0xff, 0xff, 0xff),
0, nullptr, SC_CHARSET_DEFAULT,
SC_WEIGHT_NORMAL, false, false, false, CaseForce::mixed, true, true, false);
fore = source.fore;
@@ -106,7 +106,7 @@ Style &Style::operator=(const Style &source) noexcept {
return *this;
}
-void Style::Clear(ColourAlpha fore_, ColourAlpha back_, int size_,
+void Style::Clear(ColourRGBA fore_, ColourRGBA back_, int size_,
const char *fontName_, int characterSet_,
int weight_, bool italic_, bool eolFilled_,
bool underline_, CaseForce caseForce_,
diff --git a/src/Style.h b/src/Style.h
index 8f9b1d334..cee63aa9e 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -44,8 +44,8 @@ struct FontMeasurements {
*/
class Style : public FontSpecification, public FontMeasurements {
public:
- ColourAlpha fore;
- ColourAlpha back;
+ ColourRGBA fore;
+ ColourRGBA back;
bool eolFilled;
bool underline;
enum class CaseForce {mixed, upper, lower, camel};
@@ -62,7 +62,7 @@ public:
~Style();
Style &operator=(const Style &source) noexcept;
Style &operator=(Style &&) = delete;
- void Clear(ColourAlpha fore_, ColourAlpha back_,
+ void Clear(ColourRGBA fore_, ColourRGBA back_,
int size_,
const char *fontName_, int characterSet_,
int weight_, bool italic_, bool eolFilled_,
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 4e88d9116..518ca3bde 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -179,9 +179,9 @@ void ViewStyle::Init(size_t stylesSize_) {
// There are no image markers by default, so no need for calling CalcLargestMarkerHeight()
largestMarkerHeight = 0;
- indicators[0] = Indicator(INDIC_SQUIGGLE, ColourAlpha(0, 0x7f, 0));
- indicators[1] = Indicator(INDIC_TT, ColourAlpha(0, 0, 0xff));
- indicators[2] = Indicator(INDIC_PLAIN, ColourAlpha(0xff, 0, 0));
+ indicators[0] = Indicator(INDIC_SQUIGGLE, ColourRGBA(0, 0x7f, 0));
+ indicators[1] = Indicator(INDIC_TT, ColourRGBA(0, 0, 0xff));
+ indicators[2] = Indicator(INDIC_PLAIN, ColourRGBA(0xff, 0, 0));
technology = SC_TECHNOLOGY_DEFAULT;
indicatorsDynamic = false;
@@ -200,10 +200,10 @@ void ViewStyle::Init(size_t stylesSize_) {
elementColours.erase(SC_ELEMENT_SELECTION_SECONDARY_TEXT);
elementColours.erase(SC_ELEMENT_SELECTION_NO_FOCUS_TEXT);
// Shades of grey for selection backgrounds
- elementBaseColours[SC_ELEMENT_SELECTION_BACK] = ColourAlpha(0xc0, 0xc0, 0xc0, 0xff);
- elementBaseColours[SC_ELEMENT_SELECTION_ADDITIONAL_BACK] = ColourAlpha(0xd7, 0xd7, 0xd7, 0xff);
- elementBaseColours[SC_ELEMENT_SELECTION_SECONDARY_BACK] = ColourAlpha(0xb0, 0xb0, 0xb0, 0xff);
- elementBaseColours[SC_ELEMENT_SELECTION_NO_FOCUS_BACK] = ColourAlpha(0x80, 0x80, 0x80, 0x3f);
+ elementBaseColours[SC_ELEMENT_SELECTION_BACK] = ColourRGBA(0xc0, 0xc0, 0xc0, 0xff);
+ elementBaseColours[SC_ELEMENT_SELECTION_ADDITIONAL_BACK] = ColourRGBA(0xd7, 0xd7, 0xd7, 0xff);
+ elementBaseColours[SC_ELEMENT_SELECTION_SECONDARY_BACK] = ColourRGBA(0xb0, 0xb0, 0xb0, 0xff);
+ elementBaseColours[SC_ELEMENT_SELECTION_NO_FOCUS_BACK] = ColourRGBA(0x80, 0x80, 0x80, 0x3f);
elementAllowsTranslucent.insert({
SC_ELEMENT_SELECTION_TEXT,
SC_ELEMENT_SELECTION_BACK,
@@ -225,11 +225,11 @@ void ViewStyle::Init(size_t stylesSize_) {
controlCharWidth = 0;
selbar = Platform::Chrome();
selbarlight = Platform::ChromeHighlight();
- styles[STYLE_LINENUMBER].fore = ColourAlpha(0, 0, 0);
+ styles[STYLE_LINENUMBER].fore = ColourRGBA(0, 0, 0);
styles[STYLE_LINENUMBER].back = Platform::Chrome();
- elementBaseColours[SC_ELEMENT_CARET] = ColourAlpha(0, 0, 0);
- elementBaseColours[SC_ELEMENT_CARET_ADDITIONAL] = ColourAlpha(0x7f, 0x7f, 0x7f);
+ elementBaseColours[SC_ELEMENT_CARET] = ColourRGBA(0, 0, 0);
+ elementBaseColours[SC_ELEMENT_CARET_ADDITIONAL] = ColourRGBA(0x7f, 0x7f, 0x7f);
elementAllowsTranslucent.insert({
SC_ELEMENT_CARET,
SC_ELEMENT_CARET_ADDITIONAL,
@@ -282,7 +282,7 @@ void ViewStyle::Init(size_t stylesSize_) {
braceBadLightIndicator = 0;
edgeState = EDGE_NONE;
- theEdge = EdgeProperties(0, ColourAlpha(0xc0, 0xc0, 0xc0));
+ theEdge = EdgeProperties(0, ColourRGBA(0xc0, 0xc0, 0xc0));
marginNumberPadding = 3;
ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
@@ -384,8 +384,8 @@ void ViewStyle::EnsureStyle(size_t index) {
}
void ViewStyle::ResetDefaultStyle() {
- styles[STYLE_DEFAULT].Clear(ColourAlpha(0,0,0),
- ColourAlpha(0xff,0xff,0xff),
+ styles[STYLE_DEFAULT].Clear(ColourRGBA(0,0,0),
+ ColourRGBA(0xff,0xff,0xff),
Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()),
SC_CHARSET_DEFAULT,
SC_WEIGHT_NORMAL, false, false, false, Style::CaseForce::mixed, true, true, false);
@@ -401,8 +401,8 @@ void ViewStyle::ClearStyles() {
styles[STYLE_LINENUMBER].back = Platform::Chrome();
// Set call tip fore/back to match the values previously set for call tips
- styles[STYLE_CALLTIP].back = ColourAlpha(0xff, 0xff, 0xff);
- styles[STYLE_CALLTIP].fore = ColourAlpha(0x80, 0x80, 0x80);
+ styles[STYLE_CALLTIP].back = ColourRGBA(0xff, 0xff, 0xff);
+ styles[STYLE_CALLTIP].fore = ColourRGBA(0x80, 0x80, 0x80);
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
@@ -470,8 +470,8 @@ bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) cons
// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order
// with the earlier taking precedence. When multiple markers cause background override,
// the colour for the highest numbered one is used.
-std::optional<ColourAlpha> ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
- std::optional<ColourAlpha> background;
+std::optional<ColourRGBA> ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
+ std::optional<ColourRGBA> background;
if (!caretLine.frame && (caretActive || caretLine.alwaysShow) &&
(caretLine.layer == Layer::base) && lineContainsCaret) {
background = ElementColour(SC_ELEMENT_CARET_LINE_BACK);
@@ -527,7 +527,7 @@ bool ViewStyle::WhiteSpaceVisible(bool inIndent) const noexcept {
viewWhitespace == WhiteSpace::visibleAlways;
}
-ColourAlpha ViewStyle::WrapColour() const {
+ColourRGBA ViewStyle::WrapColour() const {
return ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(styles[STYLE_DEFAULT].fore);
}
@@ -542,7 +542,7 @@ void ViewStyle::AddMultiEdge(uptr_t wParam, sptr_t lParam) {
EdgeProperties(column, lParam));
}
-std::optional<ColourAlpha> ViewStyle::ElementColour(int element) const {
+std::optional<ColourRGBA> ViewStyle::ElementColour(int element) const {
ElementMap::const_iterator search = elementColours.find(element);
if (search != elementColours.end()) {
if (search->second.has_value()) {
@@ -569,7 +569,7 @@ bool ViewStyle::ResetElement(int element) {
return changed;
}
-bool ViewStyle::SetElementColour(int element, ColourAlpha colour) {
+bool ViewStyle::SetElementColour(int element, ColourRGBA colour) {
ElementMap::const_iterator search = elementColours.find(element);
const bool changed =
(search == elementColours.end()) ||
@@ -580,20 +580,20 @@ bool ViewStyle::SetElementColour(int element, ColourAlpha colour) {
bool ViewStyle::SetElementColourOptional(int element, uptr_t wParam, sptr_t lParam) {
if (wParam) {
- return SetElementColour(element, ColourAlpha::FromRGB(static_cast<int>(lParam)));
+ return SetElementColour(element, ColourRGBA::FromRGB(static_cast<int>(lParam)));
} else {
return ResetElement(element);
}
}
void ViewStyle::SetElementRGB(int element, int rgb) {
- const ColourAlpha current = ElementColour(element).value_or(ColourAlpha(0, 0, 0, 0));
- elementColours[element] = ColourAlpha(ColourAlpha(rgb), current.GetAlpha());
+ const ColourRGBA current = ElementColour(element).value_or(ColourRGBA(0, 0, 0, 0));
+ elementColours[element] = ColourRGBA(ColourRGBA(rgb), current.GetAlpha());
}
void ViewStyle::SetElementAlpha(int element, int alpha) {
- const ColourAlpha current = ElementColour(element).value_or(ColourAlpha(0, 0, 0, 0));
- elementColours[element] = ColourAlpha(current, std::min(alpha, 0xff));
+ const ColourRGBA current = ElementColour(element).value_or(ColourRGBA(0, 0, 0, 0));
+ elementColours[element] = ColourRGBA(current, std::min(alpha, 0xff));
}
bool ViewStyle::ElementIsSet(int element) const {
@@ -604,7 +604,7 @@ bool ViewStyle::ElementIsSet(int element) const {
return false;
}
-bool ViewStyle::SetElementBase(int element, ColourAlpha colour) {
+bool ViewStyle::SetElementBase(int element, ColourRGBA colour) {
ElementMap::const_iterator search = elementBaseColours.find(element);
const bool changed =
(search == elementBaseColours.end()) ||
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 524699590..609afdcc4 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -15,7 +15,7 @@ namespace Scintilla {
class MarginStyle {
public:
int style;
- ColourAlpha back;
+ ColourRGBA back;
int width;
int mask;
bool sensitive;
@@ -50,9 +50,9 @@ typedef std::map<FontSpecification, std::unique_ptr<FontRealised>> FontMap;
enum class WrapMode { none, word, character, whitespace };
-inline std::optional<ColourAlpha> OptionalColour(uptr_t wParam, sptr_t lParam) {
+inline std::optional<ColourRGBA> OptionalColour(uptr_t wParam, sptr_t lParam) {
if (wParam) {
- return ColourAlpha::FromRGB(static_cast<int>(lParam));
+ return ColourRGBA::FromRGB(static_cast<int>(lParam));
} else {
return {};
}
@@ -96,12 +96,12 @@ struct WrapAppearance {
struct EdgeProperties {
int column = 0;
- ColourAlpha colour;
- EdgeProperties(int column_ = 0, ColourAlpha colour_ = ColourAlpha::FromRGB(0)) noexcept :
+ ColourRGBA colour;
+ EdgeProperties(int column_ = 0, ColourRGBA colour_ = ColourRGBA::FromRGB(0)) noexcept :
column(column_), colour(colour_) {
}
EdgeProperties(uptr_t wParam, sptr_t lParam) noexcept :
- column(static_cast<int>(wParam)), colour(ColourAlpha::FromRGB(static_cast<int>(lParam))) {
+ column(static_cast<int>(wParam)), colour(ColourRGBA::FromRGB(static_cast<int>(lParam))) {
}
};
@@ -131,10 +131,10 @@ public:
int controlCharSymbol;
XYPOSITION controlCharWidth;
- ColourAlpha selbar;
- ColourAlpha selbarlight;
- std::optional<ColourAlpha> foldmarginColour;
- std::optional<ColourAlpha> foldmarginHighlightColour;
+ ColourRGBA selbar;
+ ColourRGBA selbarlight;
+ std::optional<ColourRGBA> foldmarginColour;
+ std::optional<ColourRGBA> foldmarginHighlightColour;
bool hotspotUnderline;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
int leftMarginWidth; ///< Spacing margin on left of text
@@ -177,7 +177,7 @@ public:
int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
- using ElementMap = std::map<int, std::optional<ColourAlpha>>;
+ using ElementMap = std::map<int, std::optional<ColourRGBA>>;
ElementMap elementColours;
ElementMap elementBaseColours;
std::set<int> elementAllowsTranslucent;
@@ -210,23 +210,23 @@ public:
void CalcLargestMarkerHeight() noexcept;
int GetFrameWidth() const noexcept;
bool IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const;
- std::optional<ColourAlpha> Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
+ std::optional<ColourRGBA> Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const;
bool SelectionBackgroundDrawn() const noexcept;
bool SelectionTextDrawn() const;
bool WhitespaceBackgroundDrawn() const;
- ColourAlpha WrapColour() const;
+ ColourRGBA WrapColour() const;
void AddMultiEdge(uptr_t wParam, sptr_t lParam);
- std::optional<ColourAlpha> ElementColour(int element) const;
+ std::optional<ColourRGBA> ElementColour(int element) const;
bool ElementAllowsTranslucent(int element) const;
bool ResetElement(int element);
- bool SetElementColour(int element, ColourAlpha colour);
+ bool SetElementColour(int element, ColourRGBA colour);
bool SetElementColourOptional(int element, uptr_t wParam, sptr_t lParam);
void SetElementRGB(int element, int rgb);
void SetElementAlpha(int element, int alpha);
bool ElementIsSet(int element) const;
- bool SetElementBase(int element, ColourAlpha colour);
+ bool SetElementBase(int element, ColourRGBA colour);
bool SetWrapState(int wrapState_) noexcept;
bool SetWrapVisualFlags(int wrapVisualFlags_) noexcept;
diff --git a/src/XPM.cxx b/src/XPM.cxx
index ef2ba961a..ca4804e5d 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -60,17 +60,17 @@ unsigned int ValueOfHex(const char ch) noexcept {
return 0;
}
-ColourAlpha ColourFromHex(const char *val) noexcept {
+ColourRGBA ColourFromHex(const char *val) noexcept {
const unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]);
const unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]);
const unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]);
- return ColourAlpha(r, g, b);
+ return ColourRGBA(r, g, b);
}
}
-ColourAlpha XPM::ColourFromCode(int ch) const noexcept {
+ColourRGBA XPM::ColourFromCode(int ch) const noexcept {
return colourCodeTable[ch];
}
@@ -116,7 +116,7 @@ void XPM::Init(const char *const *linesForm) {
if (!linesForm)
return;
- std::fill(colourCodeTable, std::end(colourCodeTable), ColourAlpha(0, 0, 0));
+ std::fill(colourCodeTable, std::end(colourCodeTable), ColourRGBA(0, 0, 0));
const char *line0 = linesForm[0];
width = atoi(line0);
line0 = NextField(line0);
@@ -134,7 +134,7 @@ void XPM::Init(const char *const *linesForm) {
const char *colourDef = linesForm[c+1];
const char code = colourDef[0];
colourDef += 4;
- ColourAlpha colour(0, 0, 0, 0);
+ ColourRGBA colour(0, 0, 0, 0);
if (*colourDef == '#') {
colour = ColourFromHex(colourDef+1);
} else {
@@ -173,10 +173,10 @@ void XPM::Draw(Surface *surface, const PRectangle &rc) {
}
}
-ColourAlpha XPM::PixelAt(int x, int y) const noexcept {
+ColourRGBA XPM::PixelAt(int x, int y) const noexcept {
if (pixels.empty() || (x < 0) || (x >= width) || (y < 0) || (y >= height)) {
// Out of bounds -> transparent black
- return ColourAlpha(0, 0, 0, 0);
+ return ColourRGBA(0, 0, 0, 0);
}
const int code = pixels[y * width + x];
return ColourFromCode(code);
@@ -249,7 +249,7 @@ const unsigned char *RGBAImage::Pixels() const noexcept {
return &pixelBytes[0];
}
-void RGBAImage::SetPixel(int x, int y, ColourAlpha colour) noexcept {
+void RGBAImage::SetPixel(int x, int y, ColourRGBA colour) noexcept {
unsigned char *pixel = &pixelBytes[0] + (y * width + x) * 4;
// RGBA
pixel[0] = colour.GetRed();
diff --git a/src/XPM.h b/src/XPM.h
index 3f7b66b9a..dc0468c1d 100644
--- a/src/XPM.h
+++ b/src/XPM.h
@@ -18,9 +18,9 @@ class XPM {
int width=1;
int nColours=1;
std::vector<unsigned char> pixels;
- ColourAlpha colourCodeTable[256];
+ ColourRGBA colourCodeTable[256];
char codeTransparent=' ';
- ColourAlpha ColourFromCode(int ch) const noexcept;
+ ColourRGBA ColourFromCode(int ch) const noexcept;
void FillRun(Surface *surface, int code, int startX, int y, int x) const;
public:
explicit XPM(const char *textForm);
@@ -36,7 +36,7 @@ public:
void Draw(Surface *surface, const PRectangle &rc);
int GetHeight() const noexcept { return height; }
int GetWidth() const noexcept { return width; }
- ColourAlpha PixelAt(int x, int y) const noexcept;
+ ColourRGBA PixelAt(int x, int y) const noexcept;
private:
static std::vector<const char *>LinesFormFromTextForm(const char *textForm);
};
@@ -65,7 +65,7 @@ public:
float GetScaledWidth() const noexcept { return width / scale; }
int CountBytes() const noexcept;
const unsigned char *Pixels() const noexcept;
- void SetPixel(int x, int y, ColourAlpha colour) noexcept;
+ void SetPixel(int x, int y, ColourRGBA colour) noexcept;
static void BGRAFromRGBA(unsigned char *pixelsBGRA, const unsigned char *pixelsRGBA, size_t count) noexcept;
};
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8fb415675..8aaf610f6 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -468,9 +468,9 @@ class SurfaceGDI : public Surface {
// There appears to be a 16 bit string length limit in GDI on NT.
int maxLenText = 65535;
- void PenColour(ColourAlpha fore, XYPOSITION widthStroke) noexcept;
+ void PenColour(ColourRGBA fore, XYPOSITION widthStroke) noexcept;
- void BrushColour(ColourAlpha back) noexcept;
+ void BrushColour(ColourRGBA back) noexcept;
void SetFont(const Font *font_);
void Clear() noexcept;
@@ -516,16 +516,16 @@ public:
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, UINT fuOptions);
- void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthText(const Font *font_, std::string_view text) override;
void DrawTextCommonUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, UINT fuOptions);
- void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override;
@@ -630,7 +630,7 @@ void SurfaceGDI::SetMode(SurfaceMode mode_) {
mode = mode_;
}
-void SurfaceGDI::PenColour(ColourAlpha fore, XYPOSITION widthStroke) noexcept {
+void SurfaceGDI::PenColour(ColourRGBA fore, XYPOSITION widthStroke) noexcept {
if (pen) {
::SelectObject(hdc, penOld);
::DeleteObject(pen);
@@ -652,7 +652,7 @@ void SurfaceGDI::PenColour(ColourAlpha fore, XYPOSITION widthStroke) noexcept {
penOld = SelectPen(hdc, pen);
}
-void SurfaceGDI::BrushColour(ColourAlpha back) noexcept {
+void SurfaceGDI::BrushColour(ColourRGBA back) noexcept {
if (brush) {
::SelectObject(hdc, brushOld);
::DeleteObject(brush);
@@ -773,7 +773,7 @@ constexpr byte AlphaScaled(unsigned char component, unsigned int alpha) noexcept
return static_cast<byte>(component * alpha / 255);
}
-constexpr DWORD dwordMultiplied(ColourAlpha colour) noexcept {
+constexpr DWORD dwordMultiplied(ColourRGBA colour) noexcept {
return dwordFromBGRA(
AlphaScaled(colour.GetBlue(), colour.GetAlpha()),
AlphaScaled(colour.GetGreen(), colour.GetAlpha()),
@@ -866,15 +866,15 @@ constexpr unsigned int Proportional(unsigned char a, unsigned char b, XYPOSITION
return static_cast<unsigned int>(a + t * (b - a));
}
-ColourAlpha Proportional(ColourAlpha a, ColourAlpha b, XYPOSITION t) noexcept {
- return ColourAlpha(
+ColourRGBA Proportional(ColourRGBA a, ColourRGBA b, XYPOSITION t) noexcept {
+ return ColourRGBA(
Proportional(a.GetRed(), b.GetRed(), t),
Proportional(a.GetGreen(), b.GetGreen(), t),
Proportional(a.GetBlue(), b.GetBlue(), t),
Proportional(a.GetAlpha(), b.GetAlpha(), t));
}
-ColourAlpha GradientValue(const std::vector<ColourStop> &stops, XYPOSITION proportion) noexcept {
+ColourRGBA GradientValue(const std::vector<ColourStop> &stops, XYPOSITION proportion) noexcept {
for (size_t stop = 0; stop < stops.size() - 1; stop++) {
// Loop through each pair of stops
const XYPOSITION positionStart = stops[stop].position;
@@ -886,7 +886,7 @@ ColourAlpha GradientValue(const std::vector<ColourStop> &stops, XYPOSITION propo
}
}
// Loop should always find a value
- return ColourAlpha();
+ return ColourRGBA();
}
constexpr SIZE SizeOfRect(RECT rc) noexcept {
@@ -959,7 +959,7 @@ void SurfaceGDI::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
for (LONG y = 0; y < size.cy; y++) {
// Find y/height proportional colour
const XYPOSITION proportion = y / (rc.Height() - 1.0f);
- const ColourAlpha mixed = GradientValue(stops, proportion);
+ const ColourRGBA mixed = GradientValue(stops, proportion);
const DWORD valFill = dwordMultiplied(mixed);
for (LONG x = 0; x < size.cx; x++) {
section.SetPixel(x, y, valFill);
@@ -969,7 +969,7 @@ void SurfaceGDI::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
for (LONG x = 0; x < size.cx; x++) {
// Find x/width proportional colour
const XYPOSITION proportion = x / (rc.Width() - 1.0f);
- const ColourAlpha mixed = GradientValue(stops, proportion);
+ const ColourRGBA mixed = GradientValue(stops, proportion);
const DWORD valFill = dwordMultiplied(mixed);
for (LONG y = 0; y < size.cy; y++) {
section.SetPixel(x, y, valFill);
@@ -1042,21 +1042,21 @@ void SurfaceGDI::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION yba
}
void SurfaceGDI::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
::SetTextColor(hdc, fore.OpaqueRGB());
::SetBkColor(hdc, back.OpaqueRGB());
DrawTextCommon(rc, font_, ybase, text, ETO_OPAQUE);
}
void SurfaceGDI::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
::SetTextColor(hdc, fore.OpaqueRGB());
::SetBkColor(hdc, back.OpaqueRGB());
DrawTextCommon(rc, font_, ybase, text, ETO_OPAQUE | ETO_CLIPPED);
}
void SurfaceGDI::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (const char ch : text) {
if (ch != ' ') {
@@ -1134,21 +1134,21 @@ void SurfaceGDI::DrawTextCommonUTF8(PRectangle rc, const Font *font_, XYPOSITION
}
void SurfaceGDI::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
::SetTextColor(hdc, fore.OpaqueRGB());
::SetBkColor(hdc, back.OpaqueRGB());
DrawTextCommonUTF8(rc, font_, ybase, text, ETO_OPAQUE);
}
void SurfaceGDI::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
::SetTextColor(hdc, fore.OpaqueRGB());
::SetBkColor(hdc, back.OpaqueRGB());
DrawTextCommonUTF8(rc, font_, ybase, text, ETO_OPAQUE | ETO_CLIPPED);
}
void SurfaceGDI::DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (const char ch : text) {
if (ch != ' ') {
@@ -1276,7 +1276,7 @@ const int SupportsD2D[] = {
SC_SUPPORTS_PIXEL_MODIFICATION,
};
-constexpr D2D_COLOR_F ColorFromColourAlpha(ColourAlpha colour) noexcept {
+constexpr D2D_COLOR_F ColorFromColourAlpha(ColourRGBA colour) noexcept {
return D2D_COLOR_F{
colour.GetRedComponent(),
colour.GetGreenComponent(),
@@ -1341,7 +1341,7 @@ public:
int Supports(int feature) noexcept override;
bool Initialised() override;
- void D2DPenColourAlpha(ColourAlpha fore) noexcept;
+ void D2DPenColourAlpha(ColourRGBA fore) noexcept;
int LogPixelsY() override;
int PixelDivisions() override;
int DeviceHeightFont(int points) override;
@@ -1366,15 +1366,15 @@ public:
void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions);
- void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthText(const Font *font_, std::string_view text) override;
- void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override;
- void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) override;
+ void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore, ColourRGBA back) override;
+ void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourRGBA fore) override;
void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override;
@@ -1478,7 +1478,7 @@ HRESULT SurfaceD2D::GetBitmap(ID2D1Bitmap **ppBitmap) {
return pBitmapRenderTarget->GetBitmap(ppBitmap);
}
-void SurfaceD2D::D2DPenColourAlpha(ColourAlpha fore) noexcept {
+void SurfaceD2D::D2DPenColourAlpha(ColourRGBA fore) noexcept {
if (pRenderTarget) {
const D2D_COLOR_F col = ColorFromColourAlpha(fore);
if (pBrush) {
@@ -2356,7 +2356,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION yba
}
void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
if (pRenderTarget) {
FillRectangleAligned(rc, back);
D2DPenColourAlpha(fore);
@@ -2365,7 +2365,7 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yba
}
void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
if (pRenderTarget) {
FillRectangleAligned(rc, back);
D2DPenColourAlpha(fore);
@@ -2374,7 +2374,7 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION yb
}
void SurfaceD2D::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (const char ch : text) {
if (ch != ' ') {
@@ -2483,7 +2483,7 @@ XYPOSITION SurfaceD2D::WidthText(const Font *font_, std::string_view text) {
}
void SurfaceD2D::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
if (pRenderTarget) {
FillRectangleAligned(rc, back);
D2DPenColourAlpha(fore);
@@ -2492,7 +2492,7 @@ void SurfaceD2D::DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION
}
void SurfaceD2D::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore, ColourAlpha back) {
+ ColourRGBA fore, ColourRGBA back) {
if (pRenderTarget) {
FillRectangleAligned(rc, back);
D2DPenColourAlpha(fore);
@@ -2501,7 +2501,7 @@ void SurfaceD2D::DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITIO
}
void SurfaceD2D::DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text,
- ColourAlpha fore) {
+ ColourRGBA fore) {
// Avoid drawing spaces in transparent mode
for (const char ch : text) {
if (ch != ' ') {
@@ -3158,7 +3158,7 @@ void ListBoxX::ClearRegisteredImages() {
namespace {
-int ColourOfElement(std::optional<ColourAlpha> colour, int nIndex) {
+int ColourOfElement(std::optional<ColourRGBA> colour, int nIndex) {
if (colour.has_value()) {
return colour.value().OpaqueRGB();
} else {
@@ -3811,12 +3811,12 @@ void Menu::Show(Point pt, const Window &w) {
Destroy();
}
-ColourAlpha Platform::Chrome() {
- return ColourAlpha::FromRGB(::GetSysColor(COLOR_3DFACE));
+ColourRGBA Platform::Chrome() {
+ return ColourRGBA::FromRGB(::GetSysColor(COLOR_3DFACE));
}
-ColourAlpha Platform::ChromeHighlight() {
- return ColourAlpha::FromRGB(::GetSysColor(COLOR_3DHIGHLIGHT));
+ColourRGBA Platform::ChromeHighlight() {
+ return ColourRGBA::FromRGB(::GetSysColor(COLOR_3DHIGHLIGHT));
}
const char *Platform::DefaultFont() {
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 810682df4..c6782721f 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -589,10 +589,10 @@ void ScintillaWin::Init() {
HMODULE user32 = ::GetModuleHandleW(L"user32.dll");
SetCoalescableTimerFn = DLLFunction<SetCoalescableTimerSig>(user32, "SetCoalescableTimer");
- vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourAlpha(0, 0, 0xff));
- vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourAlpha(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourRGBA(0, 0, 0xff));
+ vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourRGBA(0, 0, 0xff));
}
void ScintillaWin::Finalise() {
@@ -2183,7 +2183,7 @@ void ScintillaWin::UpdateBaseElements() {
};
bool changed = false;
for (const ElementToIndex &ei : eti) {
- changed = vs.SetElementBase(ei.element, ColourAlpha::FromRGB(::GetSysColor(ei.nIndex))) || changed;
+ changed = vs.SetElementBase(ei.element, ColourRGBA::FromRGB(::GetSysColor(ei.nIndex))) || changed;
}
if (changed) {
Redraw();