/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../VertexStream","../../../../../webgl/enums","../../../../../webgl/Texture"],(function(e,t,r,i){"use strict";let s=function(){function e(){this._size=[0,0],this._programDesc={vsPath:"post-processing/pp",fsPath:"post-processing/filterEffect",attributes:new Map([["a_position",0]])}}var s=e.prototype;return s.dispose=function(){this._layerFBOTexture&&(this._layerFBOTexture.dispose(),this._layerFBOTexture=null)},s.draw=function(e,t,i){const{width:s,height:n}=t;this._createOrResizeResources(e,s,n);const{context:o,painter:a}=e,{materialManager:l}=a,u=this._programDesc,c=this._quad,d=i.colorMatrix;c.bind();const _=this._layerFBOTexture;o.bindFramebuffer(t),t.copyToTexture(0,0,s,n,0,0,_),o.setBlendingEnabled(!1),o.setStencilTestEnabled(!1);const p=l.getProgram(u);o.useProgram(p),o.bindTexture(_,2),p.setUniformMatrix4fv("u_coefficients",d),p.setUniform1i("u_colorTexture",2),c.draw(),o.setBlendingEnabled(!0),o.setBlendFunction(r.BlendFactor.ONE,r.BlendFactor.ONE_MINUS_SRC_ALPHA),o.setStencilTestEnabled(!0),c.unbind()},s._createOrResizeResources=function(e,s,n){const{context:o}=e;this._layerFBOTexture&&this._size[0]===s&&this._size[1]===n||(this._size[0]=s,this._size[1]=n,this._layerFBOTexture?this._layerFBOTexture.resize(s,n):this._layerFBOTexture=new i.Texture(o,{target:r.TextureType.TEXTURE_2D,pixelFormat:r.PixelFormat.RGBA,internalFormat:r.PixelFormat.RGBA,dataType:r.PixelType.UNSIGNED_BYTE,wrapMode:r.TextureWrapMode.CLAMP_TO_EDGE,samplingMode:r.TextureSamplingMode.LINEAR,flipped:!1,width:s,height:n}),this._quad||(this._quad=new t(o,[-1,-1,1,-1,-1,1,1,1])))},e}();e.Colorize=s,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
