Resample Filter API
Resample filter uses weighting functions for calculating pixel color weights, depending on distance from EWA ellipse center in EWA resampling.
ResampleFilter interface
interface ResampleFilter {
getWorkingSupport(): number;
getWeight(x: number): number;
}
Methods
getWorkingSupport()
- Returns:
number
Returns filter practical working support.
getWeight()
- Param:
x: number
- Returns:
number
Returns color weight at given distance from EWA ellipse center.
Type guard
isResampleFilter
function checks if given argument is ResampleFilter
and can be used as type guard.
ResampleFilterPreset interface
ResampleFilterPreset
interface is object with predefined resample filter settings.
interface ResampleFilterPreset {
filterFunctionFactory: WeightingFunctionName | string;
filterFunctionFactoryArgs: number[];
windowFunctionFactory: WeightingFunctionName | string;
windowFunctionFactoryArgs: number[];
support: number;
scale: number;
blur?: number;
windowSupport?: number;
}
Properties
filterFunctionFactory
- Type:
WeightingFunctionFactoryName | string
Name of weighting function factory. Internally, factory will be supplied by filterFunctionFactoryArgs
to produce filter function, which is responsible for pixel color weights inside EWA ellipse.
filterFunctionFactoryArgs
- Type:
number[]
Array of arguments, which will be passed to corresponding WeightingFunctionFactory.
windowFunctionFactory
- Type:
WeightingFunctionFactoryName | string
Name of weighting function factory. Internally, factory will be supplied by filterFunctionFactoryArgs
to produce window function, which is responsible for modulation of filter function.
windowFunctionFactoryArgs
- Type:
number[]
Array of arguments, which will be passed to corresponding WeightingFunctionFactory.
support
- Type:
number
Filter support value.
scale
- Type:
number
Filter scale value.
blur
- Type:
number
Optional filter blur value. Defaults to 1
.
windowSupport
- Type:
number
Optional filter window support value. By default, equals filter support.
Type guard
isResampleFilterPreset
checks if given argument is ResampleFilterPreset
and can be used as type guard.
ResampleFilterPresetsPool interface
Pool of built-in filter presets. Keys are FilterName enum values.
interface ResampleFilterPresetsPoolKeyMap {
[FilterName.ROBIDOUX]: ResampleFilterPreset;
[FilterName.ROBIDOUX_SHARP]: ResampleFilterPreset;
[FilterName.BOX]: ResampleFilterPreset;
[key: FilterName | string]: ResampleFilterPreset;
}
type ResampleFilterPresetsPool = Pool<
ResampleFilterPreset,
ResampleFilterPresetsPoolKeyMap
>;