A ColorMatrix filer that applies color correction depending on the masked area.

Uses masked objects red*alpha channels to determine the transition from original color and transformed color.

Hacking: Through accessing color matrix shader directly via @:privateAccess ambient.pass.shader.maskChannel it's possible to modify which channels affect the resulting transition value.

See also:

Constructor

new(mask:Object, ?m:Matrix)

Create new Ambient filter.

Parameters:

mask

An Object that will be used for masking. See AbstractMask.mask for limitations.

m

The color matrix that is applied to the area dictated by Ambient.invert.

Variables

invert:Bool

Whether to apply ambient color correction inside masked (when enabled) area or outside of it (when disabled).

power:Float

The exponent of the mask color values that affects transition speed.

Methods

Inherited Variables

Defined by AbstractMask

mask:Object

The Object contents of which serve as a mask to the filtered Object.

Masking Objects have following limitations: It cannot be a parent of the filtered Object. It should not contain any filters. It should be present in the object tree and precede the Object it masks in the rendering order (rendered before it). Same masking Object cannot be used by multiple mask filters.

maskVisible:Bool

When enabled, masking Object will be visible to the user. Hidden otherwise. ( default : false )

Defined by Filter

@:value(true)autoBounds:Bool = true

When enabled, rendering bounds of the filter will be expanded by Filter.boundsExtend in all directions. Otherwise filter should provide custom bounds through Filter.getBounds call. Default : true.

@:value(0.)boundsExtend:Float = 0.

Rendering texture boundaries extent. Increases the rendering area by twice the Filter.boundsExtend value. Automatically applied to object bounds when autoBounds = true or Filter.getBounds is not overridden. Does not affect boundaries when autoBounds = true and boundsExtend is less than 0.

@:value(true)@:isVarenable:Bool = true

When filter is disabled, attached object will render as usual.

@:value(1)resolutionScale:Float = 1

Custom rendering resolution scaling of the filter.

Stacks with additional scaling from Filter.useResolutionScaling if enabled.

@:value(false)smooth:Bool = false

When enabled, filters on not Object which are not Drawable will use bilinear filtering when displayed and some filter will also use bilinear filtering on intermediate textures.

@:value(defaultUseScreenResolution)useScreenResolution:Bool = defaultUseScreenResolution

Use the screen resolution to upscale/downscale the filter rendering resolution.

Stacks with additional scaling from Filter.resolutionScale if enabled.

Inherited Methods

Defined by AbstractMask

Defined by Filter

getBounds(s:Object, bounds:Bounds, scale:Point):Void

Method should populate bounds with rendering boundaries of the Filter for Object s. Initial bounds contents are undefined and it's recommended to either clear them or call s.getBounds(s, bounds). Only used when Filter.autoBounds is false.

By default uses given Object bounds and extends them with Filter.boundsExtend. Compared to autoBounds = true, negative boundsExtend are still applied, causing rendering area to shrink.

Parameters:

s

The Object instance to which the filter is applied.

bounds

The Bounds instance which should be populated by the filter boundaries.

scale

Contains the desired rendering resolution scaling which should be accounted when constructing the bounds. Can be edited to override provided scale values.