diff options
Diffstat (limited to 'cocoa')
| -rw-r--r-- | cocoa/PlatCocoa.h | 24 | ||||
| -rw-r--r-- | cocoa/PlatCocoa.mm | 28 | ||||
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 14 |
3 files changed, 33 insertions, 33 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; } } |
