aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-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
20 files changed, 228 insertions, 228 deletions
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;
};