Contents

meshGenerator()

Generates a pattern made from an array of line segments.

Declaration

class func meshGenerator() -> any CIFilter & CIMeshGenerator

Return Value

The generated image.

Discussion

This method generates a mesh generator image. The effect uses an array of line segments to create the resulting image.

The mesh generator filter uses the following properties:

inputMesh

An array of line segments stored as an array of CIVector, each containing a start point and end point.

color

A CIColor representing the color used to make the mesh.

width

A float representing the width of the line segments as an NSNumber

The following code creates a filter that generates a green star made from mesh segments:

func mesh(mesh: NSdata) -> CIImage {
    let meshGenerator = CIFilter.meshGenerator()
    meshGenerator.color = CIColor.green
    meshGenerator.width = 3
    meshGenerator.inputmesh = mesh
    return meshGenerator.outputImage!
}

[Image]

See Also

Filters