加入HSL点取色切换与肤色橙色优先,修正DLog工作曲线路由
这个提交包含在:
1 父节点
3005347a6b
当前提交
ca7221f073
9 个文件已更改
+101
-4
没有与搜索条件相匹配的文件
@@ -41,6 +41,8 @@ typedef struct DYCMSettings {
|
||||
#ifndef __METAL_VERSION__
|
||||
#include <math.h>
|
||||
static inline int DYBasisMode(int c) {
|
||||
// Named D-Log camera entries share the native D-Log primary math.
|
||||
if(c>=31&&c<=33)c=11;
|
||||
if(c==99)return 0;if(c>=1&&c<=11)return c;
|
||||
switch(c){case 14:return 12;case 15:return 13;case 16:return 14;case 19:return 15;case 20:return 16;case 21:return 17;case 22:return 18;case 25:return 19;case 27:return 20;case 28:return 21;default:return -1;}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "DYLUTLibrary.h"
|
||||
#import "DYLUTBrowser.h"
|
||||
#import "DYInspector.h"
|
||||
#include "DYHSLPicker.h"
|
||||
#import "DYTheme.h"
|
||||
#include "DYSpiderState.h"
|
||||
#include "DYToolGPU.h"
|
||||
@@ -641,6 +642,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
#include "DYPrimaryDiagnostics.inc.h"
|
||||
#include "DYUnifiedDiagnostics.inc.h"
|
||||
#include "DYCompactUIDiagnostics.inc.h"
|
||||
#include "DYHSLPickerDiagnostics.inc.h"
|
||||
#include "DYViewerParameterDiagnostics.inc.h"
|
||||
#include "DYViewerControlsDiagnostics.inc.h"
|
||||
#include "DYCanvasToolsDiagnostics.inc.h"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
// Display sRGB point -> the existing eight HSL lanes. No grading values change.
|
||||
// Near-neutrals have no useful hue and keep the current selection (-1).
|
||||
static inline int DYHSLPickedLane(float r,float g,float b) {
|
||||
if(!std::isfinite(r)||!std::isfinite(g)||!std::isfinite(b))return -1;
|
||||
r=std::clamp(r,0.f,1.f);g=std::clamp(g,0.f,1.f);b=std::clamp(b,0.f,1.f);
|
||||
float high=std::max({r,g,b}),low=std::min({r,g,b}),chroma=high-low;
|
||||
if(high<.025f||chroma<.015f||chroma/high<.06f)return -1;
|
||||
float hue=high==r?(g-b)/chroma:high==g?(b-r)/chroma+2:(r-g)/chroma+4;
|
||||
hue*=60;if(hue<0)hue+=360;
|
||||
float saturation=chroma/high;
|
||||
// Warm, less saturated pink/peach/brown points take precedence over red/yellow.
|
||||
// This is a colour heuristic, not face/person detection; saturated red stays red.
|
||||
if(hue<=52&&r>g&&g>=b-.025f&&saturation>=.08f&&saturation<=.72f)return 1;
|
||||
const float centers[]={0,30,60,120,180,240,270,315};
|
||||
int best=0;float closest=360;
|
||||
for(int lane=0;lane<8;lane++){float distance=std::fabs(hue-centers[lane]);distance=std::min(distance,360-distance);if(distance<closest){closest=distance;best=lane;}}
|
||||
return best;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Classifier boundaries and real native inspector selection, without opening a sampler.
|
||||
{
|
||||
const float points[][4]={{1,.04,.02,0},{1,.5,.02,1},{.95,.9,.02,2},{.03,.8,.05,3},{.02,.8,.8,4},{.02,.12,.9,5},{.55,.08,.95,6},{.95,.04,.6,7},
|
||||
{.95,.8,.79,1},{.74,.46,.44,1},{.65,.42,.28,1},{.27,.16,.12,1},{.5,.5,.5,-1},{1,1,1,-1},{0,0,0,-1},{.5,.49,.48,-1},{NAN,.3,.2,-1}};
|
||||
for(unsigned i=0;i<sizeof(points)/sizeof(points[0]);i++)run.record([NSString stringWithFormat:@"hsl-picker-colour-%02u",i],DYHSLPickedLane(points[i][0],points[i][1],points[i][2])==(int)points[i][3]);
|
||||
DYDiagnosticManager *pickHost=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(pickHost,nil);
|
||||
NSMutableDictionary *pickDoc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *pickLayer=DYInsertTool(pickDoc,@"hsl",@"base:hsl");DYWriteTools(pickHost,pickDoc,kCMTimeZero);
|
||||
DYToolManager *pickProxy=[[[DYToolManager alloc]initWithHost:pickHost node:pickLayer]autorelease];
|
||||
NSArray *pickEditors=@[[[[DYInspector alloc]initWithAPIManager:pickHost]autorelease],[[[DYInspector alloc]initWithAPIManager:pickProxy]autorelease],[[[DYInspector alloc]initWithAPIManager:pickHost renderer:nil workspaceType:@"hsl"]autorelease]];
|
||||
NSDictionary *pickBefore=[[pickHost->_values copy]autorelease];NSData *pickTools=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(pickHost,kCMTimeZero) requiringSecureCoding:YES error:nil];
|
||||
for(NSUInteger editorIndex=0;editorIndex<pickEditors.count;editorIndex++){
|
||||
DYInspector *editor=pickEditors[editorIndex];editor.frame=NSMakeRect(0,0,424,780);[editor refresh];[editor layoutSubtreeIfNeeded];
|
||||
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.02 green:.12 blue:.9 alpha:1]];
|
||||
BOOL blue=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==5;
|
||||
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.95 green:.8 blue:.79 alpha:1]];
|
||||
BOOL skin=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==1;
|
||||
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.5 green:.5 blue:.5 alpha:1]];
|
||||
[(id)editor performSelector:@selector(selectHSLColor:) withObject:nil];
|
||||
BOOL retained=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==1,button=NO,swatch=NO;
|
||||
for(NSDictionary *card in [editor valueForKey:@"cards"])if([card[@"section"][@"key"]isEqual:@"hsl"]){
|
||||
for(NSView *row in card[@"body"]){if([row.identifier isEqual:@"hslPickerControls"])button=[row.subviews.firstObject action]==@selector(sampleHSLLane:);
|
||||
if([row.identifier isEqual:@"hslTabs"]){swatch=YES;for(NSButton *b in row.subviews)swatch&=(b.state==(b.tag==1?NSControlStateValueOn:NSControlStateValueOff));}}
|
||||
}
|
||||
run.record([NSString stringWithFormat:@"hsl-picker-native-editor-%lu",(unsigned long)editorIndex],blue&&skin&&retained&&button&&swatch);
|
||||
}
|
||||
NSData *pickAfter=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(pickHost,kCMTimeZero) requiringSecureCoding:YES error:nil];
|
||||
run.record(@"hsl-picker-only-selects-no-grading-or-undo-write",[pickBefore isEqual:pickHost->_values]&&[pickTools isEqual:pickAfter]&&pickHost->_undoStarts==0);
|
||||
}
|
||||
+24
-1
@@ -2,6 +2,7 @@
|
||||
#import "DYManagedColorPanel.h"
|
||||
#import "DYManagedColor.h"
|
||||
#import "DYInspector.h"
|
||||
#include "DYHSLPicker.h"
|
||||
#import "../Shared/DYBetaDiagnostics.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
@@ -747,6 +748,9 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
[card addSubview:actions];[body addObject:actions];
|
||||
}
|
||||
if([key isEqual:@"hsl"]) {
|
||||
DYFlippedView *pickActions=[[[DYFlippedView alloc]initWithFrame:NSZeroRect]autorelease];pickActions.identifier=@"hslPickerControls";
|
||||
NSButton *autoPicker=DYButton(@"HSL 吸管",self,@selector(sampleHSLLane:));autoPicker.identifier=@"hslLanePicker";autoPicker.image=[NSImage imageWithSystemSymbolName:@"eyedropper" accessibilityDescription:nil];autoPicker.toolTip=@"点击画面取色,自动切换到对应颜色;肤色优先进入橙色。Esc 取消。";autoPicker.accessibilityLabel=@"HSL 吸管";
|
||||
[pickActions addSubview:autoPicker];[card addSubview:pickActions];[body addObject:pickActions];
|
||||
DYFlippedView *tabs=[[[DYFlippedView alloc]initWithFrame:NSZeroRect]autorelease];tabs.identifier=@"hslTabs";
|
||||
for(NSInteger i=0;i<9;i++){DYSwatchButton *b=[[[DYSwatchButton alloc]initWithFrame:NSZeroRect]autorelease];[b setButtonType:NSButtonTypePushOnPushOff];b.swatch=i<8?[NSColor colorWithSRGBRed:((double[]){1,1,1,.15,0,0,.75,1})[i] green:((double[]){.2,.55,.84,.76,.76,.47,.15,.15})[i] blue:((double[]){.25,.12,0,.25,.8,1,.9,.65})[i] alpha:1]:DYAccent();b.title=@"";if(i==8)b.identifier=@"customColorSwatch";b.tag=i;b.target=self;b.action=@selector(tabChanged:);b.state=i==0?NSControlStateValueOn:NSControlStateValueOff;b.accessibilityLabel=[@[@"红",@"橙",@"黄",@"绿",@"青",@"蓝",@"紫",@"洋红",@"自定义"][i] stringByAppendingString:@" HSL"];[tabs addSubview:b];}
|
||||
[card addSubview:tabs];[body addObject:tabs];
|
||||
@@ -907,7 +911,7 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
CGFloat rh=[self heightForRow:row];row.frame=NSMakeRect(12,rowY,cw-24,rh-1);rowY+=rh;
|
||||
if([row.identifier isEqual:@"primaryBalance"])for(NSView *v in row.subviews)v.frame=row.bounds;
|
||||
if([row.identifier hasPrefix:@"heading:"])for(NSView *v in row.subviews)v.frame=NSMakeRect(3,7,row.bounds.size.width-6,18);
|
||||
if([row.identifier isEqual:@"autoControls"]||[row.identifier isEqual:@"sampleControls"]) {
|
||||
if([row.identifier isEqual:@"autoControls"]||[row.identifier isEqual:@"sampleControls"]||[row.identifier isEqual:@"hslPickerControls"]) {
|
||||
CGFloat buttonWidth=(row.bounds.size.width-4*(row.subviews.count-1))/MAX((NSUInteger)1,row.subviews.count);NSInteger i=0;
|
||||
for(NSView *button in row.subviews)[button setFrame:NSMakeRect((buttonWidth+4)*i++,3,buttonWidth,25)];
|
||||
}
|
||||
@@ -1528,6 +1532,25 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
- (void)autoWhiteBalance:(id)sender { if(_embedded){[self writeGraphicValues:DYAutoWhiteBalance([_renderer preview])];return;}[[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoWhiteBalance" object:_manager]; }
|
||||
- (void)sampleWhiteBalance:(id)sender { [self sampleColorForWhiteBalance:YES]; }
|
||||
- (void)sampleCustomColor:(id)sender { [self sampleColorForWhiteBalance:NO]; }
|
||||
- (void)selectHSLColor:(NSColor *)sample {
|
||||
NSColor *color=[sample colorUsingColorSpace:NSColorSpace.sRGBColorSpace];if(!color)return;
|
||||
NSInteger lane=DYHSLPickedLane(color.redComponent,color.greenComponent,color.blueComponent);
|
||||
if(lane>=0)_tabs[@"hsl"]=@(lane);
|
||||
for(NSDictionary *card in _cards)if([card[@"section"][@"key"]isEqual:@"hsl"]){
|
||||
for(NSView *row in card[@"body"]){
|
||||
if([row.identifier isEqual:@"hslTabs"])for(NSButton *swatch in row.subviews)swatch.state=swatch.tag==[_tabs[@"hsl"]integerValue]?NSControlStateValueOn:NSControlStateValueOff;
|
||||
if([row.identifier isEqual:@"hslPickerControls"]){NSButton *button=row.subviews.firstObject;button.title=lane<0?@"HSL 吸管 · 中性色":[@"HSL 吸管 · " stringByAppendingString:@[@"红",@"橙",@"黄",@"绿",@"青",@"蓝",@"紫",@"洋红"][lane]];button.accessibilityValue=lane<0?@"中性色,保留当前颜色":@[@"红",@"橙",@"黄",@"绿",@"青",@"蓝",@"紫",@"洋红"][lane];}
|
||||
}
|
||||
}
|
||||
[self setNeedsLayout:YES];[self layoutSubtreeIfNeeded];NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
|
||||
}
|
||||
- (void)sampleHSLLane:(id)sender {
|
||||
if(_sampler)return;
|
||||
_sampler=[[NSColorSampler alloc]init];
|
||||
[_sampler showSamplerWithSelectionHandler:^(NSColor *selectedColor){
|
||||
[self selectHSLColor:selectedColor];[_sampler release];_sampler=nil;
|
||||
}];
|
||||
}
|
||||
- (void)sampleColorForWhiteBalance:(BOOL)whiteBalance {
|
||||
if(_sampler)return;
|
||||
_sampler=[[NSColorSampler alloc]init];
|
||||
|
||||
在新工单中引用
屏蔽一个用户