Im generating image with strip lines using CoreImage framework and the output seems to have improper edges as shown in the below image. Code I have used is as below.
fileprivate func generateImage(_ width: CGFloat, _ height: CGFloat, withColor1: CIColor, withColor2: CIColor) -> CGImage? {
let context = CIContext()
if #available(iOS 10.0, *) {
let stripes = CIFilter(name: "CIStripesGenerator", withInputParameters: [
"inputColor0" : withColor2,
"inputColor1" : withColor1,
"inputWidth" : NSNumber(value: 10),
"inputSharpness" : NSNumber(value: 0.7)
])!.outputImage!
let rotate = CIFilter(name: "CIAffineTransform", withInputParameters: [ "inputImage" : stripes,"inputTransform" : NSValue(cgAffineTransform: CGAffineTransform(rotationAngle: -75.0))])!.outputImage!
return context.createCGImage(rotate, from: CGRect(x: 0, y: 0, width: width, height: 50.0))!
} else {
// Fallback on earlier versions
}
return nil
}
With high sharpness
With low sharpness(0.7)
What I need is below