aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-25 09:20:08 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-25 09:20:08 +1100
commit20bb1c7c0f6931819745d9756ab14246c20c4e9f (patch)
treef7e10e6097b99c44a03a246b07eda940581445cd /cocoa/PlatCocoa.mm
parentd3deaacf51e0d459c8025d6a411acf0bc8b17945 (diff)
downloadscintilla-mirror-20bb1c7c0f6931819745d9756ab14246c20c4e9f.tar.gz
Implement translucent FillRectangle.
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index f84a335aa..a4f01c5c6 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -479,6 +479,17 @@ void SurfaceImpl::PenColour(ColourDesired fore) {
//--------------------------------------------------------------------------------------------------
+void SurfaceImpl::FillColour(ColourAlpha fill) {
+ // Set the Fill color to match
+ CGContextSetRGBFillColor(gc,
+ fill.GetRedComponent(),
+ fill.GetGreenComponent(),
+ fill.GetBlueComponent(),
+ fill.GetAlphaComponent());
+}
+
+//--------------------------------------------------------------------------------------------------
+
void SurfaceImpl::FillColour(const ColourDesired &back) {
if (gc) {
ColourDesired colour(back.AsInteger());
@@ -662,6 +673,16 @@ void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) {
//--------------------------------------------------------------------------------------------------
+void SurfaceImpl::FillRectangle(PRectangle rc, Fill fill) {
+ if (gc) {
+ FillColour(fill.colour);
+ CGRect rect = PRectangleToCGRect(rc);
+ CGContextFillRect(gc, rect);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
static void drawImageRefCallback(void *info, CGContextRef gc) {
CGImageRef pattern = static_cast<CGImageRef>(info);
CGContextDrawImage(gc, CGRectMake(0, 0, CGImageGetWidth(pattern), CGImageGetHeight(pattern)), pattern);