fix: align spider vectorscope with CbCr scope and separate trace from controls
这个提交包含在:
1 父节点
01efcc8a29
当前提交
b16a6326a4
17 个文件已更改
+411
-114
没有与搜索条件相匹配的文件
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"status": "verified",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.20.0",
|
||||
"build": "111",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "942c85a5-1365-4c08-a932-7a6efd4cbe43",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "01efcc8a2998c78a193a9b8b2e5c4bf81b6a0345",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "48d9ff4883cf189ae0a54b5cf412a898beb97b38d29d6cbc745d6cfa613dce60",
|
||||
"installedTemplateSHA256": {
|
||||
"大鱼调色/大鱼调色.moef": "48d9ff4883cf189ae0a54b5cf412a898beb97b38d29d6cbc745d6cfa613dce60",
|
||||
"大鱼调色/large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
|
||||
"大鱼调色/small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a",
|
||||
"一级调色/一级调色.moef": "e4612f58eee5bf07a0a44cc5f6d65f9ca207b7f6946da938ed05f7d254ca7924",
|
||||
"一级调色/large.png": "b9b990a46f3fd9b6974a1aba1a3e9bff11a287fd1615d4cd0f9e7393c302631b",
|
||||
"一级调色/small.png": "77b36c042fb82219651e5bd22c1057b644c06a528a8962d4afecdcb8cab52635",
|
||||
"蜘蛛盘校色仪/蜘蛛盘校色仪.moef": "68e91d3747a119e684f659093cb520a7fbd495336e8a1552316e52031e975ad5",
|
||||
"蜘蛛盘校色仪/large.png": "52de21d5fc598fda331cd472b937cf4aaf69a09c80d49e7b168ac7804e9cd040",
|
||||
"蜘蛛盘校色仪/small.png": "ea9b69d12948c5cd5f6acd9d000822d9fff6df3beec9dd278077a8ab66d455cd",
|
||||
"基础调整/基础调整.moef": "ca6a584dd168990870fa774df8ba3fcfce5ad2e8de4d28bd656057fdaa1dbdca",
|
||||
"基础调整/large.png": "a25e2b5ed50628ebe77220719528d14f21c25b5eecf37a5d60f211d2179ece43",
|
||||
"基础调整/small.png": "3da91ae3461b882f5e1a557b4191d9aedaa6d329da70999eb7f26cbfb63a057f",
|
||||
"肤色保护/肤色保护.moef": "06fdf5964f487a7cca3d6dce6e68013d3c0ba5b5c73c4bb392c7b58f5d916212",
|
||||
"肤色保护/large.png": "f124e8f3d93c2be76ba26ba06d8b9c0b42e2c10dcb6300ae6ee7b7d7c7eb3025",
|
||||
"肤色保护/small.png": "51fe525e67903101920a994d3540f368780d3aa9c0e54ebdb847871c82d81562",
|
||||
"风格 LUT/风格 LUT.moef": "595f722d3ac99555d4e22611907b6273a3fb36fea59b8949be58eb1f7d319501",
|
||||
"风格 LUT/large.png": "a9a4b48885752282535ec3ec2ffbe19bcd27af7132337e4a4ad3d104a2082692",
|
||||
"风格 LUT/small.png": "9ae76ba957b1e94a5a03a600140f59e98861917d13da9124082810c509400e36",
|
||||
"HSL/HSL.moef": "97bcbf240f86f485299c298d90f9339aa87a2751cef475e3d6a1637144d4ab13",
|
||||
"HSL/large.png": "eaa2e7b025dc59416fddb8de8b9c56f0a7d34ba70facd7aa45cfb84660f7da78",
|
||||
"HSL/small.png": "3a54428bc6821e75935aa1be0f149aac6e6ce05fcc059b7f0e90ceef9a41981e",
|
||||
"曲线/曲线.moef": "3f235de32384a3b268982609583702d28470ed91c756f1b13947454f22bf3fc0",
|
||||
"曲线/large.png": "273899eb6aa60fc0f7c8d41cc0e1f5a15b4c88a8803c00020a085ea874160870",
|
||||
"曲线/small.png": "c17a2343b076650344b1c53ce92acf32f7696d66e32bda2d156996d4e3b834f5",
|
||||
"颜色分级/颜色分级.moef": "c49877ada4fa0ac49fa497b62f3a3e09bfe15f0d73b352bdfbeb0a9a2b7b1aad",
|
||||
"颜色分级/large.png": "f9afe6c3a76080a2a7c7ea98f24e62a74ab2e6fd8b4ad16ba9eb6065fef5d2ed",
|
||||
"颜色分级/small.png": "9e9d7759f829d25a01a77422c989949b02ad34de81013f6b91505c4a3d1397e9",
|
||||
"三原色/三原色.moef": "6015ecc2cc89116b05d601df920ae674bad9ad4c6e7bad1f0eac889e08cda60d",
|
||||
"三原色/large.png": "bf7bfc893e294fc38c0f97e5594b6ba6e5c7126b9aae643754c89647e8bd5a1f",
|
||||
"三原色/small.png": "2e28988e6bae0503edadef22cf7793ce51a1b8e5930623b2eff3c01212e57ee8",
|
||||
"色阶/色阶.moef": "b653b0981e0975605d2857a87bd495885d3370d3e9bcd9dc3a59b0012bf1f79e",
|
||||
"色阶/large.png": "fcea12f4367039ea1512d2e23d51b9ca5198172dc5b10a1ff94a828fe94f4802",
|
||||
"色阶/small.png": "41cd1a9c4d3b68972181534abe0e91bdb9e01ef5559b6b1f7ef6bf305f450a76",
|
||||
"黑白混色/黑白混色.moef": "96f2d1fc2fe5ed2a8eabdf3a3bf5eb7fff145d55a0ce05807dcd834d2b8e9b32",
|
||||
"黑白混色/large.png": "6df07fb223ab43b2b5b6115bef4a1a97eed5cbeb6afab84e005c3a2bdfe01979",
|
||||
"黑白混色/small.png": "5382be0d29b4a195b8639b3c325f80e9b8cecaa9c12837ab5cf57b6ea877ecbc",
|
||||
"色彩平衡/色彩平衡.moef": "be935b1e399e2a47394b54b24fc2e32eb0622ae0cd28f83e1d2d895c3c1133d6",
|
||||
"色彩平衡/large.png": "fa2ce9071dee52d7ab9dc7cf6020f8679df3af707663c9a57a28fcde73e6801e",
|
||||
"色彩平衡/small.png": "12a72a9f26e6ee41613b16ed2402f94a04837e55895addc8f5c25137ad7feaa6",
|
||||
"通道混合器/通道混合器.moef": "7c5889c052534edd0043f439f59fe31a987c9c626d9097ce7f3d7280a888b1e3",
|
||||
"通道混合器/large.png": "5ae9d2683450a3a515822520911885a774e202aa924465602f7369a1e67c0c4c",
|
||||
"通道混合器/small.png": "23bfafb79287855e037f98f0ab5cee10914384824b1a65f0247cad2dd239ef1c",
|
||||
"胶片模拟/胶片模拟.moef": "a559c654976ce711d01ef5b81ccaf01df8d81a9de501780cccc519fb72c4b7f2",
|
||||
"胶片模拟/large.png": "d36a794f9640874f6ad7f3523b9eac92ba7c6ef8fa7b63c4594fc68e87c2eee7",
|
||||
"胶片模拟/small.png": "f125deaf0c8d55ecc04e555cfb133c40ff3703f34a663548c6b38b3196780eb1",
|
||||
"镜头畸变修复/镜头畸变修复.moef": "5ddb7e97d718d1b78cbc162b042aed1debdd0fecd12b8596590d5de5307c19ae",
|
||||
"镜头畸变修复/large.png": "a00136fb9276c41518ba6096314fb6772ad1dc9be4f4d766409239fa923cfcd1",
|
||||
"镜头畸变修复/small.png": "1b2480cfa33e1ab54a1ffcd81d9496aac1354b0d2974d6616fe7128965c2ede3",
|
||||
"CST 色彩空间转换/CST 色彩空间转换.moef": "96d684ec87cbef801316abd83a1c247360d9adf9dca52ae84881c400c898f1da",
|
||||
"CST 色彩空间转换/large.png": "816db272970491181aca4b872f09ca1900ebf0e7f21fee5bd6e2b4daedea5306",
|
||||
"CST 色彩空间转换/small.png": "677353684eeaa1986bd21580eb0f2dcf4486f8cfba3985686c2ecb67afed5dbc"
|
||||
},
|
||||
"shaderSHA256": "2f96cf158e6a274bce146b7a97141344c6e68e1185f7ac5df7991b0e854e2793",
|
||||
"hostVerification": "verification/HostSpiderScope1.20.0.json"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"version": "1.20.0",
|
||||
"build": "111",
|
||||
"compiledSource": "01efcc8a2998c78a193a9b8b2e5c4bf81b6a0345",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"hostServicePIDs": [
|
||||
7429
|
||||
],
|
||||
"hostObservation": {
|
||||
"mode": "当前打开的真实素材,检查器中展开蜘蛛盘;只读观察",
|
||||
"scope": "可见明亮密度轨迹、压暗的色相底盘、网格控制点、带肤色标签的斜虚线",
|
||||
"skinToggle": "检查器报告肤色保护启用 off"
|
||||
},
|
||||
"installedNativeChecks": 999,
|
||||
"relevantNativeChecks": [
|
||||
"skin-default-off-preserves-legacy-host-and-layer-values",
|
||||
"spider-drag-one-host-undo-group",
|
||||
"spider-escape-restores-coordinates-and-pins",
|
||||
"spider-osc-uses-exact-instance-output-time",
|
||||
"spider-inspector-replays-paused-output-without-enabling-full-scopes",
|
||||
"spider-plot-refreshes-on-edits-at-the-same-time",
|
||||
"spider-raster-hue-orientation-neutral-center-and-invalid-filtering",
|
||||
"canvas-spider-drags-real-mesh-and-closes-one-undo",
|
||||
"canvas-spider-uuid-persists-mesh-without-touching-base",
|
||||
"canvas-spider-external-topology-change-wins"
|
||||
],
|
||||
"templatesVerified": 17,
|
||||
"rasterBenchmark": {
|
||||
"input": "320×180 synthetic RGB, Apple M4, 80 iterations",
|
||||
"meanMs": 0.984,
|
||||
"scope": "CPU density raster only"
|
||||
},
|
||||
"limitations": [
|
||||
"FCP 实看为用户当前片段,未在该片段内执行参数编辑或播放操作。",
|
||||
"工作区和画布的测量与交互使用原生集成检查,未在此次 FCP 实片中逐一操作。",
|
||||
"未量化宿主帧率,未单独运行 Motion。"
|
||||
]
|
||||
}
|
||||
@@ -13,9 +13,9 @@
|
||||
DYUniforms edited;DYReadUniforms(host,kCMTimeZero,&edited);run.record(@"canvas-hsl-plot-captures-outside-and-commits-one-undo",edited.hslHueA[2]==100&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *layerID=DYInsertTool(doc,@"hsl",@"base:hsl")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:layerID forKey:@"nodeID"];publish();plot=[area(@"hslPlot")[@"rect"]rectValue];a=NSMakePoint(NSMinX(plot)+plot.size.width*2.5/8,NSMidY(plot));b=NSMakePoint(a.x,NSMidY(plot)-plot.size.height*.25);drag(a,b);DYReadUniforms(host,kCMTimeZero,&edited);
|
||||
run.record(@"canvas-hsl-independent-uuid-does-not-edit-base",edited.hslHueA[2]==100&&fabs([DYToolWithID(DYReadTools(host,kCMTimeZero).document,layerID)[@"values"][@"hsl0_2"]doubleValue]-50)<1e-5);
|
||||
[(id)panel setValue:@"spider" forKey:@"toolType"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];auto mesh=dy::neutralMesh();int selected=dy::meshIndex(mesh,0,2);a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x+9,a.y-6);undo=base->_undoStarts;drag(a,b);
|
||||
[(id)panel setValue:@"spider" forKey:@"toolType"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];auto mesh=dy::neutralMesh();int selected=dy::meshIndex(mesh,0,2);a=DYSpiderPlotPoint(plot,mesh.x[selected],mesh.y[selected]);b=NSMakePoint(a.x+9,a.y-6);undo=base->_undoStarts;drag(a,b);
|
||||
NSData *saved=DYReadAssets(host,kCMTimeZero).spiderMesh;auto changed=DYSpiderMesh(saved);run.record(@"canvas-spider-drags-real-mesh-and-closes-one-undo",saved.length&&fabs(changed.x[selected]-mesh.x[selected])>.001&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
||||
doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *spiderID=DYInsertTool(doc,@"spider",@"base:spider")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:spiderID forKey:@"nodeID"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x-8,a.y+5);drag(a,b);
|
||||
doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *spiderID=DYInsertTool(doc,@"spider",@"base:spider")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:spiderID forKey:@"nodeID"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];a=DYSpiderPlotPoint(plot,mesh.x[selected],mesh.y[selected]);b=NSMakePoint(a.x-8,a.y+5);drag(a,b);
|
||||
run.record(@"canvas-spider-uuid-persists-mesh-without-touching-base",[saved isEqual:DYReadAssets(host,kCMTimeZero).spiderMesh]&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]length]>0);
|
||||
NSData *current=DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"];[bridge beginSpider:current node:spiderID enabled:1 atTime:kCMTimeZero];drain();doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);auto external=dy::neutralMesh(12,12);NSData *externalData=[NSData dataWithBytes:&external length:sizeof(external)];((NSMutableDictionary*)DYToolWithID(doc,spiderID))[@"spider"]=externalData;DYWriteTools(host,doc,kCMTimeZero);[bridge changeSpider:current];[bridge endGesture];drain();
|
||||
run.record(@"canvas-spider-external-topology-change-wins",[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]isEqual:externalData]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#import "DYToolState.h"
|
||||
#import "DYInspector.h"
|
||||
#import "DYManagedColor.h"
|
||||
#include "DYScopeMath.hpp"
|
||||
#include "DYSpiderScopeDrawing.h"
|
||||
#include "DYScopeDisplayTime.h"
|
||||
#import <os/log.h>
|
||||
#include <cmath>
|
||||
@@ -83,9 +83,9 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
else if(_mode==2){NSData *hist=_metadata[@"histogram"];if(hist.length==4*dyscope::Bins*sizeof(uint32_t)){auto *bins=(const uint32_t*)hist.bytes;uint32_t maximum=1;for(unsigned i=0;i<4*dyscope::Bins;i++)maximum=std::max(maximum,bins[i]);NSArray *colors=@[[NSColor colorWithWhite:.8 alpha:.8],NSColor.systemRedColor,NSColor.systemGreenColor,NSColor.systemBlueColor];for(unsigned c=0;c<4;c++){[colors[c]setStroke];NSBezierPath *line=[NSBezierPath bezierPath];for(unsigned x=0;x<dyscope::Bins;x++){NSPoint q=NSMakePoint(plot.origin.x+x*plot.size.width/255,NSMaxY(plot)-std::log1p(double(bins[c*dyscope::Bins+x]))/std::log1p(double(maximum))*plot.size.height);if(x)[line lineToPoint:q];else[line moveToPoint:q];}[line stroke];}}}
|
||||
else{[[NSBezierPath bezierPathWithOvalInRect:plot]stroke];NSBezierPath *axes=[NSBezierPath bezierPath];[axes moveToPoint:NSMakePoint(NSMidX(plot),NSMinY(plot))];[axes lineToPoint:NSMakePoint(NSMidX(plot),NSMaxY(plot))];[axes moveToPoint:NSMakePoint(NSMinX(plot),NSMidY(plot))];[axes lineToPoint:NSMakePoint(NSMaxX(plot),NSMidY(plot))];[axes stroke];
|
||||
// A quiet dashed reference stays legible over the trace without obscuring it.
|
||||
NSPoint skin=NSMakePoint(NSMidX(plot)+dyscope::SkinToneCb*plot.size.width*.49,NSMidY(plot)-dyscope::SkinToneCr*plot.size.height*.49);
|
||||
NSPoint skin=DYSkinScopePoint(plot,.98);
|
||||
NSBezierPath *skinLine=[NSBezierPath bezierPath];CGFloat dash[]={3,3};[skinLine setLineDash:dash count:2 phase:0];skinLine.lineWidth=.8;[[NSColor colorWithRed:.92 green:.75 blue:.56 alpha:.85]setStroke];[skinLine moveToPoint:NSMakePoint(NSMidX(plot),NSMidY(plot))];[skinLine lineToPoint:skin];[skinLine stroke];
|
||||
[@"肤色" drawAtPoint:NSMakePoint(skin.x-19,skin.y-10)withAttributes:text];float rgb[6][3]={{1,0,0},{1,0,1},{0,0,1},{0,1,1},{0,1,0},{1,1,0}};NSArray *names=@[@"R",@"Mg",@"B",@"Cy",@"G",@"Y"];for(int i=0;i<6;i++){float y=.2126f*rgb[i][0]+.7152f*rgb[i][1]+.0722f*rgb[i][2],cb=(rgb[i][2]-y)/1.8556f,cr=(rgb[i][0]-y)/1.5748f;NSPoint q=NSMakePoint(NSMidX(plot)+cb/1.2f*plot.size.width,NSMidY(plot)-cr/1.2f*plot.size.height);[[NSColor colorWithRed:rgb[i][0]*.65+.3 green:rgb[i][1]*.65+.3 blue:rgb[i][2]*.65+.3 alpha:1]setStroke];[[NSBezierPath bezierPathWithRect:NSMakeRect(q.x-2,q.y-2,4,4)]stroke];[names[i]drawAtPoint:NSMakePoint(q.x+3,q.y-5)withAttributes:text];}}
|
||||
[@"肤色" drawAtPoint:NSMakePoint(skin.x-19,skin.y-10)withAttributes:text];float rgb[6][3]={{1,0,0},{1,0,1},{0,0,1},{0,1,1},{0,1,0},{1,1,0}};NSArray *names=@[@"R",@"Mg",@"B",@"Cy",@"G",@"Y"];for(int i=0;i<6;i++){dyscope::RGBA color={rgb[i][0],rgb[i][1],rgb[i][2],1};auto chroma=dyscope::chroma(color,dyscope::luminance(color));NSPoint q=DYScopePoint(plot,chroma.cb,chroma.cr);[[NSColor colorWithRed:rgb[i][0]*.65+.3 green:rgb[i][1]*.65+.3 blue:rgb[i][2]*.65+.3 alpha:1]setStroke];[[NSBezierPath bezierPathWithRect:NSMakeRect(q.x-2,q.y-2,4,4)]stroke];[names[i]drawAtPoint:NSMakePoint(q.x+3,q.y-5)withAttributes:text];}}
|
||||
if(!_metadata){NSString *message=@"等待画面";[message drawAtPoint:NSMakePoint(NSMidX(plot)-20,NSMidY(plot)-6)withAttributes:text];}
|
||||
}
|
||||
@end
|
||||
|
||||
+11
-2
@@ -1,5 +1,5 @@
|
||||
#import "DYScopeSample.h"
|
||||
#include "DYScopeMath.hpp"
|
||||
#include "DYSpiderScopeDrawing.h"
|
||||
#include "DYScopeDisplayTime.h"
|
||||
#import "DYHistogram.h"
|
||||
#include "DYFilmMath.h"
|
||||
@@ -59,6 +59,7 @@
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation;
|
||||
- (void)resetMesh;
|
||||
- (NSPoint)point:(NSInteger)index;
|
||||
- (NSRect)discRect;
|
||||
- (void)selectRing;
|
||||
- (void)selectSpoke;
|
||||
- (void)resetSelected;
|
||||
@@ -326,7 +327,15 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
NSView *spiderPanel=[inspector valueForKey:@"spiderPanel"];NSView<DYSpiderProbe> *disc=(id)[spiderPanel valueForKey:@"disc"];[disc setFrameSize:NSMakeSize(310,300)];auto initialMesh=DYSpiderMesh(disc.meshData);
|
||||
run.record(@"spider-default-six-by-six-31-nodes",initialMesh.hues==6&&initialMesh.rings==5&&dy::meshCount(initialMesh)==31);
|
||||
auto selectNode=[&](int index,NSEventModifierFlags flags){NSPoint pt=[disc point:index];[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,pt,flags)];[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,pt,flags)];};
|
||||
auto dragNode=[&](int index,float dx,float dy){NSPoint pt=[disc point:index];[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,pt)];[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(pt.x+dx*.5,pt.y+dy*.5))];[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(pt.x+dx,pt.y+dy))];[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,NSMakePoint(pt.x+dx,pt.y+dy))];};
|
||||
auto dragNode=[&](int index,float dx,float dy){
|
||||
NSPoint start=[disc point:index];NSRect rect=disc.discRect;
|
||||
auto mesh=DYSpiderMesh(disc.meshData);
|
||||
NSPoint target=DYSpiderPlotPoint(rect,mesh.x[index]+dx/NSWidth(rect),mesh.y[index]+dy/NSHeight(rect));
|
||||
[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,start)];
|
||||
[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint((start.x+target.x)*.5,(start.y+target.y)*.5))];
|
||||
[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,target)];
|
||||
[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,target)];
|
||||
};
|
||||
starts=uiHost->_undoStarts;ends=uiHost->_undoEnds;dragNode(2,18,8);DYAssetState *spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dragged=DYSpiderMesh(spiderSaved.spiderMesh);
|
||||
run.record(@"spider-single-drag-spoke-following-and-pin",dragged.x[0]>initialMesh.x[0]&&dragged.x[1]>initialMesh.x[1]&&dragged.x[3]>initialMesh.x[3]&&dragged.x[4]==initialMesh.x[4]&&dragged.x[5]==initialMesh.x[5]&&dragged.pins[2]);
|
||||
run.record(@"spider-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
|
||||
@@ -145,6 +145,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
|
||||
NSData *_scopePreview;
|
||||
NSDictionary *_scopeMetadata;
|
||||
DYColorProfile *_scopeProfile;
|
||||
NSObject *_scopeProfileLock;
|
||||
}
|
||||
@end
|
||||
@implementation DYRenderer
|
||||
@@ -156,8 +157,8 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
|
||||
#include "DYManagedRender.inc.h"
|
||||
#include "DYFaceRender.inc.h"
|
||||
#include "DYToolRender.inc.h"
|
||||
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_scopeQueue=dispatch_queue_create("com.dayu.color.final-output-scopes",DISPATCH_QUEUE_SERIAL);_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
|
||||
- (void)dealloc{[_mosaicRaster release];[_mosaicEntries release];[_mosaicFaceSnapshot release];[_faceEntries release];[_faceInput release];[_faceCachedEntries release];[_faceContext release];[_scopePending release];[_scopeLatest release];[_spiderScopeRaster release];[_scopePreview release];[_scopeMetadata release];[_scopeProfile release];dispatch_release(_scopeQueue);[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_colorContext release];[_previewLock release];[super dealloc];}
|
||||
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_scopeProfileLock=[NSObject new];_scopeQueue=dispatch_queue_create("com.dayu.color.final-output-scopes",DISPATCH_QUEUE_SERIAL);_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
|
||||
- (void)dealloc{[_mosaicRaster release];[_mosaicEntries release];[_mosaicFaceSnapshot release];[_faceEntries release];[_faceInput release];[_faceCachedEntries release];[_faceContext release];[_scopePending release];[_scopeLatest release];[_spiderScopeRaster release];[_scopePreview release];[_scopeMetadata release];[_scopeProfile release];[_scopeProfileLock release];dispatch_release(_scopeQueue);[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_colorContext release];[_previewLock release];[super dealloc];}
|
||||
- (void)trimPreparedLUTsKeeping:(NSString *)path {
|
||||
if(_preparedLUTs.count<=12)return;
|
||||
for(NSString *key in _preparedLUTs.allKeys)if(![_activeLUTPaths containsObject:key]&&![key isEqualToString:path])[_preparedLUTs removeObjectForKey:key];
|
||||
|
||||
+23
-19
@@ -40,8 +40,22 @@
|
||||
- (NSData *)canvasHistogramAtTime:(CMTime)time {
|
||||
return [self finalSampleAtTime:time].canvasHistogram;
|
||||
}
|
||||
- (DYColorProfile *)scopeProfileForSpace:(CGColorSpaceRef)space {
|
||||
if(!space)return nil;
|
||||
@synchronized(_scopeProfileLock){
|
||||
if(!_scopeProfile||!CFEqual(_scopeProfile.source,space)){
|
||||
CGColorSpaceRef target=CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB);
|
||||
if(!target)return nil;
|
||||
[_scopeProfile release];
|
||||
_scopeProfile=[[DYColorProfile alloc]initWithSource:space target:target error:nil];
|
||||
CGColorSpaceRelease(target);
|
||||
}
|
||||
return [[_scopeProfile retain]autorelease];
|
||||
}
|
||||
}
|
||||
- (NSData *)canvasSpiderScopeAtTime:(CMTime)time {
|
||||
return [self finalSampleAtTime:time].spiderScope;
|
||||
DYScopeSample *sample=[self finalSampleAtTime:time];
|
||||
return sample?[sample spiderScopeWithProfile:[self scopeProfileForSpace:sample.space]]:nil;
|
||||
}
|
||||
- (NSData *)outputSpiderScope {
|
||||
NSData *raster=nil;
|
||||
@@ -51,10 +65,10 @@
|
||||
if(!_scopeLatest||_spiderScopeWorkerRunning||_spiderScopeSerial==_scopeLatestSerial)return raster;
|
||||
_spiderScopeWorkerRunning=YES;
|
||||
}
|
||||
dispatch_async(_scopeQueue,^{@autoreleasepool{
|
||||
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0),^{@autoreleasepool{
|
||||
DYScopeSample *sample=nil;uint64_t serial;
|
||||
@synchronized(_previewLock){sample=[_scopeLatest retain];serial=_scopeLatestSerial;}
|
||||
NSData *measured=sample.spiderScope;
|
||||
NSData *measured=[sample spiderScopeWithProfile:[self scopeProfileForSpace:sample.space]];
|
||||
@synchronized(_previewLock){
|
||||
[_spiderScopeRaster release];_spiderScopeRaster=[measured retain];_spiderScopeSerial=serial;
|
||||
_spiderScopeWorkerRunning=NO;
|
||||
@@ -102,25 +116,15 @@
|
||||
for(;;){@autoreleasepool{
|
||||
DYScopeSample *sample=nil;@synchronized(_previewLock){sample=_scopePending;_scopePending=nil;if(!sample){_scopeWorkerRunning=NO;return;}}
|
||||
@synchronized(_previewLock){if(!_scopeEnabled||sample.generation!=_scopeGeneration){[sample release];continue;}}
|
||||
const auto *raw=(const dyscope::RGBA*)sample.pixels.bytes;size_t count=sample.pixels.length/sizeof(dyscope::RGBA);std::vector<DYCompositeRGBA> pixels(count);uint64_t invalid=0;
|
||||
for(size_t i=0;i<count;i++){
|
||||
const auto&p=raw[i];BOOL finite=std::isfinite(p.r)&&std::isfinite(p.g)&&std::isfinite(p.b)&&std::isfinite(p.a);
|
||||
if(!finite){invalid++;pixels[i]={0,0,0,0};continue;}
|
||||
if(p.a<=1e-6f){pixels[i]={0,0,0,0};continue;}
|
||||
pixels[i]={p.r/p.a,p.g/p.a,p.b/p.a,p.a};
|
||||
if(!(std::isfinite(pixels[i].r)&&std::isfinite(pixels[i].g)&&std::isfinite(pixels[i].b))){invalid++;pixels[i]={0,0,0,0};}
|
||||
}
|
||||
NSError *error=nil;BOOL converted=NO;CGColorSpaceRef target=CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB);
|
||||
if(sample.space&&target){
|
||||
if(!_scopeProfile||!CFEqual(_scopeProfile.source,sample.space)){[_scopeProfile release];_scopeProfile=[[DYColorProfile alloc]initWithSource:sample.space target:target error:&error];}
|
||||
if(_scopeProfile){auto result=[_scopeProfile convertPixels:pixels alpha:dycm::Alpha::Straight budget:32ull*1024*1024 cancelled:nullptr error:&error];if(result){pixels=std::move(*result);converted=YES;}}
|
||||
}if(target)CGColorSpaceRelease(target);
|
||||
std::vector<dyscope::RGBA> reference;reference.reserve(pixels.size());for(const auto&p:pixels)reference.push_back({p.r,p.g,p.b,p.a});
|
||||
auto measurements=dyscope::measure(reference);measurements.nonfinite+=invalid;
|
||||
auto reference=[sample displayReferenceWithProfile:[self scopeProfileForSpace:sample.space]];
|
||||
const auto &pixels=reference->pixels;
|
||||
uint64_t invalid=reference->invalid;
|
||||
BOOL converted=reference->converted;
|
||||
auto measurements=dyscope::measure(pixels);measurements.nonfinite+=invalid;
|
||||
auto wave=dyscope::densityImage(measurements.wave,false),parade=dyscope::densityImage(measurements.parade,true),vectors=dyscope::vectorImage(measurements.vectors);
|
||||
NSMutableDictionary *metadata=[[sample.metadata mutableCopy]autorelease];
|
||||
metadata[@"domain"]=converted?@"sRGB 显示参考":@"宿主 RGB(未换算)";
|
||||
metadata[@"note"]=converted?@"最终输出 · ICC 转扩展 sRGB · R′G′B′ 百分比;非 HDR / IRE 精密测量":(error?[NSString stringWithFormat:@"RGB 原值参考 · %@;波形按 709 权重参考,非 IRE",error.localizedDescription]:@"最终输出 · 空间未知;RGB 原值 / 709 权重波形参考,非显示 / HDR / IRE 测量");
|
||||
metadata[@"note"]=converted?@"最终输出 · ICC 转扩展 sRGB · R′G′B′ 百分比;非 HDR / IRE 精密测量":@"最终输出 · 未完成颜色空间换算;RGB 原值 / 709 权重波形参考,非显示 / HDR / IRE 测量";
|
||||
metadata[@"converted"]=@(converted);metadata[@"minimum"]=@(measurements.minimum);metadata[@"maximum"]=@(measurements.maximum);metadata[@"valid"]=@(measurements.valid);metadata[@"transparent"]=@(measurements.transparent>=invalid?measurements.transparent-invalid:0);metadata[@"nonfinite"]=@(measurements.nonfinite);metadata[@"below"]=@(measurements.below);metadata[@"above"]=@(measurements.above);
|
||||
metadata[@"waveform"]=[NSData dataWithBytes:wave.data() length:wave.size()];metadata[@"parade"]=[NSData dataWithBytes:parade.data() length:parade.size()];metadata[@"histogram"]=[NSData dataWithBytes:measurements.histogram.data() length:sizeof(measurements.histogram)];metadata[@"vectorscope"]=[NSData dataWithBytes:vectors.data() length:vectors.size()];
|
||||
BOOL publish=NO;@synchronized(_previewLock){if(_scopeEnabled&&sample.generation==_scopeGeneration){[_scopePreview release];_scopePreview=[[NSData alloc]initWithBytes:pixels.data() length:pixels.size()*sizeof(DYCompositeRGBA)];[_scopeMetadata release];_scopeMetadata=[metadata copy];publish=YES;}}
|
||||
|
||||
+28
-23
@@ -5,7 +5,7 @@
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include "SpiderCore/DYColorMath.h"
|
||||
#include "../../ColorManagement/Core/DYPremultiplied.h"
|
||||
|
||||
// Display-reference measurements only. Values remain unclipped; the plot
|
||||
// covers -10%...110% and explicitly counts samples beyond that range.
|
||||
@@ -13,9 +13,8 @@ namespace dyscope {
|
||||
inline constexpr unsigned Width=320,Height=180,Bins=256;
|
||||
inline constexpr float Low=-.1f,High=1.1f;
|
||||
// Conventional positive-I flesh-tone reference: 33 degrees left of +Cr.
|
||||
inline constexpr double SkinToneAngle=123.0*3.14159265358979323846/180.0;
|
||||
inline constexpr double SkinToneCb=-0.5446390350150271,SkinToneCr=0.8386705679454240;
|
||||
struct RGBA { float r,g,b,a; };
|
||||
using RGBA=DYCompositeRGBA;
|
||||
struct Result {
|
||||
std::vector<uint32_t> wave=std::vector<uint32_t>(Width*Bins),parade=std::vector<uint32_t>(3*Width*Bins),vectors=std::vector<uint32_t>(Bins*Bins);
|
||||
std::array<uint32_t,4*Bins> histogram{};
|
||||
@@ -25,15 +24,32 @@ struct Result {
|
||||
inline unsigned bin(float v){if(!(v>Low))return 0;if(v>=High)return Bins-1;return unsigned(std::clamp(std::lround((v-Low)/(High-Low)*(Bins-1)),0l,long(Bins-1)));}
|
||||
// BT.709 colour-difference coordinates on the same encoded display-reference
|
||||
// RGB used by the existing scopes (ITU-R BT.709-6 section 3.3). Not an IRE meter.
|
||||
inline unsigned chromaBin(float v){if(!(v>-.6f))return 0;if(v>=.6f)return Bins-1;return unsigned(std::clamp(std::lround((v+.6f)/1.2f*(Bins-1)),0l,long(Bins-1)));}
|
||||
inline constexpr float Kr=.2126f,Kg=.7152f,Kb=.0722f;
|
||||
inline constexpr float ChromaLimit=.6f;
|
||||
struct Chroma {float cb,cr;};
|
||||
inline float luminance(const RGBA &p){return Kr*p.r+Kg*p.g+Kb*p.b;}
|
||||
inline Chroma chroma(const RGBA &p,float y){return {(p.b-y)/(2*(1-Kb)),(p.r-y)/(2*(1-Kr))};}
|
||||
inline RGBA chromaRGB(Chroma c){
|
||||
float r=2*(1-Kr)*c.cr,b=2*(1-Kb)*c.cb;
|
||||
return {r,-(Kr*r+Kb*b)/Kg,b,1};
|
||||
}
|
||||
inline unsigned chromaBin(float v){
|
||||
if(!(v>-ChromaLimit))return 0;
|
||||
if(v>=ChromaLimit)return Bins-1;
|
||||
return unsigned(std::clamp(std::lround((v+ChromaLimit)/(2*ChromaLimit)*(Bins-1)),0l,long(Bins-1)));
|
||||
}
|
||||
inline size_t vectorIndex(Chroma c){return (Bins-1-chromaBin(c.cr))*Bins+chromaBin(c.cb);}
|
||||
inline bool visible(const RGBA &p){
|
||||
return std::isfinite(p.r)&&std::isfinite(p.g)&&std::isfinite(p.b)&&std::isfinite(p.a)&&p.a>1e-6f;
|
||||
}
|
||||
inline Result measure(std::span<const RGBA> pixels,unsigned width=Width,unsigned height=Height){
|
||||
Result r;if(!width||!height||pixels.size()!=size_t(width)*height)return r;bool first=true;
|
||||
for(unsigned y=0;y<height;y++)for(unsigned x=0;x<width;x++){
|
||||
const auto&p=pixels[size_t(y)*width+x];
|
||||
if(!(std::isfinite(p.r)&&std::isfinite(p.g)&&std::isfinite(p.b)&&std::isfinite(p.a))){r.nonfinite++;continue;}
|
||||
if(p.a<=1e-6f){r.transparent++;continue;}
|
||||
float values[4]={.2126f*p.r+.7152f*p.g+.0722f*p.b,p.r,p.g,p.b};unsigned column=std::min(Width-1,unsigned(uint64_t(x)*Width/width));
|
||||
float cb=(p.b-values[0])/1.8556f,cr=(p.r-values[0])/1.5748f;r.vectors[(Bins-1-chromaBin(cr))*Bins+chromaBin(cb)]++;
|
||||
float values[4]={luminance(p),p.r,p.g,p.b};unsigned column=std::min(Width-1,unsigned(uint64_t(x)*Width/width));
|
||||
r.vectors[vectorIndex(chroma(p,values[0]))]++;
|
||||
for(unsigned c=0;c<4;c++){
|
||||
float v=values[c];unsigned b=bin(v);r.histogram[c*Bins+b]++;
|
||||
if(!c)r.wave[(Bins-1-b)*Width+column]++;
|
||||
@@ -58,30 +74,19 @@ inline std::vector<uint8_t> vectorImage(std::span<const uint32_t> counts){
|
||||
if(counts.size()!=Bins*Bins)return {};std::vector<uint8_t> out(counts.size()*4);uint32_t maximum=0;for(uint32_t n:counts)maximum=std::max(maximum,n);float divisor=std::log1p(float(maximum));
|
||||
for(size_t i=0;i<counts.size();i++){float cb=float(i%Bins)/(Bins-1)*1.2f-.6f,cr=.6f-float(i/Bins)/(Bins-1)*1.2f;float intensity=counts[i]&&divisor>0?std::pow(std::log1p(float(counts[i]))/divisor,.65f):0;float colors[]={.5f+1.5748f*cr,.5f-.187324f*cb-.468124f*cr,.5f+1.8556f*cb};float peak=std::max({colors[0],colors[1],colors[2],.001f});for(int c=0;c<3;c++)out[i*4+c]=uint8_t(std::lround(std::clamp(colors[c]/peak,0.f,1.f)*intensity*255));out[i*4+3]=255;}return out;
|
||||
}
|
||||
inline constexpr unsigned SpiderBins=192;
|
||||
inline constexpr float SpiderSkinAngle=28.f*3.14159265358979323846f/180.f;
|
||||
// Transparent rendering of the same Cb/Cr bins used by the full scope.
|
||||
inline std::vector<uint8_t> spiderVectorImage(std::span<const RGBA> pixels) {
|
||||
std::vector<uint32_t> density(SpiderBins*SpiderBins);
|
||||
constexpr float radius=(SpiderBins-1)*.5f;
|
||||
constexpr float tau=6.28318530718f;
|
||||
std::vector<uint32_t> density(Bins*Bins);
|
||||
uint32_t peak=0;
|
||||
for(const auto &pixel:pixels){
|
||||
if(!std::isfinite(pixel.a)||pixel.a<=1e-6f||
|
||||
!std::isfinite(pixel.r)||!std::isfinite(pixel.g)||!std::isfinite(pixel.b))continue;
|
||||
auto hsv=dyRGBHSV(float3{pixel.r/pixel.a,pixel.g/pixel.a,pixel.b/pixel.a});
|
||||
if(!std::isfinite(hsv.x)||!std::isfinite(hsv.y))continue;
|
||||
float distance=radius*std::clamp(hsv.y,0.f,1.f),angle=hsv.x*tau;
|
||||
unsigned x=std::lround(radius+std::cos(angle)*distance);
|
||||
unsigned y=std::lround(radius+std::sin(angle)*distance);
|
||||
peak=std::max(peak,++density[y*SpiderBins+x]);
|
||||
}
|
||||
for(const auto &pixel:pixels)if(visible(pixel))
|
||||
peak=std::max(peak,++density[vectorIndex(chroma(pixel,luminance(pixel)))]);
|
||||
std::vector<uint8_t> raster(density.size()*4);
|
||||
if(!peak)return raster;
|
||||
float maximum=std::log1p(float(peak));
|
||||
for(size_t i=0;i<density.size();i++){
|
||||
if(!density[i])continue;
|
||||
float intensity=std::sqrt(std::log1p(float(density[i]))/maximum);
|
||||
uint8_t alpha=std::lround(255.f*(.24f+.76f*intensity));
|
||||
float intensity=std::pow(std::log1p(float(density[i]))/maximum,1.15f);
|
||||
uint8_t alpha=std::lround(255.f*(.035f+.68f*intensity));
|
||||
std::fill_n(raster.data()+4*i,4,alpha); // premultiplied white
|
||||
}
|
||||
return raster;
|
||||
|
||||
+12
-2
@@ -1,6 +1,15 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#include "DYScopeMath.hpp"
|
||||
#include <memory>
|
||||
@class DYColorProfile;
|
||||
struct DYScopeReference {
|
||||
std::vector<dyscope::RGBA> pixels;
|
||||
uint64_t invalid=0;
|
||||
bool converted=false;
|
||||
};
|
||||
|
||||
@interface DYScopeSample : NSObject
|
||||
@property(nonatomic,copy) NSData *pixels;
|
||||
@property(nonatomic,copy) NSDictionary *metadata;
|
||||
@@ -8,6 +17,7 @@
|
||||
@property(nonatomic) CGColorSpaceRef space;
|
||||
/// Final-output bins in the host RGB domain, calculated only if requested.
|
||||
@property(nonatomic,readonly) NSData *canvasHistogram;
|
||||
/// Transparent density raster in the spider's hue/saturation coordinates.
|
||||
@property(nonatomic,readonly) NSData *spiderScope;
|
||||
/// Shared straight-alpha display samples for the workspace and spider scopes.
|
||||
- (std::shared_ptr<const DYScopeReference>)displayReferenceWithProfile:(DYColorProfile *)profile;
|
||||
- (NSData *)spiderScopeWithProfile:(DYColorProfile *)profile;
|
||||
@end
|
||||
+32
-4
@@ -1,8 +1,11 @@
|
||||
#import "DYScopeSample.h"
|
||||
#import "DYHistogram.h"
|
||||
#include "DYScopeMath.hpp"
|
||||
#import "../../ColorManagement/Sources/DYColorProfile.h"
|
||||
#include <mutex>
|
||||
@implementation DYScopeSample {
|
||||
NSData *_canvasHistogram,*_spiderScope;
|
||||
std::shared_ptr<const DYScopeReference> _reference;
|
||||
std::mutex _referenceMutex;
|
||||
}
|
||||
- (NSData *)canvasHistogram{
|
||||
@synchronized(self){
|
||||
@@ -10,10 +13,35 @@
|
||||
return [[_canvasHistogram retain]autorelease];
|
||||
}
|
||||
}
|
||||
- (NSData *)spiderScope {
|
||||
- (std::shared_ptr<const DYScopeReference>)displayReferenceWithProfile:(DYColorProfile *)profile {
|
||||
std::lock_guard<std::mutex> lock(_referenceMutex);
|
||||
if(_reference)return _reference;
|
||||
const auto *raw=(const dyscope::RGBA *)_pixels.bytes;
|
||||
auto reference=std::make_shared<DYScopeReference>();
|
||||
reference->pixels.resize(_pixels.length/sizeof(*raw));
|
||||
for(size_t i=0;i<reference->pixels.size();i++){
|
||||
const auto &p=raw[i];
|
||||
if(!std::isfinite(p.r)||!std::isfinite(p.g)||!std::isfinite(p.b)||!std::isfinite(p.a)){
|
||||
reference->invalid++;
|
||||
continue;
|
||||
}
|
||||
if(p.a<=1e-6f)continue;
|
||||
dyscope::RGBA straight={p.r/p.a,p.g/p.a,p.b/p.a,p.a};
|
||||
if(dyscope::visible(straight))reference->pixels[i]=straight;
|
||||
else reference->invalid++;
|
||||
}
|
||||
if(profile){
|
||||
auto result=[profile convertPixels:reference->pixels alpha:dycm::Alpha::Straight
|
||||
budget:32ull*1024*1024 cancelled:nullptr error:nil];
|
||||
if(result){reference->pixels=std::move(*result);reference->converted=true;}
|
||||
}
|
||||
_reference=reference;
|
||||
return _reference;
|
||||
}
|
||||
- (NSData *)spiderScopeWithProfile:(DYColorProfile *)profile {
|
||||
@synchronized(self){if(_spiderScope)return [[_spiderScope retain]autorelease];}
|
||||
const auto *pixels=(const dyscope::RGBA *)_pixels.bytes;
|
||||
auto raster=dyscope::spiderVectorImage({pixels,_pixels.length/sizeof(*pixels)});
|
||||
auto reference=[self displayReferenceWithProfile:profile];
|
||||
auto raster=dyscope::spiderVectorImage(reference->pixels);
|
||||
NSData *data=[NSData dataWithBytes:raster.data() length:raster.size()];
|
||||
@synchronized(self){
|
||||
if(!_spiderScope)_spiderScope=[data retain];
|
||||
|
||||
@@ -76,19 +76,40 @@
|
||||
if(c=='\t'){_selected=(_selected+(e.modifierFlags&NSEventModifierFlagShift?[self nodeCount]-1:1)+[self nodeCount])%[self nodeCount];[_selection removeAllIndexes];[_selection addIndex:_selected];[self describeSelection];self.needsDisplay=YES;return;}
|
||||
if(c==' '){[self toggleLock];return;}if(c==NSDeleteCharacter||c==NSBackspaceCharacter){[self resetSelected];return;}
|
||||
float step=e.modifierFlags&NSEventModifierFlagShift?.02f:.005f;
|
||||
if(c==NSLeftArrowFunctionKey)[self moveFrom:_grade x:-step y:0];else if(c==NSRightArrowFunctionKey)[self moveFrom:_grade x:step y:0];else if(c==NSUpArrowFunctionKey)[self moveFrom:_grade x:0 y:-step];else if(c==NSDownArrowFunctionKey)[self moveFrom:_grade x:0 y:step];else[super keyDown:e];
|
||||
NSPoint move=NSZeroPoint;
|
||||
if(c==NSLeftArrowFunctionKey)move.x=-step;
|
||||
else if(c==NSRightArrowFunctionKey)move.x=step;
|
||||
else if(c==NSUpArrowFunctionKey)move.y=-step;
|
||||
else if(c==NSDownArrowFunctionKey)move.y=step;
|
||||
else{[super keyDown:e];return;}
|
||||
if(_selection.count){
|
||||
NSInteger lead=_selected>=0&&[_selection containsIndex:_selected]?_selected:_selection.firstIndex;
|
||||
NSRect rect=self.discRect;
|
||||
NSPoint delta=DYSpiderMeshDelta(rect,_mesh.x[lead],_mesh.y[lead],NSMakePoint(move.x*NSWidth(rect),move.y*NSHeight(rect)));
|
||||
[self moveFrom:_grade x:delta.x y:delta.y];
|
||||
}
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)r{if((self=[super initWithFrame:r])){_grade=dyDefaultGrade();_mesh=dy::legacyMesh(_grade);_selected=-1;self.pinData=nil;self.selection=[NSMutableIndexSet indexSet];_interactionEnabled=YES;self.accessibilityLabel=@"蜘蛛盘,含矢量示波器和肤色指示线";}return self;}
|
||||
- (NSRect)discRect{CGFloat s=MAX(0,MIN(self.bounds.size.width,self.bounds.size.height)-32);return NSMakeRect((self.bounds.size.width-s)/2,(self.bounds.size.height-s)/2,s,s);}
|
||||
- (NSPoint)point:(NSInteger)i{NSRect r=self.discRect;return NSMakePoint(r.origin.x+_mesh.x[i]*r.size.width,r.origin.y+_mesh.y[i]*r.size.height);}
|
||||
- (NSPoint)point:(NSInteger)i{return DYSpiderPlotPoint(self.discRect,_mesh.x[i],_mesh.y[i]);}
|
||||
- (void)setGrade:(DYGrade)g{if(memcmp(g.spiderX,_grade.spiderX,sizeof(g.spiderX))||memcmp(g.spiderY,_grade.spiderY,sizeof(g.spiderY))){_grade=g;self.meshData=nil;}else _grade=g;self.needsDisplay=YES;}
|
||||
- (void)drawRect:(NSRect)dirty{
|
||||
NSRect r=self.discRect;if(NSIsEmptyRect(r))return;NSPoint c=NSMakePoint(NSMidX(r),NSMidY(r));CGFloat rad=r.size.width/2;
|
||||
for(int s=0;s<64;s++)for(int ring=1;ring<=5;ring++){double a=s*M_PI/32,b=(s+1)*M_PI/32;NSBezierPath*p=[NSBezierPath bezierPath];[p moveToPoint:NSMakePoint(c.x+cos(a)*(ring-1)*rad/5,c.y+sin(a)*(ring-1)*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(a)*ring*rad/5,c.y+sin(a)*ring*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(b)*ring*rad/5,c.y+sin(b)*ring*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(b)*(ring-1)*rad/5,c.y+sin(b)*(ring-1)*rad/5)];[p closePath];[[NSColor colorWithCalibratedHue:s/64. saturation:ring/5. brightness:.22 alpha:1]setFill];[p fill];}
|
||||
NSRect r=self.discRect;if(NSIsEmptyRect(r))return;
|
||||
DYDrawSpiderScope(r,[self canDisplayScope]?[_scopeRenderer outputSpiderScope]:nil,1);
|
||||
[[NSColor colorWithWhite:1 alpha:.26]setStroke];for(int ring=1;ring<=_mesh.rings;ring++){NSBezierPath *p=[NSBezierPath bezierPath];for(int s=0;s<=_mesh.hues;s++){NSPoint q=[self point:dy::meshIndex(_mesh,s%_mesh.hues,ring)];if(s==0)[p moveToPoint:q];else[p lineToPoint:q];}[p stroke];}
|
||||
for(int s=0;s<_mesh.hues;s++){NSBezierPath*p=[NSBezierPath bezierPath];[p moveToPoint:[self point:[self nodeCount]-1]];for(int ring=1;ring<=_mesh.rings;ring++)[p lineToPoint:[self point:dy::meshIndex(_mesh,s,ring)]];[p stroke];}
|
||||
for(int i=0;i<[self nodeCount];i++){NSPoint p=[self point:i];CGFloat z=[_selection containsIndex:i]?4.5:2.6;NSBezierPath *d=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-z,p.y-z,z*2,z*2)];[([_selection containsIndex:i]?DYAccent():[NSColor colorWithWhite:1 alpha:.85])setFill];[d fill];[[NSColor colorWithWhite:0 alpha:.8]setStroke];d.lineWidth=.85;[d stroke];if([_selection containsIndex:i]){[NSColor.whiteColor setStroke];[d stroke];}if([_pinned containsIndex:i]){[NSColor.blackColor setFill];NSRectFill(NSMakeRect(p.x-1,p.y-1,2,2));}}
|
||||
NSBezierPath *net=[NSBezierPath bezierPath];
|
||||
for(int ring=1;ring<=_mesh.rings;ring++){
|
||||
for(int hue=0;hue<=_mesh.hues;hue++){
|
||||
NSPoint q=[self point:dy::meshIndex(_mesh,hue%_mesh.hues,ring)];
|
||||
if(hue==0)[net moveToPoint:q];else[net lineToPoint:q];
|
||||
}
|
||||
}
|
||||
for(int hue=0;hue<_mesh.hues;hue++){
|
||||
[net moveToPoint:[self point:[self nodeCount]-1]];
|
||||
for(int ring=1;ring<=_mesh.rings;ring++)[net lineToPoint:[self point:dy::meshIndex(_mesh,hue,ring)]];
|
||||
}
|
||||
DYDrawSpiderNet(net,1);
|
||||
for(int i=0;i<[self nodeCount];i++)
|
||||
DYDrawSpiderNode([self point:i],1,[_selection containsIndex:i]?DYAccent():nil,[_pinned containsIndex:i]);
|
||||
if(_marquee){
|
||||
NSRect box=NSMakeRect(MIN(_dragOrigin.x,_marqueeEnd.x),MIN(_dragOrigin.y,_marqueeEnd.y),fabs(_dragOrigin.x-_marqueeEnd.x),fabs(_dragOrigin.y-_marqueeEnd.y));
|
||||
NSBezierPath*outline=[NSBezierPath bezierPathWithRect:box];outline.lineWidth=1.25;
|
||||
@@ -115,7 +136,8 @@
|
||||
- (void)mouseDragged:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;NSPoint p=[self convertPoint:e.locationInWindow fromView:nil];
|
||||
if(_marquee){_marqueeEnd=p;NSRect box=NSMakeRect(MIN(_dragOrigin.x,p.x),MIN(_dragOrigin.y,p.y),fabs(p.x-_dragOrigin.x),fabs(p.y-_dragOrigin.y));self.selection=[[_selectionStart mutableCopy]autorelease];for(int i=0;i<[self nodeCount];i++)if(NSPointInRect([self point:i],box))[_selection addIndex:i];[self describeSelection];self.needsDisplay=YES;}
|
||||
else if(_dragging){if(!_gestureActive){_gestureActive=YES;if(_gesture)_gesture(YES);}NSRect r=self.discRect;[self moveFrom:_dragGrade x:(p.x-_dragOrigin.x)/r.size.width y:(p.y-_dragOrigin.y)/r.size.height];}
|
||||
else if(_dragging){if(!_gestureActive){_gestureActive=YES;if(_gesture)_gesture(YES);}NSPoint delta=DYSpiderMeshDelta(self.discRect,_dragMesh.x[_selected],_dragMesh.y[_selected],
|
||||
NSMakePoint(p.x-_dragOrigin.x,p.y-_dragOrigin.y));[self moveFrom:_dragGrade x:delta.x y:delta.y];}
|
||||
}
|
||||
- (void)mouseUp:(NSEvent*)e{_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;}
|
||||
@end
|
||||
|
||||
+112
-28
@@ -1,49 +1,133 @@
|
||||
#pragma once
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "DYScopeMath.hpp"
|
||||
#include "SpiderCore/DYColorMath.h"
|
||||
|
||||
// The spider and the OSC both draw in top-down coordinates. Keep the
|
||||
// scopes below the editable mesh and clip the raster to the wheel.
|
||||
static inline void DYDrawSpiderScope(NSRect rect, NSData *raster, CGFloat scale) {
|
||||
// Shared Cb/Cr display coordinates. Positive Cr goes up in a flipped view.
|
||||
static inline NSPoint DYScopePoint(NSRect rect, double cb, double cr) {
|
||||
return NSMakePoint(NSMidX(rect)+cb*NSWidth(rect)/(2*dyscope::ChromaLimit),
|
||||
NSMidY(rect)-cr*NSHeight(rect)/(2*dyscope::ChromaLimit));
|
||||
}
|
||||
static inline NSPoint DYSkinScopePoint(NSRect rect, double radiusFraction) {
|
||||
return DYScopePoint(rect,dyscope::SkinToneCb*dyscope::ChromaLimit*radiusFraction,
|
||||
dyscope::SkinToneCr*dyscope::ChromaLimit*radiusFraction);
|
||||
}
|
||||
|
||||
// Stored spider points remain HSV. Only the displayed angle changes; the
|
||||
// distance from center still represents the mesh's editable saturation ring.
|
||||
static inline float DYSpiderHueAtChroma(float cb,float cr) {
|
||||
auto p=dyscope::chromaRGB({cb,cr});
|
||||
return dyRGBHSV(float3{p.r,p.g,p.b}).x;
|
||||
}
|
||||
static inline NSPoint DYSpiderPlotPoint(NSRect rect,double x,double y) {
|
||||
double distance=hypot(x-.5,y-.5);
|
||||
if(distance==0)return NSMakePoint(NSMidX(rect),NSMidY(rect));
|
||||
double hue=atan2(y-.5,x-.5)/(2*M_PI);
|
||||
auto rgb=dyHSVRGB(float3{(float)hue,1,1});
|
||||
dyscope::RGBA color={rgb.x,rgb.y,rgb.z,1};
|
||||
auto c=dyscope::chroma(color,dyscope::luminance(color));
|
||||
double scale=distance*2*dyscope::ChromaLimit/hypot(c.cb,c.cr);
|
||||
return DYScopePoint(rect,c.cb*scale,c.cr*scale);
|
||||
}
|
||||
static inline NSPoint DYSpiderMeshPoint(NSRect rect,NSPoint point) {
|
||||
if(NSIsEmptyRect(rect))return NSMakePoint(.5,.5);
|
||||
double cb=(point.x-NSMidX(rect))/NSWidth(rect),cr=(NSMidY(rect)-point.y)/NSHeight(rect);
|
||||
double radius=hypot(cb,cr),angle=2*M_PI*DYSpiderHueAtChroma(cb,cr);
|
||||
return NSMakePoint(.5+cos(angle)*radius,.5+sin(angle)*radius);
|
||||
}
|
||||
static inline NSPoint DYSpiderMeshDelta(NSRect rect,double x,double y,NSPoint movement) {
|
||||
if(NSIsEmptyRect(rect)||NSEqualPoints(movement,NSZeroPoint))return NSZeroPoint;
|
||||
NSPoint target=DYSpiderPlotPoint(rect,x,y);
|
||||
target.x+=movement.x;target.y+=movement.y;
|
||||
NSPoint mapped=DYSpiderMeshPoint(rect,target);
|
||||
return NSMakePoint(mapped.x-x,mapped.y-y);
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderWheel(NSRect rect) {
|
||||
// Cache the smooth color field. A neutral center separates the trace from
|
||||
// the hue around the perimeter, and the field is shared by every mesh size.
|
||||
static NSImage *wheel;
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once,^{
|
||||
constexpr NSInteger side=256;
|
||||
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:nil
|
||||
pixelsWide:side pixelsHigh:side bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES
|
||||
isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:side*4 bitsPerPixel:32]autorelease];
|
||||
for(NSInteger y=0;y<side;y++)for(NSInteger x=0;x<side;x++){
|
||||
float cb=(x+.5f-side*.5f)/(side*.5f),cr=(side*.5f-y-.5f)/(side*.5f);
|
||||
float radius=std::min(1.f,std::hypot(cb,cr));
|
||||
auto color=dyHSVRGB(float3{DYSpiderHueAtChroma(cb,cr),radius*.93f,.225f+.17f*radius});
|
||||
uint8_t *out=bitmap.bitmapData+4*(y*side+x);
|
||||
out[0]=std::lround(color.x*255);out[1]=std::lround(color.y*255);
|
||||
out[2]=std::lround(color.z*255);out[3]=255;
|
||||
}
|
||||
wheel=[[NSImage alloc]initWithSize:NSMakeSize(side,side)];
|
||||
[wheel addRepresentation:bitmap];
|
||||
});
|
||||
[wheel drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
|
||||
fraction:1 respectFlipped:YES hints:nil];
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderTrace(NSRect rect, NSData *raster) {
|
||||
constexpr size_t side=dyscope::Bins;
|
||||
if(raster.length!=side*side*4)return;
|
||||
CGDataProviderRef provider=CGDataProviderCreateWithCFData((CFDataRef)raster);
|
||||
CGColorSpaceRef space=CGColorSpaceCreateDeviceRGB();
|
||||
CGImageRef image=CGImageCreate(side,side,8,32,side*4,space,kCGImageAlphaPremultipliedLast,
|
||||
provider,nullptr,false,kCGRenderingIntentDefault);
|
||||
if(image){
|
||||
NSImage *trace=[[[NSImage alloc]initWithCGImage:image size:NSZeroSize]autorelease];
|
||||
[trace drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
|
||||
fraction:1 respectFlipped:YES hints:@{NSImageHintInterpolation:@(NSImageInterpolationLow)}];
|
||||
CGImageRelease(image);
|
||||
}
|
||||
CGColorSpaceRelease(space);CGDataProviderRelease(provider);
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderScope(NSRect rect,NSData *raster,CGFloat scale) {
|
||||
if(NSIsEmptyRect(rect))return;
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[[NSBezierPath bezierPathWithOvalInRect:rect]addClip];
|
||||
constexpr size_t side=dyscope::SpiderBins;
|
||||
if(raster.length==side*side*4){
|
||||
CGDataProviderRef provider=CGDataProviderCreateWithCFData((CFDataRef)raster);
|
||||
CGColorSpaceRef space=CGColorSpaceCreateDeviceRGB();
|
||||
CGImageRef image=CGImageCreate(side,side,8,32,side*4,space,kCGImageAlphaPremultipliedLast,
|
||||
provider,nullptr,false,kCGRenderingIntentDefault);
|
||||
if(image){
|
||||
NSImage *trace=[[[NSImage alloc]initWithCGImage:image size:NSZeroSize]autorelease];
|
||||
[trace drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
|
||||
fraction:1 respectFlipped:YES hints:@{NSImageHintInterpolation:@(NSImageInterpolationLow)}];
|
||||
CGImageRelease(image);
|
||||
}
|
||||
CGColorSpaceRelease(space);CGDataProviderRelease(provider);
|
||||
}
|
||||
DYDrawSpiderWheel(rect);
|
||||
DYDrawSpiderTrace(rect,raster);
|
||||
|
||||
NSPoint center=NSMakePoint(NSMidX(rect),NSMidY(rect));
|
||||
CGFloat radius=NSWidth(rect)*.5;
|
||||
CGFloat dx=cos(dyscope::SpiderSkinAngle),dy=sin(dyscope::SpiderSkinAngle);
|
||||
NSBezierPath *line=[NSBezierPath bezierPath];
|
||||
[line moveToPoint:NSMakePoint(center.x+dx*radius*.08,center.y+dy*radius*.08)];
|
||||
[line lineToPoint:NSMakePoint(center.x+dx*radius*.91,center.y+dy*radius*.91)];
|
||||
[line moveToPoint:DYSkinScopePoint(rect,.08)];
|
||||
[line lineToPoint:DYSkinScopePoint(rect,.93)];
|
||||
CGFloat dashes[]={4*scale,3*scale};
|
||||
[line setLineDash:dashes count:2 phase:0];
|
||||
line.lineWidth=2.6*scale;
|
||||
[[NSColor colorWithWhite:0 alpha:.85]setStroke];[line stroke];
|
||||
line.lineWidth=1.2*scale;
|
||||
line.lineWidth=2.7*scale;
|
||||
[[NSColor colorWithWhite:0 alpha:.9]setStroke];[line stroke];
|
||||
line.lineWidth=1.15*scale;
|
||||
[[NSColor colorWithSRGBRed:1 green:.79 blue:.57 alpha:1]setStroke];[line stroke];
|
||||
if(radius>=36*scale){
|
||||
if(NSWidth(rect)>=72*scale){
|
||||
NSDictionary *attrs=@{NSFontAttributeName:[NSFont systemFontOfSize:9*scale weight:NSFontWeightMedium],
|
||||
NSForegroundColorAttributeName:[NSColor colorWithSRGBRed:1 green:.88 blue:.74 alpha:1]};
|
||||
NSString *label=@"肤色";NSSize size=[label sizeWithAttributes:attrs];
|
||||
NSPoint anchor=NSMakePoint(center.x+dx*radius*.73-size.width/2,center.y+dy*radius*.73+4*scale);
|
||||
NSPoint anchor=DYSkinScopePoint(rect,.83);
|
||||
anchor.x+=4*scale;anchor.y-=size.height*.65;
|
||||
NSRect tag=NSInsetRect(NSMakeRect(anchor.x,anchor.y,size.width,size.height),-3*scale,-1*scale);
|
||||
[[NSColor colorWithWhite:.08 alpha:.92]setFill];
|
||||
[[NSColor colorWithWhite:.09 alpha:.93]setFill];
|
||||
[[NSBezierPath bezierPathWithRoundedRect:tag xRadius:3*scale yRadius:3*scale]fill];
|
||||
[label drawAtPoint:anchor withAttributes:attrs];
|
||||
}
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderNet(NSBezierPath *net,CGFloat scale) {
|
||||
net.lineWidth=1.65*scale;
|
||||
[[NSColor colorWithWhite:0 alpha:.63]setStroke];[net stroke];
|
||||
net.lineWidth=.7*scale;
|
||||
[[NSColor colorWithWhite:1 alpha:.55]setStroke];[net stroke];
|
||||
}
|
||||
static inline void DYDrawSpiderNode(NSPoint p,CGFloat scale,NSColor *selection,BOOL pinned) {
|
||||
CGFloat radius=(selection?4.2:2.9)*scale;
|
||||
NSBezierPath *dot=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-radius,p.y-radius,2*radius,2*radius)];
|
||||
[(selection?:[NSColor colorWithWhite:.62 alpha:1])setFill];[dot fill];
|
||||
dot.lineWidth=(selection?1.9:1.55)*scale;
|
||||
[[NSColor colorWithWhite:.065 alpha:1]setStroke];[dot stroke];
|
||||
if(pinned){
|
||||
[NSColor.blackColor setFill];
|
||||
NSRectFill(NSMakeRect(p.x-scale,p.y-scale,2*scale,2*scale));
|
||||
}
|
||||
}
|
||||
@@ -61,15 +61,15 @@
|
||||
[NSGraphicsContext restoreGraphicsState];[self text:@"红 橙 黄 绿 青 蓝 紫 洋红" rect:NSMakeRect(r.origin.x,NSMaxY(r)+3*s,r.size.width,15*s)size:9 color:ink alignment:NSTextAlignmentCenter];return;
|
||||
}
|
||||
if([area[@"kind"]isEqual:@"spiderPlot"]){
|
||||
auto mesh=DYSpiderMesh([self spiderData]);CGFloat rad=r.size.width/2;NSPoint center=NSMakePoint(NSMidX(r),NSMidY(r));
|
||||
for(int i=0;i<64;i++){double a=i*2*M_PI/64,b=(i+1)*2*M_PI/64;NSBezierPath *wedge=[NSBezierPath bezierPath];[wedge moveToPoint:center];[wedge lineToPoint:NSMakePoint(center.x+cos(a)*rad,center.y+sin(a)*rad)];[wedge lineToPoint:NSMakePoint(center.x+cos(b)*rad,center.y+sin(b)*rad)];[wedge closePath];[[NSColor colorWithHue:i/64. saturation:.8 brightness:.19 alpha:1]setFill];[wedge fill];}
|
||||
auto mesh=DYSpiderMesh([self spiderData]);
|
||||
DYDrawSpiderScope(r,[_bridge canvasSpiderScopeAtTime:_time],s);
|
||||
ink=[NSColor colorWithWhite:.94 alpha:1];
|
||||
auto point=[&](int i){return NSMakePoint(r.origin.x+mesh.x[i]*r.size.width,r.origin.y+mesh.y[i]*r.size.height);};NSBezierPath *net=[NSBezierPath bezierPath];net.lineWidth=.6*s;
|
||||
auto point=[&](int i){return DYSpiderPlotPoint(r,mesh.x[i],mesh.y[i]);};
|
||||
NSBezierPath *net=[NSBezierPath bezierPath];
|
||||
for(int ring=1;ring<=mesh.rings;ring++)for(int hue=0;hue<=mesh.hues;hue++){NSPoint q=point(dy::meshIndex(mesh,hue%mesh.hues,ring));if(hue==0)[net moveToPoint:q];else[net lineToPoint:q];}
|
||||
for(int hue=0;hue<mesh.hues;hue++){[net moveToPoint:point(dy::meshCount(mesh)-1)];for(int ring=1;ring<=mesh.rings;ring++)[net lineToPoint:point(dy::meshIndex(mesh,hue,ring))];}
|
||||
[[ink colorWithAlphaComponent:.26]setStroke];[net stroke];
|
||||
for(int i=0;i<dy::meshCount(mesh);i++){NSPoint q=point(i);CGFloat rr=(i==_selectedSpider?4:2)*s;[(i==_selectedSpider?accent:ink)setFill];NSBezierPath *dot=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(q.x-rr,q.y-rr,2*rr,2*rr)];[dot fill];dot.lineWidth=.85*s;[[NSColor colorWithWhite:0 alpha:.8]setStroke];[dot stroke];if(mesh.pins[i]){[NSColor.blackColor setFill];NSRectFill(NSMakeRect(q.x-s,q.y-s,2*s,2*s));}}return;
|
||||
DYDrawSpiderNet(net,s);
|
||||
for(int i=0;i<dy::meshCount(mesh);i++)DYDrawSpiderNode(point(i),s,i==_selectedSpider?accent:nil,mesh.pins[i]);
|
||||
return;
|
||||
}
|
||||
if([area[@"kind"]isEqual:@"wheel"]){
|
||||
NSInteger index=[area[@"index"]integerValue];[self text:area[@"title"]rect:NSMakeRect(r.origin.x,r.origin.y-19*s,r.size.width,17*s)size:10 color:ink alignment:NSTextAlignmentCenter];
|
||||
@@ -105,7 +105,7 @@
|
||||
BOOL center=[c[@"kind"]isEqual:@"lensCenter"];NSArray *keys=center?@[@"lensCenterX",@"lensCenterY"]:@[@"lensStrength"];NSMutableArray *descriptors=[NSMutableArray array];NSMutableDictionary *values=[NSMutableDictionary dictionary];for(NSString *key in keys){[descriptors addObject:[self descriptorForKey:key]];values[key]=@([self graphicValue:key]);}c[@"lensStart"]=values;[_captured release];_captured=[c copy];[_bridge beginParameters:descriptors node:_nodeID values:values atTime:_time];return;
|
||||
}
|
||||
|
||||
if([c[@"kind"]isEqual:@"spiderPlot"]){auto mesh=DYSpiderMesh([self spiderData]);double best=12*_scale;NSInteger chosen=-1;for(int i=0;i<dy::meshCount(mesh);i++){double distance=hypot(p.x-(r.origin.x+mesh.x[i]*r.size.width),p.y-(r.origin.y+mesh.y[i]*r.size.height));if(distance<best){best=distance;chosen=i;}}if(chosen<0)return;_selectedSpider=chosen;c[@"meshStart"]=[NSData dataWithBytes:&mesh length:sizeof(mesh)];[_captured release];_captured=[c copy];[self beginSpiderData];return;}
|
||||
if([c[@"kind"]isEqual:@"spiderPlot"]){auto mesh=DYSpiderMesh([self spiderData]);double best=12*_scale;NSInteger chosen=-1;for(int i=0;i<dy::meshCount(mesh);i++){NSPoint q=DYSpiderPlotPoint(r,mesh.x[i],mesh.y[i]);double distance=hypot(p.x-q.x,p.y-q.y);if(distance<best){best=distance;chosen=i;}}if(chosen<0)return;_selectedSpider=chosen;c[@"meshStart"]=[NSData dataWithBytes:&mesh length:sizeof(mesh)];[_captured release];_captured=[c copy];[self beginSpiderData];return;}
|
||||
if([c[@"kind"]isEqual:@"hslPlot"]){NSInteger color=MAX(0,MIN(7,(NSInteger)((p.x-r.origin.x)/r.size.width*8)));NSString *key=[NSString stringWithFormat:@"hsl%ld_%ld",(long)_hslAxis,(long)color];c[@"hslKey"]=key;[_captured release];_captured=[c copy];[_bridge beginParameter:[self descriptorForKey:key]node:_nodeID value:[self graphicValue:key]atTime:_time];return;}
|
||||
if([c[@"kind"]isEqual:@"curvePlot"]){NSDictionary*nearest=nil;double distance=12*_scale;for(NSDictionary*point in [self curvePoints]){NSPoint q=[self curvePosition:point rect:r];double d=hypot(q.x-p.x,q.y-p.y);if(d<distance){distance=d;nearest=point;}}
|
||||
if(!nearest)for(NSDictionary*slot in [self curveSlots])if([self graphicValue:slot[@"xKey"]]<0){nearest=slot;break;}
|
||||
@@ -123,7 +123,7 @@
|
||||
[_draftValues addEntriesFromDictionary:values];[_bridge changeValues:values];return;
|
||||
}
|
||||
|
||||
if([_captured[@"kind"]isEqual:@"spiderPlot"]){NSData *start=_captured[@"meshStart"];if(!start||_selectedSpider<0)return;NSRect r=[_captured[@"rect"]rectValue];auto mesh=DYSpiderMesh(start);std::bitset<dy::SpiderMeshCapacity> selected;selected[_selectedSpider]=true;auto moved=dy::moveMesh(mesh,selected,(p.x-_down.x)/r.size.width,(p.y-_down.y)/r.size.height);[_spiderDraft release];_spiderDraft=[[NSData alloc]initWithBytes:&moved length:sizeof(moved)];[_bridge changeSpider:_spiderDraft];return;}
|
||||
if([_captured[@"kind"]isEqual:@"spiderPlot"]){NSData *start=_captured[@"meshStart"];if(!start||_selectedSpider<0)return;NSRect r=[_captured[@"rect"]rectValue];auto mesh=DYSpiderMesh(start);std::bitset<dy::SpiderMeshCapacity> selected;selected[_selectedSpider]=true;NSPoint delta=DYSpiderMeshDelta(r,mesh.x[_selectedSpider],mesh.y[_selectedSpider],NSMakePoint(p.x-_down.x,p.y-_down.y));auto moved=dy::moveMesh(mesh,selected,delta.x,delta.y);[_spiderDraft release];_spiderDraft=[[NSData alloc]initWithBytes:&moved length:sizeof(moved)];[_bridge changeSpider:_spiderDraft];return;}
|
||||
if([_captured[@"kind"]isEqual:@"hslPlot"]){NSString *key=_captured[@"hslKey"];if(!key)return;NSRect r=[_captured[@"rect"]rectValue];double v=MAX(-100.,MIN(100.,(NSMidY(r)-p.y)/r.size.height*200));_draftValues[key]=@(v);[_bridge changeValue:v];return;}
|
||||
NSString*xKey=_captured[@"xKey"],*yKey=_captured[@"yKey"];if(!xKey||!yKey)return;NSRect r=[_captured[@"rect"]rectValue];double x,y;
|
||||
if([_captured[@"kind"]isEqual:@"curvePlot"]){x=MAX(.001,MIN(.999,(p.x-r.origin.x)/MAX(1.,r.size.width)));double output=MAX(0.,MIN(1.,1-(p.y-r.origin.y)/MAX(1.,r.size.height)));
|
||||
|
||||
@@ -119,8 +119,14 @@
|
||||
[otherScope setScopeEnabled:NO];[scopeRenderer setScopeEnabled:NO];
|
||||
|
||||
// The spider reuses the same frame, including when the full scopes are closed.
|
||||
constexpr size_t spiderBytes=dyscope::SpiderBins*dyscope::SpiderBins*4;
|
||||
constexpr size_t spiderBytes=dyscope::Bins*dyscope::Bins*4;
|
||||
NSData *osc=[scopeRenderer canvasSpiderScopeAtTime:CMTimeMake(9,24)];
|
||||
NSData *panelRaster=scopeRenderer.scopeMetadata[@"vectorscope"];
|
||||
const uint8_t *spiderRaster=(const uint8_t*)osc.bytes,*workspaceRaster=(const uint8_t*)panelRaster.bytes;
|
||||
BOOL sameMeasuredPixels=osc.length==spiderBytes&&panelRaster.length==spiderBytes;
|
||||
if(sameMeasuredPixels)for(size_t i=0;i<spiderBytes;i+=4)
|
||||
sameMeasuredPixels&=(spiderRaster[i+3]>0)==(workspaceRaster[i]||workspaceRaster[i+1]||workspaceRaster[i+2]);
|
||||
run.record(@"spider-and-workspace-measure-identical-color-managed-pixels",sameMeasuredPixels);
|
||||
run.record(@"spider-osc-uses-exact-instance-output-time",osc.length==spiderBytes&&
|
||||
![scopeRenderer canvasSpiderScopeAtTime:CMTimeMake(8,24)]&&![otherScope canvasSpiderScopeAtTime:CMTimeMake(9,24)]);
|
||||
[scopeRenderer outputSpiderScope];
|
||||
@@ -143,12 +149,32 @@
|
||||
const dyscope::RGBA vectors[]={{.5f,0,0,.5f},{0,.5f,0,.5f},{0,0,.5f,.5f},{.1f,.1f,.1f,1},
|
||||
{1,0,1,0},{NAN,1,0,1},{1,.2f,0,NAN}};
|
||||
auto density=dyscope::spiderVectorImage(vectors);
|
||||
auto alpha=[&](unsigned x,unsigned y){return density[(y*dyscope::SpiderBins+x)*4+3];};
|
||||
unsigned nonempty=0;
|
||||
for(size_t i=3;i<density.size();i+=4)nonempty+=density[i]>0;
|
||||
run.record(@"spider-raster-hue-orientation-neutral-center-and-invalid-filtering",
|
||||
nonempty==4&&alpha(191,96)&&alpha(48,178)&&alpha(48,13)&&alpha(96,96));
|
||||
auto vectorscope=dyscope::measure(vectors,7,1);
|
||||
unsigned nonempty=0,maxAlpha=0;BOOL sameBins=YES;
|
||||
for(size_t i=0;i<vectorscope.vectors.size();i++){
|
||||
unsigned alpha=density[4*i+3];
|
||||
sameBins&=(alpha>0)==(vectorscope.vectors[i]>0);
|
||||
nonempty+=alpha>0;maxAlpha=std::max(maxAlpha,alpha);
|
||||
}
|
||||
run.record(@"spider-shares-cbcr-bins-and-keeps-trace-translucent",
|
||||
nonempty==4&&sameBins&&maxAlpha<185&&maxAlpha>140);
|
||||
NSRect wheel=NSMakeRect(12,24,240,240),panel=NSMakeRect(2,4,100,100);
|
||||
NSPoint a=DYSkinScopePoint(wheel,.93),b=DYSkinScopePoint(panel,.98);
|
||||
double wheelSlope=(a.y-NSMidY(wheel))/(a.x-NSMidX(wheel)),panelSlope=(b.y-NSMidY(panel))/(b.x-NSMidX(panel));
|
||||
run.record(@"spider-and-panel-skin-reference-share-direction",
|
||||
a.x<NSMidX(wheel)&&a.y<NSMidY(wheel)&&fabs(wheelSlope-panelSlope)<1e-8);
|
||||
|
||||
double error=0;
|
||||
for(int hue=0;hue<96;hue++)for(int ring=0;ring<=6;ring++){
|
||||
double theta=hue*(2*M_PI/96),distance=ring/12.;
|
||||
double x=.5+distance*cos(theta),y=.5+distance*sin(theta);
|
||||
NSPoint restored=DYSpiderMeshPoint(wheel,DYSpiderPlotPoint(wheel,x,y));
|
||||
error=std::max(error,hypot(restored.x-x,restored.y-y));
|
||||
}
|
||||
NSPoint delta=DYSpiderMeshDelta(wheel,.68,.58,NSMakePoint(12,-7));
|
||||
NSPoint start=DYSpiderPlotPoint(wheel,.68,.58),end=DYSpiderPlotPoint(wheel,.68+delta.x,.58+delta.y);
|
||||
run.record(@"spider-display-projection-round-trips-and-follows-pointer",
|
||||
error<1e-5&&hypot(end.x-start.x-12,end.y-start.y+7)<1e-3);
|
||||
}
|
||||
// Exercise the new stack workspace against the same authoritative host document
|
||||
// as the regular inspector. Every view stays in an unpresented native fixture.
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.20.0</string>
|
||||
<string>1.20.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>111</string>
|
||||
<string>112</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.20.0</string>
|
||||
<string>1.20.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>111</string>
|
||||
<string>112</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
更新于 2026-11-08(Asia/Shanghai)。这是新对话的接手入口。历史设计和实现细节按需查阅专项交接,复现和交付证据以对应版本的报告为准。
|
||||
|
||||
## 1.20.0(111)蜘蛛盘示波器
|
||||
## 1.20.1(112)蜘蛛盘示波器
|
||||
|
||||
蜘蛛盘校色仪在检查器、浮动工作区和画布控件叠加当前效果最终输出的浅色轨迹,色相和饱和度与蜘蛛网格共用坐标。压暗色盘,保留前景可拖动节点,并用带「肤色」标签的 28° 虚线标示固定参考方向。取样沿用 320×180 的最终输出缓存。检查器后台生成密度栅格,画布仅取与当前时间匹配的样本;工作区原有的 Cb/Cr 矢量示波器维持原坐标。
|
||||
用户实看 1.20.0 后指出白色轨迹盖过控制网、肤色线与控制面板方向不同。修正为两处共用最终输出的色彩转换、Cb/Cr 取样、比例和肤色线方向。蜘蛛盘显示坐标同步投影,底层保留 HSV 网格和预设,拖动与方向键反向映射回原坐标。参照用户配图,底盘改为暗中性中心与平滑的色相外圈,轨迹透明度按密度受限,灰色节点和细线加深色描边。
|
||||
|
||||
新 FCP 整合效果、独立模板和新插入的肤色工具默认关闭保护。FCP 模板显式写入关闭值,注册默认保留历史开启值,兼容省略该参数的旧片段。Motion 直接添加原生滤镜沿用注册默认。显式开启时保护程度默认 60,仅保护人脸默认开启。
|
||||
|
||||
已通过 17 套 FCP 效果模板结构校验;Release 构建、签名、公证、宿主验收及发行包待完成。源码入口为 `大鱼调色/Plugin/DYScopeCapture.inc.h`、`DYSpiderDisc.inc.h`、`DYViewerGraphics.inc.h` 和 `DYModel.mm`。继续从正式安装路径验证播放、色盘拖动及新加效果的肤色开关。已有工程文件的 Security 引用排序差异留在工作区。
|
||||
1.20.0(111)本机曾公证安装并通过 999 项原生检查,安装包已通过验包,收到反馈后留在本机,未上传 Release。[前一版观察](verification/HostSpiderScope1.20.0.json) · [前一版安装](verification/Delivery1.20.0.json)。1.20.1(112)已通过 17 套 FCP 效果模板结构校验,正式构建、宿主实看及发行待完成。入口为 `大鱼调色/Plugin/DYSpiderScopeDrawing.h`、`DYScopeCapture.inc.h`、`DYViewerGraphics.inc.h` 和 `DYModel.mm`。已有工程文件的 Security 引用排序差异留在工作区。
|
||||
|
||||
## 1.19.1 交付基线(历史)
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户