heightFieldFromMask()
Creates a realistic shaded height-field image.
Declaration
class func heightFieldFromMask() -> any CIFilter & CIHeightFieldFromMaskReturn Value
The modified image.
Discussion
This method applies the height-field from the mask filter to an image. The effect targets the white in the input image and creates realistic shading.
The height field from mask filter uses the following properties:
inputImageAn image with the type CIImage.
radiusA
floatrepresenting the area of effect as an NSNumber.
The following code creates a filter that results in the text having a shading effect:
func heightFieldFromMask(inputImage: CIImage) -> CIImage {
let heightFieldFromMaskFilter = CIFilter.heightFieldFromMask()
heightFieldFromMaskFilter.inputImage = inputImage
heightFieldFromMaskFilter.radius = 3
return heightFieldFromMaskFilter.outputImage!
}[Image]