Inherits from SPFragmentFilter : NSObject
Declared in SPDisplacementMapFilter.h

Overview

The SPDisplacementMapFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object. You can use this filter to apply a warped or mottled effect to any object that inherits from the DisplayObject class.

The filter uses the following formula:

 dstPixel[x, y] = srcPixel[x + ((componentX(x, y) - 128) * scaleX) / 256,
                           y + ((componentY(x, y) - 128) * scaleY) / 256]

Tasks

Initialization

Properties

  •   componentX

    Describes which color channel to use in the map image to displace the x result.

    property
  •   componentY

    Describes which color channel to use in the map image to displace the y result.

    property
  •   scaleX

    The multiplier used to scale the x displacement result from the map calculation.

    property
  •   scaleY

    The multiplier used to scale the y displacement result from the map calculation.

    property
  •   mapTexture

    The texture that will be used to calculate displacement.

    property
  •   mapPoint

    A value that contains the offset of the upper-left corner of the target display object from the upper-left corner of the map image.

    property
  •   repeat

    Indicates how the pixels at the edge of the input image (the filtered object) will be wrapped at the edge.

    property

Properties

componentX

Describes which color channel to use in the map image to displace the x result.

@property (nonatomic, assign) SPColorChannel componentX

Discussion

Describes which color channel to use in the map image to displace the x result.

Declared In

SPDisplacementMapFilter.h

componentY

Describes which color channel to use in the map image to displace the y result.

@property (nonatomic, assign) SPColorChannel componentY

Discussion

Describes which color channel to use in the map image to displace the y result.

Declared In

SPDisplacementMapFilter.h

mapPoint

A value that contains the offset of the upper-left corner of the target display object from the upper-left corner of the map image.

@property (nonatomic, copy) SPPoint *mapPoint

Discussion

A value that contains the offset of the upper-left corner of the target display object from the upper-left corner of the map image.

Declared In

SPDisplacementMapFilter.h

mapTexture

The texture that will be used to calculate displacement.

@property (nonatomic, retain) SPTexture *mapTexture

Discussion

The texture that will be used to calculate displacement.

Declared In

SPDisplacementMapFilter.h

repeat

Indicates how the pixels at the edge of the input image (the filtered object) will be wrapped at the edge.

@property (nonatomic, assign) BOOL repeat

Discussion

Indicates how the pixels at the edge of the input image (the filtered object) will be wrapped at the edge.

Declared In

SPDisplacementMapFilter.h

scaleX

The multiplier used to scale the x displacement result from the map calculation.

@property (nonatomic, assign) float scaleX

Discussion

The multiplier used to scale the x displacement result from the map calculation.

Declared In

SPDisplacementMapFilter.h

scaleY

The multiplier used to scale the y displacement result from the map calculation.

@property (nonatomic, assign) float scaleY

Discussion

The multiplier used to scale the y displacement result from the map calculation.

Declared In

SPDisplacementMapFilter.h

Class Methods

displacementMapFilterWithMapTexture:

Factory method.

+ (instancetype)displacementMapFilterWithMapTexture:(SPTexture *)texture

Discussion

Factory method.

Declared In

SPDisplacementMapFilter.h

Instance Methods

initWithMapTexture:

Intializes the displacement map filter with the specified map texture.

- (instancetype)initWithMapTexture:(SPTexture *)mapTexture

Discussion

Intializes the displacement map filter with the specified map texture.

Declared In

SPDisplacementMapFilter.h