Fix the test case of blur radius calculation. CG and CI now match in visual

This commit is contained in:
DreamPiggy 2020-01-03 14:45:13 +08:00
parent 1afadafc78
commit 86e3a164dc
2 changed files with 4 additions and 2 deletions

View File

@ -582,7 +582,8 @@ static inline CGImageRef _Nullable SDCGImageFromCIImage(CIImage * _Nonnull ciIma
if (self.CIImage) {
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
[filter setValue:self.CIImage forKey:kCIInputImageKey];
[filter setValue:@(blurRadius) forKey:kCIInputRadiusKey];
// Blur Radius use pixel count
[filter setValue:@(blurRadius / 2) forKey:kCIInputRadiusKey];
CIImage *ciImage = filter.outputImage;
ciImage = [ciImage imageByCroppingToRect:CGRectMake(0, 0, self.size.width, self.size.height)];
#if SD_UIKIT

View File

@ -182,7 +182,8 @@
expect([leftColor.sd_hexString isEqualToString:expectedColor.sd_hexString]);
// Check rounded corner operation not inversion the image
UIColor *topCenterColor = [blurredImage sd_colorAtPoint:CGPointMake(150, 20)];
expect([topCenterColor.sd_hexString isEqualToString:@"#9a430d06"]).beTruthy();
UIColor *bottomCenterColor = [blurredImage sd_colorAtPoint:CGPointMake(150, 280)];
expect([topCenterColor.sd_hexString isEqualToString:bottomCenterColor.sd_hexString]).beFalsy();
}
- (void)test08UIImageTransformFilterCG {