feat: add neon palette and sampled RGB luma histogram behind curves

这个提交包含在:
mac 于 2026-11-04 12:06:47 +08:00 提交
1 父节点 3373a5365e
当前提交 bea51d2297
10 个文件已更改
+122 -38

没有与搜索条件相匹配的文件

@@ -15,13 +15,13 @@
for(NSNumber *width in @[@280,@320,@400]){
[view setFrameSize:NSMakeSize(width.doubleValue,780)];[view layoutSubtreeIfNeeded];NSArray *buttons=@[[view valueForKey:@"save"],[view valueForKey:@"load"],[view valueForKey:@"export"],settings];BOOL fit=YES;
for(NSView *button in buttons){fit&=NSMinX(button.frame)>=0&&NSMaxX(button.frame)<=width.doubleValue&&button.frame.size.width>=66;for(NSView *other in buttons)if(button!=other)fit&=!NSIntersectsRect(button.frame,other.frame);}
NSArray *themes=[view valueForKey:@"themeButtons"];NSView *brand=[view valueForKey:@"brand"];fit&=themes.count==6&&NSMaxX(brand.frame)<=NSMinX([themes.firstObject frame]);
NSArray *themes=[view valueForKey:@"themeButtons"];NSView *brand=[view valueForKey:@"brand"];fit&=themes.count==7&&NSMaxX(brand.frame)<=NSMinX([themes.firstObject frame]);
run.record([NSString stringWithFormat:@"compact-header-controls-fit-%@",width],fit);
}
DYDiagnosticManager *fresh=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(fresh,nil);run.record(@"compact-new-host-stays-original-flow",!DYReadAssets(fresh,kCMTimeZero).colorManagement);
NSInteger previous=DYThemeIndex();@try{
BOOL colors=DYThemeNames().count==6&&[DYThemeNames()[5]isEqual:@"黑金渐变"];
for(NSInteger i=0;i<6;i++){DYSetThemeIndex(i);colors&=DYThemeIndex()==i&&DYThemePalette()[@"background"]&&DYThemePalette()[@"text"];}
BOOL colors=DYThemeNames().count==7&&[DYThemeNames()[5]isEqual:@"黑金渐变"];
for(NSInteger i=0;i<7;i++){DYSetThemeIndex(i);colors&=DYThemeIndex()==i&&DYThemePalette()[@"background"]&&DYThemePalette()[@"text"];}
run.record(@"compact-six-stable-theme-choices",colors);
DYSetThemeIndex(5);auto luminance=[](NSColor *color){NSColor *c=[color colorUsingColorSpace:NSColorSpace.sRGBColorSpace];auto linear=[](double x){return x<=.04045?x/12.92:pow((x+.055)/1.055,2.4);};return .2126*linear(c.redComponent)+.7152*linear(c.greenComponent)+.0722*linear(c.blueComponent);};
double minimum=100;for(NSString *text in @[@"text",@"secondary"])for(NSString *surface in @[@"background",@"backgroundEnd",@"card",@"cardEnd",@"field",@"headerTop"])minimum=std::min(minimum,(luminance(DYThemePalette()[text])+.05)/(luminance(DYThemePalette()[surface])+.05));
@@ -35,3 +35,33 @@
run.record(@"compact-gold-glow-respects-system-display-options",reduced?DYThemeTextShadow()==nil:DYThemeTextShadow().shadowBlurRadius<=2);
}@finally{DYSetThemeIndex(previous);}
}
// Histogram math is independent of UI palettes and never edits a host document.
{
float pixels[][4]={{0,0,0,1},{1,1,1,1},{1,0,0,1},{0,1,0,1},{0,0,1,1},{-.5,2,.5,1},{1,1,1,0},{NAN,0,0,1},{0,0,0,INFINITY}};
NSData *input=[NSData dataWithBytes:pixels length:sizeof(pixels)];NSData *data=DYHistogramFromRGBA(input);const DYHistogram *h=(const DYHistogram*)data.bytes;
run.record(@"histogram-rejects-transparent-and-nonfinite",h->samples==6);
run.record(@"histogram-rgb-endpoints-and-clamped-headroom",h->bins[1][0]==4&&h->bins[1][255]==2&&h->bins[2][255]==3&&h->bins[3][128]==1);
run.record(@"histogram-luma-primary-coefficients",h->bins[0][54]==1&&h->bins[0][182]==1&&h->bins[0][18]==1);
BOOL totals=YES;for(int c=0;c<4;c++){uint32_t total=0;for(int b=0;b<256;b++)total+=h->bins[c][b];totals&=total==6;}
run.record(@"histogram-each-channel-conserves-valid-samples",totals);
run.record(@"histogram-malformed-and-empty-safe",!DYHistogramFromRGBA([NSData dataWithBytes:pixels length:3])&&((const DYHistogram*)DYHistogramFromRGBA([NSData data]).bytes)->samples==0);
DYDiagnosticManager *host=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(host,nil);DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];[renderer setValue:data forKey:@"histogram"];
DYInspector *view=[[[DYInspector alloc]initWithAPIManager:host renderer:renderer]autorelease];[view refresh];NSDictionary *before=[view presetSnapshot];
NSView *graph=nil;for(NSView *v in [view valueForKey:@"graphics"])if([v.identifier isEqual:@"curveGraph"])graph=v;
NSButton *toggle=[graph valueForKey:@"histogramToggle"];NSSegmentedControl *channels=[graph valueForKey:@"channels"];
run.record(@"histogram-new-inspector-uses-renderer-cached-snapshot",[[graph valueForKey:@"histogram"]isEqual:data]&&toggle.state==NSControlStateValueOn);
NSMutableSet *images=[NSMutableSet set];
for(NSInteger c=0;c<4;c++){
channels.selectedSegment=c;[graph performSelector:@selector(channelChanged:) withObject:channels];[graph setFrameSize:NSMakeSize(320,240)];[graph layoutSubtreeIfNeeded];
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:320 pixelsHigh:240 bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:0 bitsPerPixel:0]autorelease];
[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];[graph drawRect:graph.bounds];[NSGraphicsContext restoreGraphicsState];[images addObject:[NSData dataWithBytes:bitmap.bitmapData length:bitmap.bytesPerRow*bitmap.pixelsHigh]];
}
[toggle performClick:nil];[toggle performClick:nil];
run.record(@"histogram-four-channel-drawings-distinct",images.count==4);
run.record(@"histogram-channel-and-overlay-presentation-does-not-edit-grade",[before isEqual:[view presetSnapshot]]&&host->_undoStarts==0&&host->_undoEnds==0);
[renderer invalidatePreview];[view performSelector:@selector(previewChanged:) withObject:nil];
run.record(@"histogram-invalidation-clears-view-and-renderer",![renderer histogram]&&![graph valueForKey:@"histogram"]);
NSInteger previous=DYThemeIndex();DYSetThemeIndex(6);
run.record(@"neon-stable-theme-id-and-no-text-glow",[DYThemeNames()[6]isEqual:@"霓虹炫彩"]&&DYThemeTextShadow()==nil&&![DYThemePalette()[@"background"]isEqual:DYThemePalette()[@"backgroundEnd"]]);
DYSetThemeIndex(previous);
}
+1
查看文件
@@ -1,3 +1,4 @@
#import "DYHistogram.h"
#include "DYFilmMath.h"
#include "DYFilmTime.h"
#import "DYDiagnostics.h"
+24
查看文件
@@ -0,0 +1,24 @@
#pragma once
#import <Foundation/Foundation.h>
#include <cmath>
#include <cstdint>
// Immutable renderer-owned snapshot. Channel 0 is Rec.709 luma of the existing
// display-encoded analysis samples, not scene-linear luminance or an HDR scope.
struct DYHistogram {
uint32_t bins[4][256]{};
uint32_t samples=0;
};
static inline NSData *DYHistogramFromRGBA(NSData *rgba) {
DYHistogram h;
if(rgba.length%sizeof(float[4]))return nil;
const float *p=(const float *)rgba.bytes;
auto bin=[](double v){return (int)std::lround(std::fmax(0.,std::fmin(1.,v))*255.);};
for(NSUInteger i=0;i<rgba.length/sizeof(float[4]);i++,p+=4){
if(!std::isfinite(p[0])||!std::isfinite(p[1])||!std::isfinite(p[2])||!std::isfinite(p[3])||p[3]<=0)continue;
h.bins[0][bin(.2126*p[0]+.7152*p[1]+.0722*p[2])]++;
for(int c=0;c<3;c++)h.bins[c+1][bin(p[c])]++;
h.samples++;
}
return [NSData dataWithBytes:&h length:sizeof(h)];
}
+35 -12
查看文件
@@ -1,3 +1,4 @@
#import "DYHistogram.h"
#import "DYManagedColorPanel.h"
#import "DYManagedColor.h"
#import "DYInspector.h"
@@ -86,7 +87,7 @@ static NSString *DYNumber(double value,NSDictionary *d) {
NSArray *colors=[self trackColors];if(colors){NSGradient *g=[[[NSGradient alloc]initWithColors:colors]autorelease];[g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:track xRadius:2.5 yRadius:2.5] angle:0];return;}
NSBezierPath *bar=[NSBezierPath bezierPathWithRoundedRect:track xRadius:2.5 yRadius:2.5];NSGradient *base=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"slot8"] endingColor:DYThemePalette()[@"slot9"]]autorelease];[base drawInBezierPath:bar angle:90];[[NSColor colorWithWhite:0 alpha:.28]setStroke];bar.lineWidth=.6;[bar stroke];
double fraction=(self.doubleValue-self.minValue)/fmax(.000001,self.maxValue-self.minValue);
NSRect active=track;active.size.width*=fmax(0,fmin(1,fraction));NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"activeTop"] endingColor:DYThemePalette()[@"activeBottom"]]autorelease];[g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:active xRadius:2 yRadius:2] angle:90];
NSRect active=track;active.size.width*=fmax(0,fmin(1,fraction));NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"activeTop"] endingColor:DYThemePalette()[@"activeBottom"]]autorelease];[g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:active xRadius:2 yRadius:2] angle:DYThemeIndex()==6?0:90];
}
- (void)drawKnob:(NSRect)knobRect {
NSRect circle=NSInsetRect(knobRect,1,1);
@@ -192,7 +193,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
- (void)dealloc {[_swatch release];[super dealloc];}
- (void)drawRect:(NSRect)dirtyRect {
NSRect r=NSInsetRect(self.bounds,3,3);[_swatch setFill];NSBezierPath *p=[NSBezierPath bezierPathWithRoundedRect:r xRadius:5 yRadius:5];[p fill];
if([self.identifier isEqual:@"themeSwatch"]&&self.tag==5){NSGradient *g=[[[NSGradient alloc]initWithStartingColor:NSColor.blackColor endingColor:DYThemeSwatch(5)]autorelease];[g drawInBezierPath:p angle:45];}
if([self.identifier isEqual:@"themeSwatch"]&&self.tag>=5){NSGradient *g=[[[NSGradient alloc]initWithStartingColor:self.tag==6?[NSColor colorWithSRGBRed:.8 green:.12 blue:1 alpha:1]:NSColor.blackColor endingColor:self.tag==6?NSColor.cyanColor:DYThemeSwatch(5)]autorelease];[g drawInBezierPath:p angle:45];}
if([self.identifier isEqual:@"customColorSwatch"]){NSGradient *g=[[[NSGradient alloc]initWithColors:@[NSColor.systemRedColor,NSColor.systemYellowColor,NSColor.systemGreenColor,NSColor.systemCyanColor,NSColor.systemBlueColor,NSColor.systemPurpleColor]]autorelease];[g drawInBezierPath:p angle:45];[@"⌾" drawInRect:NSInsetRect(r,3,1) withAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:NSColor.whiteColor}];}
if(self.state==NSControlStateValueOn){[DYInk() setStroke];p.lineWidth=2;[p stroke];}
}
@@ -227,11 +228,14 @@ static NSArray *DYPresentationSections(void) {
@interface DYCurvePanel : DYFlippedView {
NSDictionary *_values;
NSSegmentedControl *_channels;
NSData *_histogram;
NSButton *_histogramToggle;
NSInteger _channel;
NSString *_dragXKey,*_dragYKey;
}
@property(nonatomic,assign) id<DYGraphicDelegate> delegate;
- (void)setValues:(NSDictionary *)values;
- (void)setHistogram:(NSData *)histogram;
@end
@implementation DYCurvePanel
@@ -240,16 +244,19 @@ static NSArray *DYPresentationSections(void) {
_values=[@{} copy];
_channels=[[NSSegmentedControl segmentedControlWithLabels:@[@"RGB",@"红",@"绿",@"蓝"] trackingMode:NSSegmentSwitchTrackingSelectOne target:self action:@selector(channelChanged:)] retain];
_channels.selectedSegment=0; _channels.controlSize=NSControlSizeSmall; [self addSubview:_channels];
_histogramToggle=[[NSButton checkboxWithTitle:@"直方图" target:self action:@selector(histogramToggled:)]retain];_histogramToggle.state=NSControlStateValueOn;_histogramToggle.font=[NSFont systemFontOfSize:10];_histogramToggle.accessibilityLabel=@"显示曲线直方图叠层";_histogramToggle.toolTip=@"亮度与 RGB,256 档、320×180 采样;高度按共同峰值平方根缩放。源为分析画面:原流程在一级 CST/输入 LUT 后,新 CMS 在显示输出转换后、SDR 修饰前;不是最终输出示波器,也不是每个曲线层的即时输入。播放或移动播放头时刷新(最多每秒2次)。";[self addSubview:_histogramToggle];
self.accessibilityLabel=@"曲线点编辑器";self.toolTip=@"点击添加点;拖动调整;双击、右键或按住 Option 点击已有点可删除";
}
return self;
}
- (void)dealloc { [_values release];[_channels release];[_dragXKey release];[_dragYKey release];[super dealloc]; }
- (void)dealloc { [_histogram release];[_histogramToggle release];[_values release];[_channels release];[_dragXKey release];[_dragYKey release];[super dealloc]; }
- (BOOL)acceptsFirstResponder { return YES; }
- (void)setValues:(NSDictionary *)values { [_values release];_values=[values copy];[self setNeedsDisplay:YES]; }
- (void)layout { [super layout];_channels.frame=NSMakeRect(12,4,self.bounds.size.width-24,24); }
- (void)layout { [super layout];_channels.frame=NSMakeRect(12,4,MAX(100,self.bounds.size.width-112),24);_histogramToggle.frame=NSMakeRect(self.bounds.size.width-88,5,80,22); }
- (void)setHistogram:(NSData *)histogram {if(_histogram==histogram)return;[_histogram release];_histogram=[histogram copy];const DYHistogram *h=_histogram.length==sizeof(DYHistogram)?(const DYHistogram*)_histogram.bytes:nullptr;_histogramToggle.accessibilityValueDescription=h&&h->samples?[NSString stringWithFormat:@"分析画面,%u 个有效采样",h->samples]:@"等待画面;请移动播放头";[self setNeedsDisplay:YES];}
- (void)histogramToggled:(id)sender {[self setNeedsDisplay:YES];}
- (void)channelChanged:(NSSegmentedControl *)sender { _channel=sender.selectedSegment;[self setNeedsDisplay:YES]; }
- (NSRect)plotRect { return NSMakeRect(16,37,MAX(50,self.bounds.size.width-32),MAX(50,self.bounds.size.height-56)); }
- (NSRect)plotRect { return NSMakeRect(16,37,MAX(50,self.bounds.size.width-32),MAX(50,self.bounds.size.height-76)); }
- (NSArray *)slots {
NSMutableArray *result=[NSMutableArray array];
NSInteger n=_channel==0?4:2;
@@ -282,7 +289,20 @@ static NSArray *DYPresentationSections(void) {
}
- (void)drawRect:(NSRect)dirtyRect {
NSRect r=[self plotRect];
[(DYThemeIndex()==5?DYThemeColor(@"card"):[NSColor colorWithSRGBRed:.025 green:.085 blue:.13 alpha:1]) setFill];[[NSBezierPath bezierPathWithRoundedRect:r xRadius:4 yRadius:4] fill];
[(DYThemeIndex()>=5?DYThemeColor(@"card"):[NSColor colorWithSRGBRed:.025 green:.085 blue:.13 alpha:1]) setFill];[[NSBezierPath bezierPathWithRoundedRect:r xRadius:4 yRadius:4] fill];
if(_histogramToggle.state==NSControlStateValueOn){
const DYHistogram *h=_histogram.length==sizeof(DYHistogram)?(const DYHistogram*)_histogram.bytes:nullptr;
if(h&&h->samples){
uint32_t peak=1;for(int c=0;c<4;c++)if(_channel==0||c==_channel)for(int b=0;b<256;b++)peak=MAX(peak,h->bins[c][b]);
NSArray *colors=@[NSColor.whiteColor,[NSColor colorWithSRGBRed:1 green:.23 blue:.37 alpha:1],[NSColor colorWithSRGBRed:.23 green:.94 blue:.50 alpha:1],[NSColor colorWithSRGBRed:.19 green:.51 blue:1 alpha:1]];
[NSGraphicsContext saveGraphicsState];NSRectClip(r);
for(int c=3;c>=0;c--){if(_channel!=0&&c!=_channel)continue;
NSBezierPath *area=[NSBezierPath bezierPath],*line=[NSBezierPath bezierPath];[area moveToPoint:NSMakePoint(NSMinX(r),NSMaxY(r))];
for(int b=0;b<256;b++){NSPoint q=NSMakePoint(NSMinX(r)+b/255.*r.size.width,NSMaxY(r)-sqrt(h->bins[c][b]/double(peak))*r.size.height*.86);[area lineToPoint:q];if(b==0)[line moveToPoint:q];else[line lineToPoint:q];}
[area lineToPoint:NSMakePoint(NSMaxX(r),NSMaxY(r))];[area closePath];[[colors[c]colorWithAlphaComponent:c==0?.08:.19]setFill];[area fill];[[colors[c]colorWithAlphaComponent:c==0?.65:.62]setStroke];line.lineWidth=.8;[line stroke];
}[NSGraphicsContext restoreGraphicsState];
}else [@"等待画面 · 请移动播放头" drawAtPoint:NSMakePoint(r.origin.x+8,NSMaxY(r)-20) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:10],NSForegroundColorAttributeName:DYThemeColor(@"secondary")}];
}
[[NSColor colorWithWhite:1 alpha:.1] setStroke];NSBezierPath *grid=[NSBezierPath bezierPath];grid.lineWidth=.5;
for(int i=0;i<5;i++){CGFloat x=r.origin.x+r.size.width*i/4,y=r.origin.y+r.size.height*i/4;[grid moveToPoint:NSMakePoint(x,NSMinY(r))];[grid lineToPoint:NSMakePoint(x,NSMaxY(r))];[grid moveToPoint:NSMakePoint(NSMinX(r),y)];[grid lineToPoint:NSMakePoint(NSMaxX(r),y)];}[grid stroke];
std::vector<NSPoint> p; p.push_back(NSMakePoint(0,0));
@@ -306,8 +326,10 @@ static NSArray *DYPresentationSections(void) {
NSPoint q=NSMakePoint(r.origin.x+x*r.size.width,r.origin.y+(1-fmax(0,fmin(1,y)))*r.size.height);
if(sample==0)[curve moveToPoint:q];else[curve lineToPoint:q];
}
NSColor *color=_channel==0?DYAccent():_channel==1?[NSColor systemRedColor]:_channel==2?[NSColor systemGreenColor]:[NSColor systemBlueColor];[color setStroke];[curve stroke];
NSColor *color=_channel==0?(DYThemeIndex()==6?NSColor.whiteColor:DYAccent()):_channel==1?[NSColor systemRedColor]:_channel==2?[NSColor systemGreenColor]:[NSColor systemBlueColor];[color setStroke];[curve stroke];
for(NSDictionary *point in points) {NSPoint q=[self positionOfPoint:point];[color setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(q.x-4,q.y-4,8,8)] fill];[DYInk() setStroke];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(q.x-4,q.y-4,8,8)] stroke];}
NSDictionary *axis=@{NSFontAttributeName:[NSFont monospacedDigitSystemFontOfSize:8 weight:NSFontWeightRegular],NSForegroundColorAttributeName:DYThemeColor(@"secondary")};
[@"0" drawAtPoint:NSMakePoint(NSMinX(r),NSMaxY(r)+2) withAttributes:axis];[@"128" drawAtPoint:NSMakePoint(NSMidX(r)-7,NSMaxY(r)+2) withAttributes:axis];[@"255" drawAtPoint:NSMakePoint(NSMaxX(r)-14,NSMaxY(r)+2) withAttributes:axis];
[@"点击添加 · 拖动调整 · 双击删除" drawAtPoint:NSMakePoint(16,self.bounds.size.height-16) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:9],NSForegroundColorAttributeName:[NSColor colorWithWhite:.7 alpha:1]}];
}
- (void)sendValues:(NSDictionary *)values {
@@ -477,6 +499,7 @@ static NSImage *DYWheelImage(void) {
_load=[DYButton(@"载入预设",self,@selector(loadPreset:)) retain];
_export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain];
_colorSettings=[DYButton(@"颜色设置",self,@selector(toggleColorSettings:))retain];[_colorSettings setButtonType:NSButtonTypePushOnPushOff];_colorSettings.toolTip=@"展开或收起高级颜色设置;默认使用原有流程";_colorSettings.accessibilityLabel=@"颜色设置";_colorSettings.accessibilityValue=@"已收起";
_save.identifier=@"primaryAction";
_addModule=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect pullsDown:YES];_addModule.font=[NSFont systemFontOfSize:11];_addModule.accessibilityLabel=@"添加模块";[_addModule addItemWithTitle:@"+ 添加模块"];
for(NSDictionary *section in DYPresentationSections()){NSMenuItem *item=[[[NSMenuItem alloc]initWithTitle:section[@"title"] action:@selector(addModule:) keyEquivalent:@""]autorelease];item.target=self;item.representedObject=section[@"key"];[_addModule.menu addItem:item];}
for(NSView *v in @[_brand,_subtitle,_websiteLink,_resetAll,_save,_load,_export,_colorSettings,_addModule]){[self addSubview:v];v.hidden=_embedded;}
@@ -518,7 +541,7 @@ static NSImage *DYWheelImage(void) {
[super dealloc];
}
- (BOOL)isFlipped { return YES; }
- (void)drawRect:(NSRect)rect {DYDrawThemeSurface([NSBezierPath bezierPathWithRect:self.bounds],NO);}
- (void)drawRect:(NSRect)rect {DYDrawThemeSurface([NSBezierPath bezierPathWithRect:self.bounds],NO);if(DYThemeIndex()==6&&![self.identifier isEqual:@"inspectorBackground"]){NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"activeTop"] endingColor:DYThemePalette()[@"activeBottom"]]autorelease];[g drawInRect:NSMakeRect(0,0,self.bounds.size.width,2) angle:0];}}
- (BOOL)isAccessibilityElement { return YES; }
- (NSAccessibilityRole)accessibilityRole { return NSAccessibilityGroupRole; }
- (NSArray *)accessibilityChildren { return DYAccessibleSubviews(self,NO); }
@@ -558,7 +581,7 @@ static NSImage *DYWheelImage(void) {
[self setNeedsLayout:YES];NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
}
- (void)addLook:(id)sender {_visibleLooks=MIN(5,_visibleLooks+1);[self setNeedsLayout:YES];}
- (void)previewChanged:(NSNotification *)note {[_managedPanel refreshContext];if(_browser.visible)[_browser updatePreview:[_renderer lookLUTPreview]];}
- (void)previewChanged:(NSNotification *)note {for(id graphic in _graphics)if([graphic isKindOfClass:DYCurvePanel.class])[graphic setHistogram:[_renderer histogram]];[_managedPanel refreshContext];if(_browser.visible)[_browser updatePreview:[_renderer lookLUTPreview]];}
- (void)buildCards {
NSInteger index=0;
for(NSDictionary *section in _sections) {
@@ -612,7 +635,7 @@ static NSImage *DYWheelImage(void) {
NSSegmentedControl *tabs=[NSSegmentedControl segmentedControlWithLabels:[key isEqual:@"mixer"]?@[@"红输出",@"绿输出",@"蓝输出"]:@[@"减色",@"晕光",@"辉光",@"颗粒",@"暗角",@"印片"] trackingMode:NSSegmentSwitchTrackingSelectOne target:self action:@selector(tabChanged:)];tabs.identifier=key;tabs.selectedSegment=0;tabs.controlSize=NSControlSizeSmall;tabs.accessibilityLabel=[section[@"title"]stringByAppendingString:@"分组"];[card addSubview:tabs];[body addObject:tabs];
}
if([key isEqual:@"curve"]) {
DYCurvePanel *graph=[[[DYCurvePanel alloc]initWithFrame:NSZeroRect]autorelease];graph.delegate=self;graph.identifier=@"curveGraph";[card addSubview:graph];[body addObject:graph];[_graphics addObject:graph];
DYCurvePanel *graph=[[[DYCurvePanel alloc]initWithFrame:NSZeroRect]autorelease];graph.delegate=self;[graph setHistogram:[_renderer histogram]];graph.identifier=@"curveGraph";[card addSubview:graph];[body addObject:graph];[_graphics addObject:graph];
}
if([key isEqual:@"grading"]) {
DYWheelPanel *wheels=[[[DYWheelPanel alloc]initWithFrame:NSZeroRect]autorelease];wheels.delegate=self;wheels.identifier=@"gradingWheels";[card addSubview:wheels];[body addObject:wheels];[_graphics addObject:wheels];
@@ -719,8 +742,8 @@ static NSImage *DYWheelImage(void) {
- (void)layout {
[super layout];
CGFloat w=MAX(280,self.bounds.size.width),h=self.bounds.size.height;
_brand.frame=NSMakeRect(16,14,112,26);_subtitle.frame=NSMakeRect(130,21,40,13);_subtitle.hidden=_embedded||w<340;
for(NSInteger i=0;i<_themeButtons.count;i++)[_themeButtons[i]setFrame:NSMakeRect(w-147+i*19,17,19,22)];
_brand.frame=NSMakeRect(16,14,112,26);_subtitle.frame=NSMakeRect(130,21,40,13);_subtitle.hidden=_embedded||w<380;
for(NSInteger i=0;i<_themeButtons.count;i++)[_themeButtons[i]setFrame:NSMakeRect(w-147+i*16,17,16,22)];
_resetAll.frame=NSMakeRect(w-33,16,23,24);
_websiteLink.frame=NSMakeRect(16,41,w-32,20);
CGFloat gap=7;BOOL compact=w<320;CGFloat bw=(w-32-gap*(compact?1:3))/(compact?2:4);
+1 -1
查看文件
@@ -3,7 +3,7 @@
id<MTLComputePipelineState>p=[self managedKernel:@"dyManagedPreview" entry:entry error:nil];if(!p)return;
id<MTLBuffer>b=[entry[@"device"]newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];if(!b)return;
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:p];[ce setTexture:texture atIndex:0];[ce setBuffer:b offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];
if(cb.status==MTLCommandBufferStatusCompleted){@synchronized(_previewLock){[_preview release];_preview=[[NSData alloc]initWithBytes:b.contents length:b.length];[_lookLUTPreview release];if(origin==kFxImageOrigin_BOTTOM_LEFT){NSMutableData *flipped=[NSMutableData dataWithLength:b.length];for(NSUInteger y=0;y<180;y++)memcpy((uint8_t*)flipped.mutableBytes+y*320*16,(uint8_t*)b.contents+(179-y)*320*16,320*16);_lookLUTPreview=[flipped copy];}else _lookLUTPreview=[_preview retain];_lastPreview=CACurrentMediaTime();}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}[b release];
if(cb.status==MTLCommandBufferStatusCompleted){@synchronized(_previewLock){[_preview release];_preview=[[NSData alloc]initWithBytes:b.contents length:b.length];[_histogram release];_histogram=[DYHistogramFromRGBA(_preview) retain];[_lookLUTPreview release];if(origin==kFxImageOrigin_BOTTOM_LEFT){NSMutableData *flipped=[NSMutableData dataWithLength:b.length];for(NSUInteger y=0;y<180;y++)memcpy((uint8_t*)flipped.mutableBytes+y*320*16,(uint8_t*)b.contents+(179-y)*320*16,320*16);_lookLUTPreview=[flipped copy];}else _lookLUTPreview=[_preview retain];_lastPreview=CACurrentMediaTime();}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}[b release];
}
// Included in DYRenderer. V1 callers and their ABI remain on renderSource:...tools:error:.
- (NSDictionary*)colorContext {@synchronized(_previewLock){return [[_colorContext copy]autorelease];}}
+2
查看文件
@@ -14,6 +14,8 @@
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
- (NSData*)preview;
/// 256-bin luma/R/G/B of the existing 320×180 analysis preview.
- (NSData*)histogram;
/// Display-encoded float RGBA, 320×180, with the visually top row first.
/// Analysis preview retains the host texture's original row order separately.
- (NSData*)lookLUTPreview;
+6 -3
查看文件
@@ -1,3 +1,4 @@
#import "DYHistogram.h"
#import "DYManagedColor.h"
#import "../../ColorManagement/Sources/DYColorManagementGPU.h"
#import "../../ColorManagement/Sources/DYColorProfile.h"
@@ -105,7 +106,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
dispatch_queue_t _lutPreparationQueue;
DYColorTables *_tables;
NSObject *_previewLock;
NSData *_preview,*_lookLUTPreview;
NSData *_preview,*_lookLUTPreview,*_histogram;
CFTimeInterval _lastPreview;
BOOL _exporting;
NSDictionary *_toolDocument,*_colorContext,*_exportManagedState;
@@ -118,7 +119,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
#include "DYManagedRender.inc.h"
#include "DYToolRender.inc.h"
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_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{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_colorContext release];[_previewLock release];[super dealloc];}
- (void)dealloc{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_histogram 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];
@@ -141,7 +142,8 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
progress.completedUnitCount=2;dispatch_async(dispatch_get_main_queue(),^{NSError *result=progress.cancelled?[NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]:error;if(completion)completion(result);});
}});return progress;
}
- (void)invalidatePreview{@synchronized(_previewLock){[_preview release];_preview=nil;[_lookLUTPreview release];_lookLUTPreview=nil;_lastPreview=0;}}
- (void)invalidatePreview{@synchronized(_previewLock){[_preview release];_preview=nil;[_lookLUTPreview release];_lookLUTPreview=nil;[_histogram release];_histogram=nil;_lastPreview=0;}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}
- (NSData*)histogram{@synchronized(_previewLock){return [[_histogram retain]autorelease];}}
- (NSData*)preview{@synchronized(_previewLock){return [[_preview retain]autorelease];}}
- (NSData*)lookLUTPreview{@synchronized(_previewLock){return [[_lookLUTPreview retain]autorelease];}}
- (NSMutableDictionary*)device:(uint64_t)registry error:(NSError**)err{
@@ -229,6 +231,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
vector_uint2 vp={(unsigned)output.width,(unsigned)output.height};[re setVertexBytes:vs length:sizeof(vs) atIndex:0];[re setVertexBytes:&vp length:sizeof(vp) atIndex:1];[re setViewport:(MTLViewport){0,0,w,h,0,1}];[re setFragmentTexture:straight atIndex:0];for(NSUInteger i=0;i<ts.count;i++)[re setFragmentTexture:ts[i] atIndex:i+1];[re setFragmentBytes:&u length:sizeof(u) atIndex:0];[re setFragmentBuffer:scene offset:0 atIndex:1];DYRenderOptions options={1,bwMix,0,0};[re setFragmentBytes:&options length:sizeof(options) atIndex:2];DYUniforms color=u;color.blackWhiteSectionEnabled=0;[re setFragmentBytes:&color length:sizeof(color) atIndex:3];if(spiderBuffer)[re setFragmentBuffer:spiderBuffer offset:0 atIndex:4];else{float empty[2]={0,0};[re setFragmentBytes:empty length:sizeof(empty) atIndex:4];}[re setFragmentBytes:&spiderSize length:sizeof(spiderSize) atIndex:5];if(hasMasks||segmented){[re setFragmentBuffer:maskBuffer offset:0 atIndex:6];[re setFragmentBytes:&maskHeader length:sizeof(maskHeader) atIndex:7];}if(segmented){DYToolStageRange range={(int)stageFirst,(int)stageLast,(int)suppressBlackWhite};[re setFragmentBytes:&range length:sizeof(range) atIndex:8];[re setFragmentTexture:skinReference?[skinReference metalTextureForDevice:d]:input atIndex:10];[re setFragmentTexture:nativeSource atIndex:11];}[re drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[re endEncoding];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
if(ok&&pb){@synchronized(_previewLock){
[_preview release];_preview=[[NSData alloc]initWithBytes:pb.contents length:320*180*16];
[_histogram release];_histogram=[DYHistogramFromRGBA(_preview) retain];
// The analysis kernel reads physical texture rows. Its result remains intact
// for auto grade; only the browser copy is normalized to top-first bitmap rows.
[_lookLUTPreview release];
+15 -14
查看文件
@@ -11,7 +11,7 @@ static NSColor *rgb(double r,double g,double b){return [NSColor colorWithCalibra
- (instancetype)init {
if((self=[super init])) {
_defaults=[[NSUserDefaults alloc]initWithSuiteName:preferenceDomain];
[_defaults registerDefaults:@{@"themeIndex":@5}];
[_defaults registerDefaults:@{@"themeIndex":@6}];
[[NSDistributedNotificationCenter defaultCenter]addObserver:self selector:@selector(externalChange:) name:distributedChange object:preferenceDomain suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
}
return self;
@@ -23,26 +23,27 @@ static NSColor *rgb(double r,double g,double b){return [NSColor colorWithCalibra
}
@end
static DYThemeStore *store(void){static DYThemeStore *s;static dispatch_once_t once;dispatch_once(&once,^{s=[DYThemeStore new];});return s;}
NSArray<NSString *> *DYThemeNames(void){return @[@"深空灰",@"冰川蓝",@"薰衣草紫",@"翡翠绿",@"琥珀橙",@"黑金渐变"];}
NSInteger DYThemeIndex(void){NSInteger i=[store().defaults integerForKey:@"themeIndex"];return i>=0&&i<6?i:5;}
static const double paletteRGB[6][17][3]={
NSArray<NSString *> *DYThemeNames(void){return @[@"深空灰",@"冰川蓝",@"薰衣草紫",@"翡翠绿",@"琥珀橙",@"黑金渐变",@"霓虹炫彩"];}
NSInteger DYThemeIndex(void){NSInteger i=[store().defaults integerForKey:@"themeIndex"];return i>=0&&i<7?i:6;}
static const double paletteRGB[7][17][3]={
{{0.11,0.12,0.14},{0.075,0.08,0.095},{0.17,0.18,0.21},{0.12,0.13,0.15},{0.27,0.29,0.33},{0.2,0.22,0.25},{0.36,0.39,0.44},{0.25,0.28,0.32},{0.21,0.23,0.26},{0.15,0.17,0.2},{0.78,0.83,0.9},{0.55,0.61,0.7},{1.0,1.0,1.0},{0.78,0.82,0.88},{0.96,0.97,0.98},{0.86,0.89,0.92},{0.67,0.72,0.77}},
{{0.031,0.086,0.148},{0.025,0.075,0.13},{0.07,0.155,0.235},{0.045,0.12,0.19},{0.115,0.22,0.33},{0.07,0.15,0.24},{0.15,0.33,0.5},{0.08,0.24,0.36},{0.23,0.32,0.41},{0.18,0.26,0.35},{0.38,0.76,1.0},{0.23,0.64,0.97},{0.96,0.98,1.0},{0.62,0.7,0.76},{0.88,0.96,1.0},{0.82,0.9,0.96},{0.58,0.7,0.78}},
{{0.11,0.09,0.17},{0.07,0.06,0.12},{0.18,0.14,0.28},{0.13,0.1,0.21},{0.27,0.22,0.42},{0.2,0.16,0.31},{0.43,0.34,0.68},{0.31,0.23,0.52},{0.22,0.18,0.31},{0.15,0.12,0.23},{0.78,0.71,1.0},{0.5,0.42,0.93},{0.95,0.9,1.0},{0.63,0.5,0.95},{0.98,0.95,1.0},{0.9,0.86,0.97},{0.7,0.66,0.82}},
{{0.08,0.17,0.1},{0.05,0.12,0.07},{0.12,0.27,0.15},{0.09,0.2,0.11},{0.16,0.35,0.2},{0.12,0.27,0.15},{0.21,0.57,0.31},{0.14,0.4,0.21},{0.14,0.27,0.16},{0.1,0.2,0.11},{0.54,0.96,0.64},{0.22,0.75,0.35},{0.91,1.0,0.93},{0.28,0.8,0.42},{0.95,1.0,0.96},{0.86,0.96,0.88},{0.66,0.8,0.68}},
{{0.23,0.15,0.08},{0.16,0.1,0.05},{0.35,0.22,0.11},{0.26,0.16,0.08},{0.45,0.28,0.14},{0.36,0.22,0.1},{0.72,0.44,0.18},{0.56,0.32,0.12},{0.29,0.18,0.09},{0.2,0.12,0.06},{0.98,0.67,0.31},{0.86,0.47,0.17},{1.0,0.86,0.57},{0.93,0.59,0.22},{1.0,0.96,0.9},{0.97,0.9,0.82},{0.8,0.7,0.58}},
{{.065,.060,.050},{.012,.012,.012},{.12,.105,.075},{.045,.042,.035},{.105,.092,.065},{.15,.125,.075},{.17,.14,.085},{.075,.065,.045},{.23,.20,.14},{.10,.09,.065},{.98,.82,.42},{.72,.51,.18},{1,.90,.65},{.88,.74,.43},{1,.86,.48},{.96,.82,.49},{.79,.70,.48}}
{{.065,.060,.050},{.012,.012,.012},{.12,.105,.075},{.045,.042,.035},{.105,.092,.065},{.15,.125,.075},{.17,.14,.085},{.075,.065,.045},{.23,.20,.14},{.10,.09,.065},{.98,.82,.42},{.72,.51,.18},{1,.90,.65},{.88,.74,.43},{1,.86,.48},{.96,.82,.49},{.79,.70,.48}},
{{.12,.10,.22},{.055,.045,.105},{.18,.15,.29},{.10,.085,.18},{.16,.14,.25},{.21,.17,.34},{.24,.19,.37},{.13,.12,.24},{.29,.27,.39},{.15,.14,.23},{.80,.18,1},{.04,.78,.97},{.94,.95,1},{.73,.71,.86},{.96,.95,1},{.88,.87,.96},{.75,.74,.85}}
};
NSColor *DYThemeSwatch(NSInteger index){static const double values[6][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28},{.96,.77,.36}};index=MAX(0,MIN(5,index));return rgb(values[index][0],values[index][1],values[index][2]);}
void DYSetThemeIndex(NSInteger index){if(index<0||index>5)return;[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];}
NSColor *DYThemeSwatch(NSInteger index){static const double values[7][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28},{.96,.77,.36},{.65,.38,1}};index=MAX(0,MIN(6,index));return rgb(values[index][0],values[index][1],values[index][2]);}
void DYSetThemeIndex(NSInteger index){if(index<0||index>6)return;[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];}
NSDictionary<NSString *,NSColor *> *DYThemePalette(void){
static NSArray *palettes;static dispatch_once_t once;dispatch_once(&once,^{
NSMutableArray *all=[NSMutableArray array];
for(NSInteger index=0;index<6;index++){
for(NSInteger index=0;index<7;index++){
const double (*p)[3]=paletteRGB[index];NSMutableDictionary *d=[NSMutableDictionary dictionary];
for(int i=0;i<17;i++)d[[NSString stringWithFormat:@"slot%d",i]]=rgb(p[i][0],p[i][1],p[i][2]);
NSColor *accent=index==0?rgb(.72,.77,.84):index==1?rgb(.22,.67,1):DYThemeSwatch(index);
[d addEntriesFromDictionary:@{@"background":d[@"slot1"],@"card":d[@"slot3"],@"border":[accent colorWithAlphaComponent:.38],@"text":d[@"slot14"],@"secondary":d[@"slot16"],@"accent":accent,@"field":d[@"slot4"],@"headerTop":d[@"slot6"],@"headerBottom":d[@"slot7"],@"track":d[@"slot8"],@"activeTop":d[@"slot10"],@"activeBottom":d[@"slot11"],@"knob":d[@"slot12"]}];d[@"backgroundEnd"]=index==5?rgb(.085,.078,.060):d[@"background"];d[@"cardEnd"]=index==5?rgb(.085,.075,.052):d[@"card"];[all addObject:[[d copy]autorelease]];
[d addEntriesFromDictionary:@{@"background":d[@"slot1"],@"card":d[@"slot3"],@"border":[accent colorWithAlphaComponent:.38],@"text":d[@"slot14"],@"secondary":d[@"slot16"],@"accent":accent,@"field":d[@"slot4"],@"headerTop":d[@"slot6"],@"headerBottom":d[@"slot7"],@"track":d[@"slot8"],@"activeTop":d[@"slot10"],@"activeBottom":d[@"slot11"],@"knob":d[@"slot12"]}];d[@"backgroundEnd"]=index==5?rgb(.085,.078,.060):d[@"background"];d[@"cardEnd"]=index==5?rgb(.085,.075,.052):d[@"card"];if(index==6){d[@"backgroundEnd"]=rgb(.105,.075,.18);d[@"cardEnd"]=rgb(.14,.11,.23);d[@"border"]=[rgb(.58,.43,.80)colorWithAlphaComponent:.55];} [all addObject:[[d copy]autorelease]];
}palettes=[all copy];
});return palettes[DYThemeIndex()];
}
@@ -63,7 +64,7 @@ NSDictionary *DYThemeTextAttributes(NSFont *font,NSColor *color) {
}
void DYDrawThemeSurface(NSBezierPath *path,BOOL card) {
NSDictionary *palette=DYThemePalette();NSString *role=card?@"card":@"background";
if(DYThemeIndex()==5){NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:palette[role] endingColor:palette[card?@"cardEnd":@"backgroundEnd"]]autorelease];[gradient drawInBezierPath:path angle:35];}
if(DYThemeIndex()>=5){NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:palette[role] endingColor:palette[card?@"cardEnd":@"backgroundEnd"]]autorelease];[gradient drawInBezierPath:path angle:35];}
else {[palette[role]setFill];[path fill];}
}
@implementation DYThemeLabel
@@ -72,12 +73,12 @@ void DYDrawThemeSurface(NSBezierPath *path,BOOL card) {
@interface DYThemeButtonCell : NSButtonCell @end
@implementation DYThemeButtonCell
- (NSRect)drawTitle:(NSAttributedString*)title withFrame:(NSRect)frame inView:(NSView*)view {
if(DYThemeIndex()!=5)return [super drawTitle:title withFrame:frame inView:view];
if(DYThemeIndex()<5)return [super drawTitle:title withFrame:frame inView:view];
NSMutableAttributedString *gold=[[title mutableCopy]autorelease];[gold addAttributes:DYThemeTextAttributes(self.font?:[NSFont systemFontOfSize:11],[DYThemeColor(@"text")colorWithAlphaComponent:self.enabled?1:.45]) range:NSMakeRange(0,gold.length)];return [super drawTitle:gold withFrame:frame inView:view];
}
- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)view {
if(DYThemeIndex()!=5||!self.bordered){[super drawBezelWithFrame:frame inView:view];return;}
NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame,1,2) xRadius:6 yRadius:6];DYDrawThemeSurface(path,YES);[[DYThemeColor(@"accent")colorWithAlphaComponent:self.highlighted?.8:.32]setStroke];path.lineWidth=self.highlighted?1.5:1;[path stroke];
if(DYThemeIndex()<5||!self.bordered){[super drawBezelWithFrame:frame inView:view];return;}
NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame,1,2) xRadius:6 yRadius:6];if(DYThemeIndex()==6&&[view.identifier isEqual:@"primaryAction"]){NSGradient *g=[[[NSGradient alloc]initWithColors:@[DYThemePalette()[@"activeTop"],DYThemePalette()[@"activeBottom"]]]autorelease];[g drawInBezierPath:path angle:0];}else DYDrawThemeSurface(path,YES);[[DYThemeColor(@"accent")colorWithAlphaComponent:self.highlighted?.8:.32]setStroke];path.lineWidth=self.highlighted?1.5:1;[path stroke];
}
@end
@implementation DYThemeButton
@@ -85,7 +86,7 @@ void DYDrawThemeSurface(NSBezierPath *path,BOOL card) {
@end
@implementation DYThemePopUpButton
- (void)drawRect:(NSRect)rect {
if(DYThemeIndex()!=5){[super drawRect:rect];return;}
if(DYThemeIndex()<5){[super drawRect:rect];return;}
NSRect bounds=NSInsetRect(self.bounds,1,2);NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:bounds xRadius:6 yRadius:6];DYDrawThemeSurface(path,YES);
[[DYThemeColor(@"accent")colorWithAlphaComponent:self.enabled?.38:.18]setStroke];path.lineWidth=1;[path stroke];
NSMutableDictionary *attributes=[NSMutableDictionary dictionaryWithDictionary:DYThemeTextAttributes(self.font?:[NSFont systemFontOfSize:11],[DYThemeColor(@"text")colorWithAlphaComponent:self.enabled?1:.45])];NSMutableParagraphStyle *paragraph=[[[NSMutableParagraphStyle alloc]init]autorelease];paragraph.lineBreakMode=NSLineBreakByTruncatingTail;attributes[NSParagraphStyleAttributeName]=paragraph;
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.8.2</string>
<string>1.8.3</string>
<key>CFBundleVersion</key>
<string>59</string>
<string>60</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.8.2</string>
<string>1.8.3</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.2</string>
<string>1.8.3</string>
<key>CFBundleVersion</key>
<string>59</string>
<string>60</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>