var gdjs;(function(n){const f=new n.Logger("Filters"),c=GlobalPIXIModule.PIXI;let p;(function(i){i.clampValue=function(r,e,t){return Math.max(e,Math.min(t,r))},i.clampKernelSize=function(r,e,t){const a=Math.round((t-e)/2+1),s=new Array(a);for(let o=0;o<a;o++)s[o]=e+2*o;return s.indexOf(r)!==-1?r:e};const l={};i.getFilterCreator=function(r){return l.hasOwnProperty(r)?l[r]:null},i.registerFilterCreator=function(r,e){l.hasOwnProperty(r)&&f.warn('Filter "'+r+'" was already registered in gdjs.PixiFiltersTools. Replacing it with the new one.'),l[r]=e},i.rgbOrHexToHexNumber=function(r){const e=r.split(";");return e.length===3?n.rgbToHexNumber(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)):parseInt(r.replace("#","0x"),16)};class P{makeFilter(e,t){const a=this.makePIXIFilter(e,t);return e.isLightingLayer&&e.isLightingLayer()&&(a.blendMode=c.BLEND_MODES.ADD),new g(a,this)}}i.PixiFilterCreator=P;class g{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)}}i.PixiFilter=g})(p=n.PixiFiltersTools||(n.PixiFiltersTools={}))})(gdjs||(gdjs={}));
//# sourceMappingURL=pixi-filters-tools.js.map
