PokéRogue
    Preparing search index...

    The GradientMap Filter Controller.

    This controller manages the GradientMap effect for a Camera.

    GradientMap recolors an image using a ColorRamp. The image is converted to a progress value at each point, and that progress is evaluated as a color along the ramp.

    The progress value is normally the brightness of the image. You can use the colorFactor and color properties to customize it.

    Hierarchy (View Summary)

    Index
    active: boolean

    Toggle this boolean to enable or disable this filter, without removing it from and re-adding it to the Camera's filter list.

    allowBaseDraw: boolean

    If true, this filter will be permitted to draw to the base texture. This can be unwanted if, for example, the filter doesn't actually draw anything.

    This is an internal flag used by the renderer. You should not modify this value directly.

    alpha: number

    The blend strength of the gradient map effect over the original image, in the range 0 (no effect, original image fully visible) to 1 (full gradient map effect, original image fully replaced).

    camera: Camera

    A reference to the Camera that owns this filter.

    color: number[]

    RGBA offset values added directly to the ramp progress after colorFactor has been applied. Each element corresponds to a channel: red, green, blue, and alpha. For example, setting a channel to 1 when its corresponding colorFactor entry is -1 effectively inverts that channel's contribution to the progress value.

    colorFactor: number[]

    RGBA multipliers applied to each channel of the source image to compute the ramp progress value. The results are summed together. The defaults [ 0.3, 0.6, 0.1, 0 ] approximate standard luminance weights, producing a perceptually accurate grayscale progress. Keep the sum of factors equal to 1 for a normalized result, or use negative values (paired with color offsets) to invert a channel's contribution.

    currentPadding: Rectangle

    The padding currently being used by this filter. This is read during rendering via getPadding, and may be updated by subclass implementations. It is necessary for filters being used in an external list. You should not modify this value directly.

    dither: boolean

    Whether to use Interleaved Gradient Noise to dither the ramp. This can reduce banding, but the effect is easily lost if the image is later transformed.

    ignoreDestroy: boolean

    Whether this filter controller will be destroyed when the FilterList that owns it is destroyed. If you enable this, you must ensure that you clean up the filter controller at an appropriate time. This allows you to reuse a controller for multiple objects; this is not recommended unless you know what you're doing. It tends to work best with external filters.

    paddingOverride: Rectangle

    Padding override. This is on by default. If this is set, the filter will use this padding instead of calculating it. Prefer using setPaddingOverride instead of modifying this directly.

    ramp: ColorRamp

    The ColorRamp used to recolor the image. Each pixel's brightness (or custom progress value derived from colorFactor and color) is looked up along this ramp to determine its output color.

    renderNode: string

    The ID of the RenderNode that this filter uses.

    unpremultiply: boolean

    Whether the input should be unpremultiplied before computing progress. This means that transparent colors are considered at full brightness. It is usually desirable.

    • Destroys this Controller and nulls any references it holds.

      Returns void

    • Returns the raw padding required for this filter. This is typically not what you want to call; use getPaddingCeil instead. Values from this method are not rounded, which can cause quality loss.

      Override this method when creating a Filter that requires extra room, e.g. a blur or glow effect.undefined

      Returns Rectangle

      The padding required by this filter.

    • Returns the rounded padding required for this filter.

      Most filters don't need extra padding, but some may sample beyond the texture boundaries, such as a blur or glow effect.

      The bounds are encoded as a Rectangle. To enlarge the bounds, the top and left values should be negative, and the bottom and right values should be positive.

      This method calls getPadding() to get the raw padding values, and uses Math.ceil() to set the values of paddingOverride and currentPadding.undefined

      Returns Rectangle

      The rounded padding required by this filter.

    • Sets the active state of this filter.

      A disabled filter will not be used.

      Parameters

      • value: boolean

        true to enable this filter, or false to disable it.

      Returns this

      This filter instance.

    • Sets the padding override. If this is set, the filter will use this padding instead of calculating it. Call setPaddingOverride(null) to clear the override. Call setPaddingOverride() to set the padding to 0.

      Parameters

      • Optionalleft: number | null

        The left padding. Default 0.

      • Optionaltop: number

        The top padding. Default 0.

      • Optionalright: number

        The right padding. Default 0.

      • Optionalbottom: number

        The bottom padding. Default 0.

      Returns void