UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.67 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as t}from"tslib";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import e from"./BaseRasterFunction.js";import o from"./ContrastBrightnessFunctionArguments.js";import{lookupPixels as n}from"./pixelUtils.js";import{createContrastBrightnessLUT as i}from"./stretchUtils.js";let u=class extends e{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,s=t[0];if("u8"!==s.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const r=s.clone();this._removeStatsHistColormapVAT(r),this.rasterInfo=r;const{contrastOffset:e,brightnessOffset:o}=this.functionArguments;return this.lookup=i(e,o),{success:!0,supportsGPU:!0}}_processPixels(t){const s=t.pixelBlocks?.[0];return null==s?null:n(s,{lut:s.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:s}=this.functionArguments;return{contrastOffset:t,brightnessOffset:s}}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],u.prototype,"lookup",void 0),u=t([r("esri.layers.raster.functions.ContrastBrightnessFunction")],u);const p=u;export{p as default};