Contents

shadedMaterial()

Creates a shaded image from a height-field image.

Declaration

class func shadedMaterial() -> any CIFilter & CIShadedMaterial

Return 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:

inputImage

An image with the type CIImage.

shadingImage

An image representing the color shading effect with type CIImage.

scale

A float representing 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]

See Also

Filters