Skip to content

Commit

Permalink
implement setDefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
YuAo committed Jan 27, 2016
1 parent a81e17d commit f5ffa05
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Sources/YUCIHighPass.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ - (NSNumber *)inputRadius {
return _inputRadius;
}

- (void)setDefaults {
self.inputRadius = nil;
}

- (CIImage *)outputImage {
CIFilter *blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
[blurFilter setValue:self.inputRadius forKey:kCIInputRadiusKey];
Expand Down
6 changes: 6 additions & 0 deletions Sources/YUCIHighPassSkinSmoothing.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ - (void)setInputToneCurveControlPoints:(NSArray<CIVector *> *)inputToneCurveCont
return self.skinToneCurveFilter.rgbCompositeControlPoints;
}

- (void)setDefaults {
self.inputAmount = nil;
self.inputRadius = nil;
self.skinToneCurveFilter = nil;
}

- (CIImage *)outputImage {
YUCIHighPassSkinSmoothingMaskGenerator *maskGenerator = [[YUCIHighPassSkinSmoothingMaskGenerator alloc] init];
maskGenerator.inputRadius = self.inputRadius;
Expand Down
14 changes: 13 additions & 1 deletion Sources/YUCIRGBToneCurve.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,20 @@ - (NSNumber *)inputIntensity {
return _inputIntensity;
}

- (NSArray<CIVector *> *)defaultCurveControlPoints {
return [NSArray arrayWithObjects:[CIVector vectorWithX:0 Y:0], [CIVector vectorWithX:0.5 Y:0.5], [CIVector vectorWithX:1 Y:1], nil];
}

- (void)setDefaults {
self.inputIntensity = nil;
self.redControlPoints = self.defaultCurveControlPoints;
self.greenControlPoints = self.defaultCurveControlPoints;
self.blueControlPoints = self.defaultCurveControlPoints;
self.rgbCompositeControlPoints = self.defaultCurveControlPoints;
}

- (CIImage *)outputImage {
NSArray *defaultCurve = [NSArray arrayWithObjects:[CIVector vectorWithX:0 Y:0], [CIVector vectorWithX:0.5 Y:0.5], [CIVector vectorWithX:1 Y:1], nil];
NSArray *defaultCurve = self.defaultCurveControlPoints;
if (self.redControlPoints.count == 0) {
self.redControlPoints = defaultCurve;
}
Expand Down

0 comments on commit f5ffa05

Please sign in to comment.