Revision: 14398
          http://sourceforge.net/p/skim-app/code/14398
Author:   hofman
Date:     2024-07-26 15:02:00 +0000 (Fri, 26 Jul 2024)
Log Message:
-----------
Redraw custom cursors when color defaults change. Draw cursor images in NSursor 
category.

Modified Paths:
--------------
    trunk/NSCursor_SKExtensions.m
    trunk/NSImage_SKExtensions.h
    trunk/NSImage_SKExtensions.m

Modified: trunk/NSCursor_SKExtensions.m
===================================================================
--- trunk/NSCursor_SKExtensions.m       2024-07-25 16:44:49 UTC (rev 14397)
+++ trunk/NSCursor_SKExtensions.m       2024-07-26 15:02:00 UTC (rev 14398)
@@ -42,6 +42,7 @@
 #import "SKAnimatedBorderlessWindow.h"
 #import "NSGeometry_SKExtensions.h"
 #import "NSWindow_SKExtensions.h"
+#import "NSShadow_SKExtensions.h"
 
 static inline void hideLaserPointer(void);
 
@@ -75,156 +76,403 @@
     original_hide = (void(*)(id, 
SEL))SKReplaceClassMethodImplementationFromSelector(self, @selector(hide), 
@selector(replacement_hide));
 }
 
-+ (NSCursor *)zoomInCursor {
-    static NSCursor *zoomInCursor = nil;
-    if (nil == zoomInCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameZoomInCursor] 
copy];
-        zoomInCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:NSMakePoint(7.0, 6.0)];
-    }
-    return zoomInCursor;
+static NSUserDefaults *universalaccessDefaults() {
+    static NSUserDefaults *universalaccessDefaults = nil;
+    if (universalaccessDefaults == nil)
+        universalaccessDefaults = [[NSUserDefaults alloc] 
initWithSuiteName:@"com.apple.universalaccess"];
+    return universalaccessDefaults;
 }
 
-+ (NSCursor *)zoomOutCursor {
-    static NSCursor *zoomOutCursor = nil;
-    if (nil == zoomOutCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameZoomOutCursor] 
copy];
-        zoomOutCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:NSMakePoint(7.0, 6.0)];
+static NSDictionary *currentCursorColors() {
+    if (@available(macOS 12.0, *)) {
+        if ([universalaccessDefaults() boolForKey:@"cursorIsCustomized"]) {
+            NSDictionary *cursorOutline = [universalaccessDefaults() 
dictionaryForKey:@"cursorOutline"];
+            NSDictionary *cursorFill = [universalaccessDefaults() 
dictionaryForKey:@"cursorFill"];
+            if ([cursorOutline count] == 4 && [cursorFill count] == 4)
+                return @{@"cursorOutline":cursorOutline, 
@"cursorFill":cursorFill};
+        }
     }
-    return zoomOutCursor;
+    return @{};
 }
 
-+ (NSCursor *)resizeDiagonal45Cursor {
-    static NSCursor *resizeDiagonal45Cursor = nil;
-    if (nil == resizeDiagonal45Cursor) {
-        if ([self 
respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)]) {
-            resizeDiagonal45Cursor = [NSCursor 
_windowResizeNorthEastSouthWestCursor];
++ (NSDictionary *)customCursors {
+    static NSMutableDictionary *customCursors = nil;
+    static NSDictionary *cursorColors = nil;
+    
+    NSDictionary *currentColors = currentCursorColors();
+    
+    if ([currentColors isEqualToDictionary:cursorColors] == NO) {
+        cursorColors = currentColors;
+        
+        customCursors = [NSMutableDictionary dictionary];
+        
+        NSColor *cursorOutline = [NSColor whiteColor];
+        NSColor *cursorFill = [NSColor blackColor];
+        if ([cursorColors count] == 2) {
+            NSDictionary *color = [cursorColors objectForKey:@"cursorOutline"];
+            cursorOutline = [NSColor colorWithSRGBRed:[[color 
objectForKey:@"red"] doubleValue] green:[[color objectForKey:@"green"] 
doubleValue] blue:[[color objectForKey:@"blue"] doubleValue] alpha:[[color 
objectForKey:@"alpha"] doubleValue]] ?: cursorOutline;
+            color = [cursorColors objectForKey:@"cursorFill"];
+            cursorFill = [NSColor colorWithSRGBRed:[[color 
objectForKey:@"red"] doubleValue] green:[[color objectForKey:@"green"] 
doubleValue] blue:[[color objectForKey:@"blue"] doubleValue] alpha:[[color 
objectForKey:@"alpha"] doubleValue]] ?: cursorFill;
+        }
+        
+        NSImage *image;
+        NSCursor *cursor;
+        NSPoint hotspot;
+        
+        if ([self 
respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)] == NO || 
[self respondsToSelector:@selector(_windowResizeNorthWestSouthEastCursor)]) {
+            hotspot = NSMakePoint(8.0, 8.0);
+            
+            image = [[NSImage alloc] initPDFWithSize:NSMakeSize(16.0, 16.0) 
drawingHandler:^(NSRect dstRect){
+                [cursorOutline setFill];
+                NSBezierPath *path = [NSBezierPath bezierPath];
+                [path moveToPoint:NSMakePoint(2.0, 2.0)];
+                [path lineToPoint:NSMakePoint(9.5, 2.0)];
+                [path lineToPoint:NSMakePoint(7.0, 4.5)];
+                [path lineToPoint:NSMakePoint(8.0, 5.5)];
+                [path lineToPoint:NSMakePoint(12.5, 1.0)];
+                [path lineToPoint:NSMakePoint(15.0, 3.5)];
+                [path lineToPoint:NSMakePoint(10.5, 8.0)];
+                [path lineToPoint:NSMakePoint(11.5, 9.0)];
+                [path lineToPoint:NSMakePoint(14.0, 6.5)];
+                [path lineToPoint:NSMakePoint(14.0, 14.0)];
+                [path lineToPoint:NSMakePoint(6.5, 14.0)];
+                [path lineToPoint:NSMakePoint(9.0, 11.5)];
+                [path lineToPoint:NSMakePoint(8.0, 10.5)];
+                [path lineToPoint:NSMakePoint(3.5, 15.0)];
+                [path lineToPoint:NSMakePoint(1.0, 12.5)];
+                [path lineToPoint:NSMakePoint(5.5, 8.0)];
+                [path lineToPoint:NSMakePoint(4.5, 7.0)];
+                [path lineToPoint:NSMakePoint(2.0, 9.5)];
+                [path closePath];
+                [NSGraphicsContext saveGraphicsState];
+                [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+                [path fill];
+                [NSGraphicsContext restoreGraphicsState];
+                [cursorFill setFill];
+                path = [NSBezierPath bezierPath];
+                [path moveToPoint:NSMakePoint(3.0, 3.0)];
+                [path lineToPoint:NSMakePoint(7.0, 3.0)];
+                [path lineToPoint:NSMakePoint(5.5, 4.5)];
+                [path lineToPoint:NSMakePoint(8.0, 7.0)];
+                [path lineToPoint:NSMakePoint(12.5, 2.5)];
+                [path lineToPoint:NSMakePoint(13.5, 3.5)];
+                [path lineToPoint:NSMakePoint(9.0, 8.0)];
+                [path lineToPoint:NSMakePoint(11.5, 10.5)];
+                [path lineToPoint:NSMakePoint(13.0, 9.0)];
+                [path lineToPoint:NSMakePoint(13.0, 13.0)];
+                [path lineToPoint:NSMakePoint(9.0, 13.0)];
+                [path lineToPoint:NSMakePoint(10.5, 11.5)];
+                [path lineToPoint:NSMakePoint(8.0, 9.0)];
+                [path lineToPoint:NSMakePoint(3.5, 13.5)];
+                [path lineToPoint:NSMakePoint(2.5, 12.5)];
+                [path lineToPoint:NSMakePoint(7.0, 8.0)];
+                [path lineToPoint:NSMakePoint(4.5, 5.5)];
+                [path lineToPoint:NSMakePoint(3.0, 7.0)];
+                [path closePath];
+                [path fill];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+            [customCursors setObject:cursor forKey:@"resizeDiagonal45Cursor"];
+            
+            image = [[NSImage alloc] initPDFWithSize:NSMakeSize(16.0, 16.0) 
drawingHandler:^(NSRect dstRect){
+                [cursorOutline setFill];
+                NSBezierPath *path = [NSBezierPath bezierPath];
+                [path moveToPoint:NSMakePoint(14.0, 2.0)];
+                [path lineToPoint:NSMakePoint(14.0, 9.5)];
+                [path lineToPoint:NSMakePoint(11.5, 7.0)];
+                [path lineToPoint:NSMakePoint(10.5, 8.0)];
+                [path lineToPoint:NSMakePoint(15.0, 12.5)];
+                [path lineToPoint:NSMakePoint(12.5, 15.0)];
+                [path lineToPoint:NSMakePoint(8.0, 10.5)];
+                [path lineToPoint:NSMakePoint(7.0, 11.5)];
+                [path lineToPoint:NSMakePoint(9.5, 14.0)];
+                [path lineToPoint:NSMakePoint(2.0, 14.0)];
+                [path lineToPoint:NSMakePoint(2.0, 6.5)];
+                [path lineToPoint:NSMakePoint(4.5, 9.0)];
+                [path lineToPoint:NSMakePoint(5.5, 8.0)];
+                [path lineToPoint:NSMakePoint(1.0, 3.5)];
+                [path lineToPoint:NSMakePoint(3.5, 1.0)];
+                [path lineToPoint:NSMakePoint(8.0, 5.5)];
+                [path lineToPoint:NSMakePoint(9.0, 4.5)];
+                [path lineToPoint:NSMakePoint(6.5, 2.0)];
+                [path closePath];
+                [NSGraphicsContext saveGraphicsState];
+                [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+                [path fill];
+                [NSGraphicsContext restoreGraphicsState];
+                [cursorFill setFill];
+                path = [NSBezierPath bezierPath];
+                [path moveToPoint:NSMakePoint(13.0, 3.0)];
+                [path lineToPoint:NSMakePoint(13.0, 7.0)];
+                [path lineToPoint:NSMakePoint(11.5, 5.5)];
+                [path lineToPoint:NSMakePoint(9.0, 8.0)];
+                [path lineToPoint:NSMakePoint(13.5, 12.5)];
+                [path lineToPoint:NSMakePoint(12.5, 13.5)];
+                [path lineToPoint:NSMakePoint(8.0, 9.0)];
+                [path lineToPoint:NSMakePoint(5.5, 11.5)];
+                [path lineToPoint:NSMakePoint(7.0, 13.0)];
+                [path lineToPoint:NSMakePoint(3.0, 13.0)];
+                [path lineToPoint:NSMakePoint(3.0, 9.0)];
+                [path lineToPoint:NSMakePoint(4.5, 10.5)];
+                [path lineToPoint:NSMakePoint(7.0, 8.0)];
+                [path lineToPoint:NSMakePoint(2.5, 3.5)];
+                [path lineToPoint:NSMakePoint(3.5, 2.5)];
+                [path lineToPoint:NSMakePoint(8.0, 7.0)];
+                [path lineToPoint:NSMakePoint(10.5, 4.5)];
+                [path lineToPoint:NSMakePoint(9.0, 3.0)];
+                [path closePath];
+                [path fill];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+            [customCursors setObject:cursor forKey:@"resizeDiagonal135Cursor"];
+        }
+        
+        hotspot = NSMakePoint(7.0, 6.0);
+        
+        image = [[NSImage alloc] initPDFWithSize:NSMakeSize(18.0, 18.0) 
drawingHandler:^(NSRect dstRect){
+            [cursorOutline set];
+            NSBezierPath *path = [NSBezierPath 
bezierPathWithOvalInRect:NSMakeRect(1.0, 5.0, 13.0, 13.0)];
+            [path moveToPoint:NSMakePoint(14.5, 1.5)];
+            [path lineToPoint:NSMakePoint(17.5, 4.5)];
+            [path lineToPoint:NSMakePoint(12.5, 9.5)];
+            [path lineToPoint:NSMakePoint(9.5, 6.5)];
+            [path closePath];
+            [NSGraphicsContext saveGraphicsState];
+            [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+            [path fill];
+            [NSGraphicsContext restoreGraphicsState];
+            [cursorFill setStroke];
+            path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(3.0, 7.0, 
9.0, 9.0)];
+            [path setLineWidth:2.0];
+            [path stroke];
+            path = [NSBezierPath bezierPath];
+            [path moveToPoint:NSMakePoint(15.5, 3.5)];
+            [path lineToPoint:NSMakePoint(10.5, 8.5)];
+            [path setLineWidth:2.5];
+            [path stroke];
+            path = [NSBezierPath bezierPath];
+            [path moveToPoint:NSMakePoint(5.0, 11.5)];
+            [path lineToPoint:NSMakePoint(10.0, 11.5)];
+            [path moveToPoint:NSMakePoint(7.5, 9.0)];
+            [path lineToPoint:NSMakePoint(7.5, 14.0)];
+            [path setLineWidth:1.0];
+            [path stroke];
+        }];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"zoomInCursor"];
+        
+        image = [[NSImage alloc] initPDFWithSize:NSMakeSize(18.0, 18.0) 
drawingHandler:^(NSRect dstRect){
+            [cursorOutline set];
+            NSBezierPath *path = [NSBezierPath 
bezierPathWithOvalInRect:NSMakeRect(1.0, 5.0, 13.0, 13.0)];
+            [path moveToPoint:NSMakePoint(14.5, 1.5)];
+            [path lineToPoint:NSMakePoint(17.5, 4.5)];
+            [path lineToPoint:NSMakePoint(12.5, 9.5)];
+            [path lineToPoint:NSMakePoint(9.5, 6.5)];
+            [path closePath];
+            [NSGraphicsContext saveGraphicsState];
+            [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+            [path fill];
+            [NSGraphicsContext restoreGraphicsState];
+            [cursorFill setStroke];
+            path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(3.0, 7.0, 
9.0, 9.0)];
+            [path setLineWidth:2.0];
+            [path stroke];
+            path = [NSBezierPath bezierPath];
+            [path moveToPoint:NSMakePoint(15.5, 3.5)];
+            [path lineToPoint:NSMakePoint(10.5, 8.5)];
+            [path setLineWidth:2.5];
+            [path stroke];
+            path = [NSBezierPath bezierPath];
+            [path moveToPoint:NSMakePoint(5.0, 11.5)];
+            [path lineToPoint:NSMakePoint(10.0, 11.5)];
+            [path setLineWidth:1.0];
+            [path stroke];
+        }];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"zoomOutCursor"];
+        
+        hotspot = NSMakePoint(9.0, 8.0);
+        
+        image = [[NSImage alloc] initPDFWithSize:NSMakeSize(18.0, 16.0) 
drawingHandler:^(NSRect dstRect){
+            [cursorOutline set];
+            NSBezierPath *path = [NSBezierPath 
bezierPathWithRect:NSMakeRect(1.0, 2.0, 16.0, 11.0)];
+            [path appendBezierPathWithOvalInRect:NSMakeRect(4.7, 6.7, 8.6, 
8.6)];
+            [NSGraphicsContext saveGraphicsState];
+            [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+            [path fill];
+            [NSGraphicsContext restoreGraphicsState];
+            [cursorFill set];
+            path = [NSBezierPath bezierPathWithRect:NSMakeRect(2.0, 3.0, 14.0, 
9.0)];
+            [path appendBezierPathWithOvalInRect:NSMakeRect(6.0, 8.0, 6.0, 
6.0)];
+            [path fill];
+            [cursorOutline set];
+            [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(5.3, 4.3, 7.4, 
7.4)] stroke];
+            path = [NSBezierPath bezierPath];
+            [path appendBezierPathWithArcWithCenter:NSMakePoint(9.0, 8.0) 
radius:1.8 startAngle:45.0 endAngle:225.0];
+            [path closePath];
+            [path fill];
+        }];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"cameraCursor"];
+        
+        NSSize size = [[[NSCursor openHandCursor] image] size];
+        
+        if (NSEqualSizes(size, NSMakeSize(32.0, 32.0))) {
+            
+            image = [[NSImage alloc] initPDFWithSize:size 
drawingHandler:^(NSRect dstRect){
+                [cursorFill setFill];
+                [NSGraphicsContext saveGraphicsState];
+                [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+                [NSBezierPath fillRect:NSMakeRect(2.0, 14.0, 28.0, 4.0)];
+                [NSGraphicsContext restoreGraphicsState];
+                [[[NSCursor openHandCursor] image] drawInRect:NSMakeRect(0.0, 
0.0, 32.0, 32.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver 
fraction:1.0];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:[[self 
openHandCursor] hotSpot]];
+            [customCursors setObject:cursor forKey:@"openHandBarCursor"];
+            
+            image = [[NSImage alloc] initPDFWithSize:size 
drawingHandler:^(NSRect dstRect){
+                [cursorFill setFill];
+                [NSGraphicsContext saveGraphicsState];
+                [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
+                [NSBezierPath fillRect:NSMakeRect(2.0, 14.0, 28.0, 4.0)];
+                [NSGraphicsContext restoreGraphicsState];
+                [[[NSCursor closedHandCursor] image] 
drawInRect:NSMakeRect(0.0, 0.0, 32.0, 32.0) fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:1.0];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:[[self 
closedHandCursor] hotSpot]];
+            [customCursors setObject:cursor forKey:@"closedHandBarCursor"];
+            
         } else {
-            NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameResizeDiagonal45Cursor] copy];
-            resizeDiagonal45Cursor = [[NSCursor alloc] 
initWithImage:cursorImage hotSpot:NSMakePoint(8.0, 8.0)];
+            
+            image = [[NSImage alloc] initPDFWithSize:size 
drawingHandler:^(NSRect dstRect){
+                [cursorFill setFill];
+                [NSBezierPath fillRect:NSMakeRect(0.0, 9.0 / 16.0 * 
size.height, size.width, 3.0 / 16.0 * size.height)];
+                [[[NSCursor openHandCursor] image] drawInRect:NSMakeRect(0.0, 
0.0, size.width, size.height) fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:1.0];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:[[self 
openHandCursor] hotSpot]];
+            [customCursors setObject:cursor forKey:@"openHandBarCursor"];
+            
+            image = [[NSImage alloc] initPDFWithSize:size 
drawingHandler:^(NSRect dstRect){
+                [cursorFill setFill];
+                [NSBezierPath fillRect:NSMakeRect(0.0, 6.0 / 16.0 * 
size.height, size.width, 3.0 / 16.0 * size.height)];
+                [[[NSCursor closedHandCursor] image] 
drawInRect:NSMakeRect(0.0, 0.0, size.width, size.height) fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:1.0];
+            }];
+            cursor = [[NSCursor alloc] initWithImage:image hotSpot:[[self 
closedHandCursor] hotSpot]];
+            [customCursors setObject:cursor forKey:@"closedHandBarCursor"];
+            
         }
+        
+        hotspot = [[self arrowCursor] hotSpot];
+        
+        image = [NSImage cursorTextNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"textNoteCursor"];
+        
+        image = [NSImage cursorAnchoredNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"anchoredNoteCursor"];
+        
+        image = [NSImage cursorCircleNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:[[self 
arrowCursor] hotSpot]];
+        [customCursors setObject:cursor forKey:@"circleNoteCursor"];
+        
+        image = [NSImage cursorSquareNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"squareNoteCursor"];
+        
+        image = [NSImage 
cursorHighlightNoteImageWithOutlineColor:cursorOutline fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"highlightNoteCursor"];
+        
+        image = [NSImage 
cursorUnderlineNoteImageWithOutlineColor:cursorOutline fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"underlineNoteCursor"];
+        
+        image = [NSImage 
cursorStrikeOutNoteImageWithOutlineColor:cursorOutline fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"strikeOutNoteCursor"];
+        
+        image = [NSImage cursorLineNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"lineNoteCursor"];
+        
+        image = [NSImage cursorInkNoteImageWithOutlineColor:cursorOutline 
fillColor:cursorFill];
+        cursor = [[NSCursor alloc] initWithImage:image hotSpot:hotspot];
+        [customCursors setObject:cursor forKey:@"inkNoteCursor"];
     }
-    return resizeDiagonal45Cursor;
+    
+    return customCursors;
 }
 
++ (NSCursor *)zoomInCursor {
+    return [[self customCursors] objectForKey:@"zoomInCursor"];
+}
+
++ (NSCursor *)zoomOutCursor {
+    return [[self customCursors] objectForKey:@"zoomOutCursor"];
+}
+
++ (NSCursor *)resizeDiagonal45Cursor {
+    if ([self 
respondsToSelector:@selector(_windowResizeNorthEastSouthWestCursor)]) {
+        return [NSCursor _windowResizeNorthEastSouthWestCursor];
+    } else {
+        return [[self customCursors] objectForKey:@"resizeDiagonal45Cursor"];
+    }
+}
+
 + (NSCursor *)resizeDiagonal135Cursor {
-    static NSCursor *resizeDiagonal135Cursor = nil;
-    if (nil == resizeDiagonal135Cursor) {
-        if ([self 
respondsToSelector:@selector(_windowResizeNorthWestSouthEastCursor)]) {
-            resizeDiagonal135Cursor = [NSCursor 
_windowResizeNorthWestSouthEastCursor];
-        } else {
-            NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameResizeDiagonal135Cursor] copy];
-            resizeDiagonal135Cursor = [[NSCursor alloc] 
initWithImage:cursorImage hotSpot:NSMakePoint(8.0, 8.0)];
-        }
+    if ([self 
respondsToSelector:@selector(_windowResizeNorthWestSouthEastCursor)]) {
+        return [NSCursor _windowResizeNorthWestSouthEastCursor];
+    } else {
+        return [[self customCursors] objectForKey:@"resizeDiagonal135Cursor"];
     }
-    return resizeDiagonal135Cursor;
 }
 
 + (NSCursor *)cameraCursor {
-    static NSCursor *cameraCursor = nil;
-    if (nil == cameraCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameCameraCursor] 
copy];
-        cameraCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:NSMakePoint(9.0, 8.0)];
-    }
-    return cameraCursor;
+    return [[self customCursors] objectForKey:@"cameraCursor"];
 }
 
 + (NSCursor *)openHandBarCursor {
-    static NSCursor *openHandBarCursor = nil;
-    if (nil == openHandBarCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameOpenHandBarCursor] copy];
-        openHandBarCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self openHandCursor] hotSpot]];
-    }
-    return openHandBarCursor;
+    return [[self customCursors] objectForKey:@"openHandBarCursor"];
 }
 
 + (NSCursor *)closedHandBarCursor {
-    static NSCursor *closedHandBarCursor = nil;
-    if (nil == closedHandBarCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameClosedHandBarCursor] copy];
-        closedHandBarCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self closedHandCursor] hotSpot]];
-    }
-    return closedHandBarCursor;
+    return [[self customCursors] objectForKey:@"closedHandBarCursor"];
 }
 
 + (NSCursor *)textNoteCursor {
-    static NSCursor *textNoteCursor = nil;
-    if (nil == textNoteCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameTextNoteCursor] 
copy];
-        textNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return textNoteCursor;
+    return [[self customCursors] objectForKey:@"textNoteCursor"];
 }
 
 + (NSCursor *)anchoredNoteCursor {
-    static NSCursor *anchoredNoteCursor = nil;
-    if (nil == anchoredNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameAnchoredNoteCursor] copy];
-        anchoredNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return anchoredNoteCursor;
+    return [[self customCursors] objectForKey:@"anchoredNoteCursor"];
 }
 
 + (NSCursor *)circleNoteCursor {
-    static NSCursor *circleNoteCursor = nil;
-    if (nil == circleNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameCircleNoteCursor] copy];
-        circleNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return circleNoteCursor;
+    return [[self customCursors] objectForKey:@"circleNoteCursor"];
 }
 
 + (NSCursor *)squareNoteCursor {
-    static NSCursor *squareNoteCursor = nil;
-    if (nil == squareNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameSquareNoteCursor] copy];
-        squareNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return squareNoteCursor;
+    return [[self customCursors] objectForKey:@"squareNoteCursor"];
 }
 
 + (NSCursor *)highlightNoteCursor {
-    static NSCursor *highlightNoteCursor = nil;
-    if (nil == highlightNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameHighlightNoteCursor] copy];
-        highlightNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return highlightNoteCursor;
+    return [[self customCursors] objectForKey:@"highlightNoteCursor"];
 }
 
 + (NSCursor *)underlineNoteCursor {
-    static NSCursor *underlineNoteCursor = nil;
-    if (nil == underlineNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameUnderlineNoteCursor] copy];
-        underlineNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return underlineNoteCursor;
+    return [[self customCursors] objectForKey:@"underlineNoteCursor"];
 }
 
 + (NSCursor *)strikeOutNoteCursor {
-    static NSCursor *strikeOutNoteCursor = nil;
-    if (nil == strikeOutNoteCursor) {
-        NSImage *cursorImage = [[NSImage 
imageNamed:SKImageNameStrikeOutNoteCursor] copy];
-        strikeOutNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return strikeOutNoteCursor;
+    return [[self customCursors] objectForKey:@"strikeOutNoteCursor"];
 }
 
 + (NSCursor *)lineNoteCursor {
-    static NSCursor *lineNoteCursor = nil;
-    if (nil == lineNoteCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameLineNoteCursor] 
copy];
-        lineNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return lineNoteCursor;
+    return [[self customCursors] objectForKey:@"lineNoteCursor"];
 }
 
 + (NSCursor *)inkNoteCursor {
-    static NSCursor *inkNoteCursor = nil;
-    if (nil == inkNoteCursor) {
-        NSImage *cursorImage = [[NSImage imageNamed:SKImageNameInkNoteCursor] 
copy];
-        inkNoteCursor = [[NSCursor alloc] initWithImage:cursorImage 
hotSpot:[[self arrowCursor] hotSpot]];
-    }
-    return inkNoteCursor;
+    return [[self customCursors] objectForKey:@"inkNoteCursor"];
 }
 
 + (NSCursor *)emptyCursor {
@@ -294,8 +542,8 @@
         [laserPointerWindow setFrame:SKRectFromCenterAndSize(p, 
[laserPointerWindow frame].size) display:YES];
     } else {
         NSImage *image = [self image];
-        NSNumber *size = [[[NSUserDefaults alloc] 
initWithSuiteName:@"com.apple.universalaccess"] 
objectForKey:@"mouseDriverCursorSize"];
-        CGFloat s = 2.0 * round(0.5 * (size ? [size doubleValue] : 1.0) * 
[image size].width);
+        CGFloat size = [universalaccessDefaults() 
doubleForKey:@"mouseDriverCursorSize"];
+        CGFloat s = 2.0 * round(0.5 * (size > 0.0 ? size : 1.0) * [image 
size].width);
         laserPointerWindow = [[SKAnimatedBorderlessWindow alloc] 
initWithContentRect:SKRectFromCenterAndSquareSize(p, s)];
         [laserPointerWindow setLevel:(NSWindowLevel)kCGCursorWindowLevel];
         [laserPointerWindow addImageViewWithImage:image];

Modified: trunk/NSImage_SKExtensions.h
===================================================================
--- trunk/NSImage_SKExtensions.h        2024-07-25 16:44:49 UTC (rev 14397)
+++ trunk/NSImage_SKExtensions.h        2024-07-26 15:02:00 UTC (rev 14398)
@@ -189,23 +189,6 @@
 extern NSString *SKImageNameTextAlignCenter;
 extern NSString *SKImageNameTextAlignRight;
 
-extern NSString *SKImageNameResizeDiagonal45Cursor;
-extern NSString *SKImageNameResizeDiagonal135Cursor;
-extern NSString *SKImageNameZoomInCursor;
-extern NSString *SKImageNameZoomOutCursor;
-extern NSString *SKImageNameCameraCursor;
-extern NSString *SKImageNameOpenHandBarCursor;
-extern NSString *SKImageNameClosedHandBarCursor;
-extern NSString *SKImageNameTextNoteCursor;
-extern NSString *SKImageNameAnchoredNoteCursor;
-extern NSString *SKImageNameCircleNoteCursor;
-extern NSString *SKImageNameSquareNoteCursor;
-extern NSString *SKImageNameHighlightNoteCursor;
-extern NSString *SKImageNameUnderlineNoteCursor;
-extern NSString *SKImageNameStrikeOutNoteCursor;
-extern NSString *SKImageNameLineNoteCursor;
-extern NSString *SKImageNameInkNoteCursor;
-
 extern NSString *SKImageNameRemoteStateResize;
 extern NSString *SKImageNameRemoteStateScroll;
 
@@ -215,6 +198,8 @@
 
 + (NSImage *)imageWithSize:(NSSize)size drawingHandler:(BOOL (^)(NSRect 
dstRect))drawingHandler;
 
+- (instancetype)initPDFWithSize:(NSSize)size drawingHandler:(void (^)(NSRect 
dstRect))drawingHandler;
+
 // 0=red, 1=orange, 2=yellow, 3=green, 4=blue, 5=indigo, 6=violet
 + (NSImage *)laserPointerImageWithColor:(NSInteger)color;
 
@@ -226,6 +211,16 @@
 
 + (void)makeImages;
 
++ (NSImage *)cursorTextNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorAnchoredNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorCircleNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorSquareNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorHighlightNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorUnderlineNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorStrikeOutNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorLineNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
++ (NSImage *)cursorInkNoteImageWithOutlineColor:(NSColor *)outlineColor 
fillColor:(NSColor *)fillColor;
+
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/NSImage_SKExtensions.m
===================================================================
--- trunk/NSImage_SKExtensions.m        2024-07-25 16:44:49 UTC (rev 14397)
+++ trunk/NSImage_SKExtensions.m        2024-07-26 15:02:00 UTC (rev 14398)
@@ -193,23 +193,6 @@
 NSString *SKImageNameTextAlignCenter = @"TextAlignCenter";
 NSString *SKImageNameTextAlignRight = @"TextAlignRight";
 
-NSString *SKImageNameResizeDiagonal45Cursor = @"ResizeDiagonal45Cursor";
-NSString *SKImageNameResizeDiagonal135Cursor = @"ResizeDiagonal135Cursor";
-NSString *SKImageNameZoomInCursor = @"ZoomInCursor";
-NSString *SKImageNameZoomOutCursor = @"ZoomOutCursor";
-NSString *SKImageNameCameraCursor = @"CameraCursor";
-NSString *SKImageNameTextNoteCursor = @"TextNoteCursor";
-NSString *SKImageNameAnchoredNoteCursor = @"AnchoredNoteCursor";
-NSString *SKImageNameCircleNoteCursor = @"CircleNoteCursor";
-NSString *SKImageNameSquareNoteCursor = @"SquareNoteCursor";
-NSString *SKImageNameHighlightNoteCursor = @"HighlightNoteCursor";
-NSString *SKImageNameUnderlineNoteCursor = @"UnderlineNoteCursor";
-NSString *SKImageNameStrikeOutNoteCursor = @"StrikeOutNoteCursor";
-NSString *SKImageNameLineNoteCursor = @"LineNoteCursor";
-NSString *SKImageNameInkNoteCursor = @"InkNoteCursor";
-NSString *SKImageNameOpenHandBarCursor = @"OpenHandBarCursor";
-NSString *SKImageNameClosedHandBarCursor = @"ClosedHandBarCursor";
-
 NSString *SKImageNameRemoteStateResize = @"RemoteStateResize";
 NSString *SKImageNameRemoteStateScroll = @"RemoteStateScroll";
 
@@ -1610,247 +1593,17 @@
     [[self imageNamed:SKImageNameTextAlignRight] 
setAccessibilityDescription:NSLocalizedString(@"align right", @"Accessibility 
description")];
 }
 
-+ (void)makeCursorImages {
-    
-    NSUserDefaults *prefs = [[NSUserDefaults alloc] 
initWithSuiteName:@"com.apple.universalaccess"];
-    NSColor *cursorOutline = [NSColor whiteColor];
-    NSColor *cursorFill = [NSColor blackColor];
-    if ([prefs boolForKey:@"cursorIsCustomized"]) {
-        NSDictionary *color = [prefs dictionaryForKey:@"cursorOutline"];
-        if ([color count] == 4)
-            cursorOutline = [NSColor colorWithSRGBRed:[[color 
objectForKey:@"red"] doubleValue] green:[[color objectForKey:@"green"] 
doubleValue] blue:[[color objectForKey:@"blue"] doubleValue] alpha:[[color 
objectForKey:@"alpha"] doubleValue]] ?: cursorOutline;
-        color = [prefs dictionaryForKey:@"cursorFill"];
-        if ([color count] == 4)
-            cursorFill = [NSColor colorWithSRGBRed:[[color 
objectForKey:@"red"] doubleValue] green:[[color objectForKey:@"green"] 
doubleValue] blue:[[color objectForKey:@"blue"] doubleValue] alpha:[[color 
objectForKey:@"alpha"] doubleValue]] ?: cursorFill;
-    }
-    
-    MAKE_VECTOR_IMAGE(SKImageNameResizeDiagonal45Cursor, NO, 16.0, 16.0,
-        [cursorOutline setFill];
-        NSBezierPath *path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(2.0, 2.0)];
-        [path lineToPoint:NSMakePoint(9.5, 2.0)];
-        [path lineToPoint:NSMakePoint(7.0, 4.5)];
-        [path lineToPoint:NSMakePoint(8.0, 5.5)];
-        [path lineToPoint:NSMakePoint(12.5, 1.0)];
-        [path lineToPoint:NSMakePoint(15.0, 3.5)];
-        [path lineToPoint:NSMakePoint(10.5, 8.0)];
-        [path lineToPoint:NSMakePoint(11.5, 9.0)];
-        [path lineToPoint:NSMakePoint(14.0, 6.5)];
-        [path lineToPoint:NSMakePoint(14.0, 14.0)];
-        [path lineToPoint:NSMakePoint(6.5, 14.0)];
-        [path lineToPoint:NSMakePoint(9.0, 11.5)];
-        [path lineToPoint:NSMakePoint(8.0, 10.5)];
-        [path lineToPoint:NSMakePoint(3.5, 15.0)];
-        [path lineToPoint:NSMakePoint(1.0, 12.5)];
-        [path lineToPoint:NSMakePoint(5.5, 8.0)];
-        [path lineToPoint:NSMakePoint(4.5, 7.0)];
-        [path lineToPoint:NSMakePoint(2.0, 9.5)];
-        [path closePath];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [path fill];
-        [NSGraphicsContext restoreGraphicsState];
-        [cursorFill setFill];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(3.0, 3.0)];
-        [path lineToPoint:NSMakePoint(7.0, 3.0)];
-        [path lineToPoint:NSMakePoint(5.5, 4.5)];
-        [path lineToPoint:NSMakePoint(8.0, 7.0)];
-        [path lineToPoint:NSMakePoint(12.5, 2.5)];
-        [path lineToPoint:NSMakePoint(13.5, 3.5)];
-        [path lineToPoint:NSMakePoint(9.0, 8.0)];
-        [path lineToPoint:NSMakePoint(11.5, 10.5)];
-        [path lineToPoint:NSMakePoint(13.0, 9.0)];
-        [path lineToPoint:NSMakePoint(13.0, 13.0)];
-        [path lineToPoint:NSMakePoint(9.0, 13.0)];
-        [path lineToPoint:NSMakePoint(10.5, 11.5)];
-        [path lineToPoint:NSMakePoint(8.0, 9.0)];
-        [path lineToPoint:NSMakePoint(3.5, 13.5)];
-        [path lineToPoint:NSMakePoint(2.5, 12.5)];
-        [path lineToPoint:NSMakePoint(7.0, 8.0)];
-        [path lineToPoint:NSMakePoint(4.5, 5.5)];
-        [path lineToPoint:NSMakePoint(3.0, 7.0)];
-        [path closePath];
-        [path fill];
-    );
-    
-    MAKE_VECTOR_IMAGE(SKImageNameResizeDiagonal135Cursor, NO, 16.0, 16.0,
-        [cursorOutline setFill];
-        NSBezierPath *path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(14.0, 2.0)];
-        [path lineToPoint:NSMakePoint(14.0, 9.5)];
-        [path lineToPoint:NSMakePoint(11.5, 7.0)];
-        [path lineToPoint:NSMakePoint(10.5, 8.0)];
-        [path lineToPoint:NSMakePoint(15.0, 12.5)];
-        [path lineToPoint:NSMakePoint(12.5, 15.0)];
-        [path lineToPoint:NSMakePoint(8.0, 10.5)];
-        [path lineToPoint:NSMakePoint(7.0, 11.5)];
-        [path lineToPoint:NSMakePoint(9.5, 14.0)];
-        [path lineToPoint:NSMakePoint(2.0, 14.0)];
-        [path lineToPoint:NSMakePoint(2.0, 6.5)];
-        [path lineToPoint:NSMakePoint(4.5, 9.0)];
-        [path lineToPoint:NSMakePoint(5.5, 8.0)];
-        [path lineToPoint:NSMakePoint(1.0, 3.5)];
-        [path lineToPoint:NSMakePoint(3.5, 1.0)];
-        [path lineToPoint:NSMakePoint(8.0, 5.5)];
-        [path lineToPoint:NSMakePoint(9.0, 4.5)];
-        [path lineToPoint:NSMakePoint(6.5, 2.0)];
-        [path closePath];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [path fill];
-        [NSGraphicsContext restoreGraphicsState];
-        [cursorFill setFill];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(13.0, 3.0)];
-        [path lineToPoint:NSMakePoint(13.0, 7.0)];
-        [path lineToPoint:NSMakePoint(11.5, 5.5)];
-        [path lineToPoint:NSMakePoint(9.0, 8.0)];
-        [path lineToPoint:NSMakePoint(13.5, 12.5)];
-        [path lineToPoint:NSMakePoint(12.5, 13.5)];
-        [path lineToPoint:NSMakePoint(8.0, 9.0)];
-        [path lineToPoint:NSMakePoint(5.5, 11.5)];
-        [path lineToPoint:NSMakePoint(7.0, 13.0)];
-        [path lineToPoint:NSMakePoint(3.0, 13.0)];
-        [path lineToPoint:NSMakePoint(3.0, 9.0)];
-        [path lineToPoint:NSMakePoint(4.5, 10.5)];
-        [path lineToPoint:NSMakePoint(7.0, 8.0)];
-        [path lineToPoint:NSMakePoint(2.5, 3.5)];
-        [path lineToPoint:NSMakePoint(3.5, 2.5)];
-        [path lineToPoint:NSMakePoint(8.0, 7.0)];
-        [path lineToPoint:NSMakePoint(10.5, 4.5)];
-        [path lineToPoint:NSMakePoint(9.0, 3.0)];
-        [path closePath];
-        [path fill];
-    );
-    
-    MAKE_VECTOR_IMAGE(SKImageNameZoomInCursor, NO, 18.0, 18.0,
-        [cursorOutline set];
-        NSBezierPath *path = [NSBezierPath 
bezierPathWithOvalInRect:NSMakeRect(1.0, 5.0, 13.0, 13.0)];
-        [path moveToPoint:NSMakePoint(14.5, 1.5)];
-        [path lineToPoint:NSMakePoint(17.5, 4.5)];
-        [path lineToPoint:NSMakePoint(12.5, 9.5)];
-        [path lineToPoint:NSMakePoint(9.5, 6.5)];
-        [path closePath];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [path fill];
-        [NSGraphicsContext restoreGraphicsState];
-        [cursorFill setStroke];
-        path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(3.0, 7.0, 
9.0, 9.0)];
-        [path setLineWidth:2.0];
-        [path stroke];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(15.5, 3.5)];
-        [path lineToPoint:NSMakePoint(10.5, 8.5)];
-        [path setLineWidth:2.5];
-        [path stroke];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(5.0, 11.5)];
-        [path lineToPoint:NSMakePoint(10.0, 11.5)];
-        [path moveToPoint:NSMakePoint(7.5, 9.0)];
-        [path lineToPoint:NSMakePoint(7.5, 14.0)];
-        [path setLineWidth:1.0];
-        [path stroke];
-    );
-    
-    MAKE_VECTOR_IMAGE(SKImageNameZoomOutCursor, NO, 18.0, 18.0,
-        [cursorOutline set];
-        NSBezierPath *path = [NSBezierPath 
bezierPathWithOvalInRect:NSMakeRect(1.0, 5.0, 13.0, 13.0)];
-        [path moveToPoint:NSMakePoint(14.5, 1.5)];
-        [path lineToPoint:NSMakePoint(17.5, 4.5)];
-        [path lineToPoint:NSMakePoint(12.5, 9.5)];
-        [path lineToPoint:NSMakePoint(9.5, 6.5)];
-        [path closePath];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [path fill];
-        [NSGraphicsContext restoreGraphicsState];
-        [cursorFill setStroke];
-        path = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(3.0, 7.0, 
9.0, 9.0)];
-        [path setLineWidth:2.0];
-        [path stroke];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(15.5, 3.5)];
-        [path lineToPoint:NSMakePoint(10.5, 8.5)];
-        [path setLineWidth:2.5];
-        [path stroke];
-        path = [NSBezierPath bezierPath];
-        [path moveToPoint:NSMakePoint(5.0, 11.5)];
-        [path lineToPoint:NSMakePoint(10.0, 11.5)];
-        [path setLineWidth:1.0];
-        [path stroke];
-    );
-    
-    MAKE_VECTOR_IMAGE(SKImageNameCameraCursor, NO, 18.0, 16.0,
-        [cursorOutline set];
-        NSBezierPath *path = [NSBezierPath bezierPathWithRect:NSMakeRect(1.0, 
2.0, 16.0, 11.0)];
-        [path appendBezierPathWithOvalInRect:NSMakeRect(4.7, 6.7, 8.6, 8.6)];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [path fill];
-        [NSGraphicsContext restoreGraphicsState];
-        [cursorFill set];
-        path = [NSBezierPath bezierPathWithRect:NSMakeRect(2.0, 3.0, 14.0, 
9.0)];
-        [path appendBezierPathWithOvalInRect:NSMakeRect(6.0, 8.0, 6.0, 6.0)];
-        [path fill];
-        [cursorOutline set];
-        [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(5.3, 4.3, 7.4, 
7.4)] stroke];
-        path = [NSBezierPath bezierPath];
-        [path appendBezierPathWithArcWithCenter:NSMakePoint(9.0, 8.0) 
radius:1.8 startAngle:45.0 endAngle:225.0];
-        [path closePath];
-        [path fill];
-    );
-    
-    NSSize size = [[[NSCursor openHandCursor] image] size];
-    
-    if (NSEqualSizes(size, NSMakeSize(32.0, 32.0))) {
-    
-    MAKE_VECTOR_IMAGE(SKImageNameOpenHandBarCursor, NO, 32.0, 32.0,
-        [cursorFill setFill];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [NSBezierPath fillRect:NSMakeRect(2.0, 14.0, 28.0, 4.0)];
-        [NSGraphicsContext restoreGraphicsState];
-        [[[NSCursor openHandCursor] image] drawInRect:NSMakeRect(0.0, 0.0, 
32.0, 32.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver 
fraction:1.0];
-    );
-        
-    MAKE_VECTOR_IMAGE(SKImageNameClosedHandBarCursor, NO, 32.0, 32.0,
-        [cursorFill setFill];
-        [NSGraphicsContext saveGraphicsState];
-        [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:1.0 
yOffset:-1.0];
-        [NSBezierPath fillRect:NSMakeRect(2.0, 14.0, 28.0, 4.0)];
-        [NSGraphicsContext restoreGraphicsState];
-        [[[NSCursor closedHandCursor] image] drawInRect:NSMakeRect(0.0, 0.0, 
32.0, 32.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver 
fraction:1.0];
-    );
-    
-    } else {
-    
-    MAKE_VECTOR_IMAGE(SKImageNameOpenHandBarCursor, NO, size.width, size.width,
-        [cursorFill setFill];
-        [NSBezierPath fillRect:NSMakeRect(0.0, 9.0 / 16.0 * size.height, 
size.width, 3.0 / 16.0 * size.height)];
-        [[[NSCursor openHandCursor] image] drawInRect:NSMakeRect(0.0, 0.0, 
size.width, size.height) fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:1.0];
-    );
-    
-    MAKE_VECTOR_IMAGE(SKImageNameClosedHandBarCursor, NO, size.width, 
size.width,
-        [cursorFill setFill];
-        [NSBezierPath fillRect:NSMakeRect(0.0, 6.0 / 16.0 * size.height, 
size.width, 3.0 / 16.0 * size.height)];
-        [[[NSCursor closedHandCursor] image] drawInRect:NSMakeRect(0.0, 0.0, 
size.width, size.height) fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:1.0];
-    );
-    
-    }
-    
-#define MAKE_NOTE_CURSOR_IMAGE(name) \
-    MAKE_VECTOR_IMAGE(SKImageName ## name ## NoteCursor, NO, 24.0, 42.0, \
+#define DEFINE_NOTE_CURSOR_IMAGE(name) \
++ (NSImage *)cursor ## name ## NoteImageWithOutlineColor:(NSColor 
*)outlineColor fillColor:(NSColor *)fillColor { \
+    return [[NSImage alloc] initPDFWithSize:NSMakeSize(24.0, 42.0) 
drawingHandler:^(NSRect dstRect){ \
         drawArrowCursor(); \
         translate(2.0, 2.0); \
-        draw ## name ## NoteBackground(cursorOutline); \
-        draw ## name ## Note(cursorFill); \
-    )
+        draw ## name ## NoteBackground(outlineColor); \
+        draw ## name ## Note(fillColor); \
+    }]; \
+}
     
-    APPLY_NOTE_TYPES(MAKE_NOTE_CURSOR_IMAGE);
-    
-}
+APPLY_NOTE_TYPES(DEFINE_NOTE_CURSOR_IMAGE);
 
 + (void)makeRemoteStateImages {
     
@@ -1945,7 +1698,6 @@
     [self makeTouchBarImages];
     [self makeAdornImages];
     [self makeTextAlignImages];
-    [self makeCursorImages];
     [self makeRemoteStateImages];
 }
 

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

Reply via email to