UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.94 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./BaseRasterFunction.js";import e from"./ContrastBrightnessFunctionArguments.js";import{lookupPixels as n}from"./pixelUtils.js";import{createContrastBrightnessLUT as i}from"./stretchUtils.js";let u=class extends o{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:o,brightnessOffset:e}=this.functionArguments;return this.lookup=i(o,e),{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:e,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.support.rasterFunctions.ContrastBrightnessFunction")],u);const p=u;export{p as default};