Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
backdrop: adjust filter params
Browse files Browse the repository at this point in the history
Signed-off-by: 82Flex <[email protected]>
  • Loading branch information
Lessica committed Jan 25, 2024
1 parent 03bd22a commit 12e4493
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions sources/HUDBackdropLabel.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@
#import "HUDBackdropView.h"
#import "CAFilter.h"

@interface HUDBackdropTextLayer : CATextLayer

@end

@implementation HUDBackdropTextLayer

- (void)drawInContext:(CGContextRef)ctx
{
CGContextSetShouldSmoothFonts(ctx, true);
[super drawInContext:ctx];
}

@end

@implementation HUDBackdropLabel {
BOOL _isColorInvertEnabled;
HUDBackdropView *_backdropView;
Expand Down Expand Up @@ -64,14 +50,14 @@ - (void)setupAppearance
_backdropView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

CAFilter *blurFilter = [CAFilter filterWithName:kCAFilterGaussianBlur];
[blurFilter setValue:@(50.0) forKey:@"inputRadius"];
[blurFilter setValue:@(50.0) forKey:@"inputRadius"]; // radius 50pt
[blurFilter setValue:@YES forKey:@"inputNormalizeEdges"]; // inputHardEdges

CAFilter *brightnessFilter = [CAFilter filterWithName:kCAFilterColorBrightness];
[brightnessFilter setValue:@(0.06) forKey:@"inputAmount"];
[brightnessFilter setValue:@(-0.3) forKey:@"inputAmount"]; // -30%

CAFilter *contrastFilter = [CAFilter filterWithName:kCAFilterColorContrast];
[contrastFilter setValue:@(10.0) forKey:@"inputAmount"];
[contrastFilter setValue:@(500.0) forKey:@"inputAmount"]; // 500x

CAFilter *saturateFilter = [CAFilter filterWithName:kCAFilterColorSaturate];
[saturateFilter setValue:@(0.0) forKey:@"inputAmount"];
Expand All @@ -83,7 +69,7 @@ - (void)setupAppearance
saturateFilter, colorInvertFilter,
]];

_backdropTextLayer = [HUDBackdropTextLayer layer];
_backdropTextLayer = [CATextLayer layer];
_backdropTextLayer.contentsScale = self.layer.contentsScale;
_backdropTextLayer.allowsEdgeAntialiasing = NO;
_backdropTextLayer.allowsFontSubpixelQuantization = YES;
Expand Down

0 comments on commit 12e4493

Please sign in to comment.