iOS: разные цвета HUE из Photoshop - PullRequest
0 голосов
/ 26 сентября 2019

Я использую фильтр Hue для изменения оттенка изображения, минимум слайдера: -3.14 максимум слайдера: 3.14 Я получаю оттенок с более темными цветами, в то время как Photoshop имеет более светлую версию.Может кто-нибудь помочь мне с этим?enter image description here
enter image description here

func rotateHue(with ciImage: CIImage,

               rotatedByHue deltaHueRadians: CGFloat,

               orientation:UIImageOrientation?,

               screenWidth:CGFloat,

               screenHeight:CGFloat) -> UIImage {

    // Create a Core Image version of the image.

    let sourceCore = ciImage

    let resultCore = CIFilter(name: "CIHueAdjust",

                              withInputParameters: [kCIInputImageKey: sourceCore,

                                                    kCIInputAngleKey: deltaHueRadians])?.outputImage?

        .cropped(to: sourceCore.extent)

    // Convert the filter output back into a UIImage.

    let context = CIContext(options: nil)

    //        let resultRef = context.createCGImage((vignette?.outputImage)!, from: (vignette?.outputImage!.extent)!)

    let resultRef = context.createCGImage(resultCore!, from: (resultCore!.extent))

    var result:UIImage? = nil

    if(orientation != nil){

    result = UIImage(cgImage: resultRef!, scale: 1.0, orientation: orientation!)

   }else{

        result = UIImage(cgImage: resultRef!)

    }        

    return result!

}
...