/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{uniform as s,UniformGroup as e}from"../../../../GraphShaderModule.js";import{Float as r,cond as o,greaterThan as i,equal as d,sign as n,Vec3 as p,Vec4 as a}from"../../../../graph/glsl.js";import{BaseRasterProcessorShader as l}from"./BaseRasterProcessorShader.js";import{roundOutput as m}from"./math.js";class f extends e{}t([s(r)],f.prototype,"contrastOffset",void 0),t([s(r)],f.prototype,"brightnessOffset",void 0);class h extends l{constructor(){super(...arguments),this.type="ContrastBrightnessShader"}_process(t){const{rgb:s,a:e}=this._getPixel(t),{contrastOffset:l,brightnessOffset:f}=this.contrastBrightnessConfig,h=new r(255),c=new r(128),u=s.multiply(200),g=h.multiply(100),y=h.multiply(2).multiply(f),w=u.subtract(g).add(y),b=o([d(l,new r(-100)),new p(c)],[d(l,new r(100)),n(w).add(1).divide(2).multiply(h)],[i(l,new r(0)),w.divide(new r(100).subtract(l).multiply(2)).add(c)],[!0,w.multiply(l.add(100)).divide(2e4).add(c)]);return m(new a(b,e))}}t([s(f)],h.prototype,"contrastBrightnessConfig",void 0);export{h as ContrastBrightnessShader};
