shadedMaterial()
Creates a shaded image from a height-field image.
Declaration
class func shadedMaterial() -> any CIFilter & CIShadedMaterialReturn Value
The modified image.
Discussion
This method applies the shaded material filter to an image. The effect produces a shaded image from a height-field image. Areas of the height field image that have a darker shaded area produce a stronger effect. You can combine the filter with CIHeightFieldFromMask to produce quick shadings of masks, such as text.
The shaded material filter uses the following properties:
inputImageAn image with the type CIImage.
shadingImageAn image representing the color shading effect with type CIImage.
scaleA
floatrepresenting the strength of effect as an NSNumber.
The following code creates a filter that results in an image containing glossy text by applying the shading image.
func shadowMaterial(inputImage: CIImage, shadeImage: CIImage) -> CIImage {
let shadowMaterialFilter = CIFilter.shadedMaterial()
shadowMaterialFilter.inputImage = inputImage
shadowMaterialFilter.shadingImage = shadeImage
shadowMaterialFilter.scale = 10
return shadowMaterialFilter.outputImage!
}[Image]