From 9977b5c41b07e0b08e6408c492498ba6e396c981 Mon Sep 17 00:00:00 2001 From: mac Date: Thu, 5 Nov 2026 21:53:44 +0800 Subject: [PATCH] Draw a portable clone stamp glyph for the formal host --- 大鱼调色/Plugin/DYViewerControls.inc.h | 19 ++++++++++++++++++- 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/Info.plist | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/大鱼调色/Plugin/DYViewerControls.inc.h b/大鱼调色/Plugin/DYViewerControls.inc.h index 9552410..a699641 100644 --- a/大鱼调色/Plugin/DYViewerControls.inc.h +++ b/大鱼调色/Plugin/DYViewerControls.inc.h @@ -20,6 +20,22 @@ static void DYDrawDistortionGrid(NSRect rect,NSColor *color){ } [color setStroke];[grid stroke]; } +static void DYDrawCloneStamp(NSRect rect,NSColor *color){ + CGFloat side=NSWidth(rect),x=NSMinX(rect),y=NSMinY(rect); + NSBezierPath *handle=[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(x+side*.31,y+side*.05,side*.38,side*.43) xRadius:side*.16 yRadius:side*.16]; + NSBezierPath *body=[NSBezierPath bezierPath]; + [body moveToPoint:NSMakePoint(x+side*.39,y+side*.31)]; + [body lineToPoint:NSMakePoint(x+side*.61,y+side*.31)]; + [body lineToPoint:NSMakePoint(x+side*.72,y+side*.55)]; + [body lineToPoint:NSMakePoint(x+side*.88,y+side*.55)]; + [body lineToPoint:NSMakePoint(x+side*.91,y+side*.78)]; + [body lineToPoint:NSMakePoint(x+side*.09,y+side*.78)]; + [body lineToPoint:NSMakePoint(x+side*.12,y+side*.55)]; + [body lineToPoint:NSMakePoint(x+side*.28,y+side*.55)]; + [body closePath]; + [color setFill];[handle fill];[body fill]; + [[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(x+side*.10,y+side*.86,side*.80,side*.09) xRadius:side*.045 yRadius:side*.045]fill]; +} @interface DYViewerControls : NSObject @property(nonatomic,retain) DYViewerParameterBridge *bridge; - (void)setViewport:(NSRect)viewport; @@ -53,7 +69,7 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti if(_capture&&![_capture capturing])_capture=nil; [_areas removeAllObjects];if(!_bridge||v.size.width<100||v.size.height<80)return; // Only tools that benefit from direct image interaction belong on the canvas. - NSArray *types=@[@"curve",@"lens",@"skin",@"look",@"whiteBalance",@"cloneStamp"],*titles=@[@"曲线",@"畸变修复",@"肤色",@"LUT",@"白平衡吸管",@"仿制图章"],*symbols=@[@"point.topleft.down.to.point.bottomright.curvepath",@"pincushion-grid",@"person.crop.circle",@"square.stack.3d.up",@"eyedropper",@"stamp"]; + NSArray *types=@[@"curve",@"lens",@"skin",@"look",@"whiteBalance",@"cloneStamp"],*titles=@[@"曲线",@"畸变修复",@"肤色",@"LUT",@"白平衡吸管",@"仿制图章"],*symbols=@[@"point.topleft.down.to.point.bottomright.curvepath",@"pincushion-grid",@"person.crop.circle",@"square.stack.3d.up",@"eyedropper",@"clone-stamp"]; CGFloat railScale=MIN(s,v.size.width/480.),y=NSMaxY(v)-33*railScale,w=36*railScale; CGFloat x=NSMaxX(v)-476*railScale; _rail=NSMakeRect(x,y,356*railScale,25*railScale); @@ -104,6 +120,7 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti CGFloat side=MIN(17*s,r.size.height*.7); NSRect glyph=NSMakeRect(NSMidX(r)-side/2,NSMidY(r)-side/2,side,side); if([a[@"symbol"]isEqual:@"pincushion-grid"])DYDrawDistortionGrid(NSInsetRect(glyph,1,1),ink); + else if([a[@"symbol"]isEqual:@"clone-stamp"])DYDrawCloneStamp(glyph,ink); else{ NSImage *icon=[NSImage imageWithSystemSymbolName:a[@"symbol"] accessibilityDescription:a[@"title"]]; NSImageSymbolConfiguration *configuration=[[NSImageSymbolConfiguration configurationWithPointSize:14*s weight:NSFontWeightRegular]configurationByApplyingConfiguration:[NSImageSymbolConfiguration configurationWithPaletteColors:@[ink]]]; diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index f4d3004..e3120e6 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.13.0 CFBundleVersion - 82 + 83 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 9cc1b31..fdaa684 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.13.0 CFBundleVersion - 82 + 83 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright