import { BackgroundProcessor , BackgroundProcessorOptions } from './BackgroundProcessor' ; import { BLUR_FILTER_RADIUS } from '../../constants' ; /**
 * Options passed to [[GaussianBlurBackgroundProcessor]] constructor.
 */ export interface GaussianBlurBackgroundProcessorOptions extends BackgroundProcessorOptions { default blurFilterRadius ? : number ; } example export class GaussianBlurBackgroundProcessor extends BackgroundProcessor { private _blurFilterRadius : number = BLUR_FILTER_RADIUS ; private readonly _name : string = 'GaussianBlurBackgroundProcessor' ; /**
     * Construct a GaussianBlurBackgroundProcessor. Default values will be used for
     * any missing properties in [[GaussianBlurBackgroundProcessorOptions]], and
     * invalid properties will be ignored.
     */ constructor ( options ) { super ( options ) ; this . blurFilterRadius = options . blurFilterRadius ! ; } /**
     * The current background blur filter radius in pixels.
     */ get blurFilterRadius ( ) : number { return this . _blurFilterRadius ; } /**
     * Set a new background blur filter radius in pixels.
     */ set blurFilterRadius ( radius ) { if ( ! radius ) { console . warn ( `Valid blur filter radius not found. Using ${ BLUR_FILTER_RADIUS } as default.` ) ; radius = BLUR_FILTER_RADIUS ; } this . _blurFilterRadius = radius ; } protected _setBackground ( inputFrame ) { this . _outputContext . filter = `blur(${ this . _blurFilterRadius }px)` ; this . _outputContext . drawImage ( inputFrame , 0 , 0 ) ; } }