var gdjs;(function(o){const f=new o.Logger("Filters");let m;(function(n){n.clampValue=function(r,e,t){return Math.max(e,Math.min(t,r))},n.clampKernelSize=function(r,e,t){const a=Math.round((t-e)/2+1),s=new Array(a);for(let l=0;l<a;l++)s[l]=e+2*l;return s.indexOf(r)!==-1?r:e};const i={};n.getFilterCreator=function(r){return i.hasOwnProperty(r)?i[r]:null},n.registerFilterCreator=function(r,e){i.hasOwnProperty(r)&&f.warn('Filter "'+r+'" was already registered in gdjs.PixiFiltersTools. Replacing it with the new one.'),i[r]=e};class b{makeFilter(e,t){const a=this.makePIXIFilter(e,t);return e.isLightingLayer&&e.isLightingLayer()&&(a.blendMode=PIXI.BLEND_MODES.ADD),new u(a,this)}}n.PixiFilterCreator=b;class u{constructor(e,t){this.pixiFilter=e,this.filterCreator=t}isEnabled(e){return this.pixiFilter.enabled}setEnabled(e,t){return this.pixiFilter.enabled=t}applyEffect(e){const t=e.getRendererObject();return t?(t.filters=(t.filters||[]).concat(this.pixiFilter),!0):!1}removeEffect(e){const t=e.getRendererObject();return t?(t.filters=(t.filters||[]).filter(a=>a!==this.pixiFilter),!0):!1}updatePreRender(e){this.filterCreator.updatePreRender(this.pixiFilter,e)}updateDoubleParameter(e,t){this.filterCreator.updateDoubleParameter(this.pixiFilter,e,t)}updateStringParameter(e,t){this.filterCreator.updateStringParameter(this.pixiFilter,e,t)}updateBooleanParameter(e,t){this.filterCreator.updateBooleanParameter(this.pixiFilter,e,t)}updateColorParameter(e,t){this.filterCreator.updateColorParameter(this.pixiFilter,e,t)}getDoubleParameter(e){return this.filterCreator.getDoubleParameter(this.pixiFilter,e)}getColorParameter(e){return this.filterCreator.getColorParameter(this.pixiFilter,e)}getNetworkSyncData(){return{ena:this.pixiFilter.enabled,fc:this.filterCreator.getNetworkSyncData(this.pixiFilter)}}updateFromNetworkSyncData(e){this.pixiFilter.enabled=e.ena,this.filterCreator.updateFromNetworkSyncData(this.pixiFilter,e.fc)}}n.PixiFilter=u;class F{isEnabled(e){return!1}setEnabled(e,t){return!1}applyEffect(e){return!1}removeEffect(e){return!1}updatePreRender(e){}updateDoubleParameter(e,t){}updateStringParameter(e,t){}updateBooleanParameter(e,t){}updateColorParameter(e,t){}getDoubleParameter(e){return 0}getColorParameter(e){return 0}getNetworkSyncData(){return{}}updateFromNetworkSyncData(e){}}n.EmptyFilter=F})(m=o.PixiFiltersTools||(o.PixiFiltersTools={}))})(gdjs||(gdjs={}));
//# sourceMappingURL=pixi-filters-tools.js.map
