|
1 |
| -import { Color, Filter, GlProgram, GpuProgram } from 'pixi.js'; |
| 1 | +import { Color, deprecation, Filter, GlProgram, GpuProgram } from 'pixi.js'; |
2 | 2 | import { vertex, wgslVertex } from '../defaults';
|
3 | 3 | import fragment from './outline.frag';
|
4 | 4 | import source from './outline.wgsl';
|
@@ -77,8 +77,35 @@ export class OutlineFilter extends Filter
|
77 | 77 | private _quality!: number;
|
78 | 78 | private _color!: Color;
|
79 | 79 |
|
80 |
| - constructor(options?: OutlineFilterOptions) |
| 80 | + constructor(options?: OutlineFilterOptions); |
| 81 | + /** |
| 82 | + * @deprecated since 6.0.0 |
| 83 | + * |
| 84 | + * @param {number} [thickness=1] - The tickness of the outline. Make it 2 times more for resolution 2 |
| 85 | + * @param {number} [color=0x000000] - The color of the outline. |
| 86 | + * @param {number} [quality=0.1] - The quality of the outline from `0` to `1`, using a higher quality |
| 87 | + * setting will result in slower performance and more accuracy. |
| 88 | + * @param {number} [alpha=1.0] - The alpha of the outline. |
| 89 | + * @param {boolean} [knockout=false] - Only render outline, not the contents. |
| 90 | + */ |
| 91 | + constructor(thickness?: number, color?: number, quality?: number, alpha?: number, knockout?: boolean); |
| 92 | + constructor(...args: [OutlineFilterOptions?] | [number?, number?, number?, number?, boolean?]) |
81 | 93 | {
|
| 94 | + let options = args[0] ?? {}; |
| 95 | + |
| 96 | + if (typeof options === 'number') |
| 97 | + { |
| 98 | + // eslint-disable-next-line max-len |
| 99 | + deprecation('6.0.0', 'OutlineFilter constructor params are now options object. See params: { thickness, color, quality, alpha, knockout }'); |
| 100 | + |
| 101 | + options = { thickness: options }; |
| 102 | + |
| 103 | + if (args[1] !== undefined) options.color = args[1]; |
| 104 | + if (args[2] !== undefined) options.quality = args[2]; |
| 105 | + if (args[3] !== undefined) options.alpha = args[3]; |
| 106 | + if (args[4] !== undefined) options.knockout = args[4]; |
| 107 | + } |
| 108 | + |
82 | 109 | options = { ...OutlineFilter.DEFAULT_OPTIONS, ...options };
|
83 | 110 |
|
84 | 111 | const quality = options.quality ?? 0.1;
|
|
0 commit comments