Revision: 13587
http://sourceforge.net/p/skim-app/code/13587
Author: hofman
Date: 2023-08-17 16:39:24 +0000 (Thu, 17 Aug 2023)
Log Message:
-----------
use transparencylayer instead of temporary image to custom draw template image
with color
Modified Paths:
--------------
trunk/SKNavigationWindow.m
Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m 2023-08-17 16:09:49 UTC (rev 13586)
+++ trunk/SKNavigationWindow.m 2023-08-17 16:39:24 UTC (rev 13587)
@@ -762,6 +762,10 @@
rect.size.height = height;
[attrString drawInRect:rect];
} else if (image) {
+ NSRect rect = frame;
+ rect.size = [image size];
+ rect.origin.x = NSMidX(frame) - 0.5 * NSWidth(rect);
+ rect.origin.y = NSMidY(frame) - 0.5 * NSHeight(rect);
if ([image isTemplate]) {
NSColor *color = nil;
if ([self isSelectedForSegment:segment])
@@ -768,17 +772,15 @@
color = [NSColor colorWithGenericGamma22White:0.0 alpha:[self
isEnabledForSegment:segment] ? 1.0 : 0.7];
else
color = [NSColor colorWithGenericGamma22White:1.0 alpha:[self
isEnabledForSegment:segment] ? 0.9 : 0.3];
- image = [[image copy] autorelease];
- [image lockFocus];
+ CGContextRef context = [[NSGraphicsContext currentContext]
CGContext];
+ CGContextBeginTransparencyLayer(context, NULL);
+ [image drawInRect:rect];
[color setFill];
- NSRectFillUsingOperation((NSRect){NSZeroPoint, [image size]},
NSCompositeSourceIn);
- [image unlockFocus];
+ NSRectFillUsingOperation(rect, NSCompositeSourceIn);
+ CGContextEndTransparencyLayer(context);
+ } else {
+ [image drawInRect:rect];
}
- NSRect rect = frame;
- rect.size = [image size];
- rect.origin.x = NSMidX(frame) - 0.5 * NSWidth(rect);
- rect.origin.y = NSMidY(frame) - 0.5 * NSHeight(rect);
- [image drawInRect:rect];
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit