/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{C as t}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as i}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as e}from"../../shaders/CompositingTechniqueConfiguration.js";class r{constructor(r,s=0){this._techniques=r,this._parameters=new t,this._configuration=new e,this._configuration.blitMode=s,r.precompile(i,this._configuration),this._configuration.hasOpacityFactor=!0,r.precompile(i,this._configuration),this._configuration.hasOpacityFactor=!1}blit(t,i,e,r){this.blitTexture(t,i.getTexture(),e,r)}blitTexture(t,e,r,s){t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,1),t.clear(16384),this._parameters.texture=e;const o=this._techniques.get(i,this._configuration);t.bindTechnique(o,s,this._parameters),t.screen.draw()}blend(t,e,r,s,o=1){this._configuration.hasOpacityFactor=o<1;const n=this._techniques.get(i,this._configuration);return!!n.compiled&&(t.bindFramebuffer(r.fbo),this._parameters.texture=e.getTexture(),this._parameters.opacity=o,t.bindTechnique(n,s,this._parameters),t.screen.draw(),!0)}}export{r as Blit};
