You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
4.4 KiB
12 lines
4.4 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("../../chunks/tslib.es6 ../../core/has ../../core/imageUtils ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/accessorSupport/ensureType ../../core/RandomLCG ../../core/accessorSupport/decorators/reader ../../core/accessorSupport/decorators/subclass ../../core/accessorSupport/decorators/writer ../../chunks/persistableUrlUtils".split(" "),function(e,d,q,r,g,t,y,u,v,w,k){function m(a){let b="";for(let c=0;c<a.data.length;c++)b+=String.fromCharCode(a.data[c]);return{data:btoa(b), |
|
width:a.width,height:a.height}}function n(a){const b=atob(a.data),c=new Uint8ClampedArray(b.length);for(let f=0;f<b.length;f++)c[f]=b.charCodeAt(f);return q.wrapImageData(c,a.width,a.height)}function p(a){for(let b=3;b<a.data.length;b+=4)if(255!==a.data[b])return!0;return!1}var h;const l=new WeakMap;let x=0;d=h=class extends r.JSONSupport{constructor(a){super(a);this.wrap="repeat"}get url(){return this._get("url")||null}set url(a){this._set("url",a);a&&this._set("data",null)}get data(){return this._get("data")|| |
|
null}set data(a){this._set("data",a);a&&this._set("url",null)}writeData(a,b,c,f){a instanceof HTMLImageElement?(a={type:"image-element",src:k.toJSON(a.src,f),crossOrigin:a.crossOrigin},b[c]=a):a instanceof HTMLCanvasElement?(a=a.getContext("2d").getImageData(0,0,a.width,a.height),a={type:"canvas-element",imageData:m(a)},b[c]=a):a instanceof HTMLVideoElement?(a={type:"video-element",src:k.toJSON(a.src,f),autoplay:a.autoplay,loop:a.loop,muted:a.muted,crossOrigin:a.crossOrigin,preload:a.preload},b[c]= |
|
a):a instanceof ImageData&&(a={type:"image-data",imageData:m(a)},b[c]=a)}readData(a){switch(a.type){case "image-element":var b=new Image;b.src=a.src;b.crossOrigin=a.crossOrigin;return b;case "canvas-element":return a=n(a.imageData),b=document.createElement("canvas"),b.width=a.width,b.height=a.height,b.getContext("2d").putImageData(a,0,0),b;case "image-data":return n(a.imageData);case "video-element":return b=document.createElement("video"),b.src=a.src,b.crossOrigin=a.crossOrigin,b.autoplay=a.autoplay, |
|
b.loop=a.loop,b.muted=a.muted,b.preload=a.preload,b}}get transparent(){var a=this.data,b=this.url;return a instanceof HTMLCanvasElement?p(a.getContext("2d").getImageData(0,0,a.width,a.height)):a instanceof ImageData?p(a):b&&(a=b.substr(b.length-4,4).toLowerCase(),b=b.substr(0,15).toLocaleLowerCase(),".png"===a||"data:image/png;"===b)?!0:!1}set transparent(a){this._overrideIfSome("transparent",a)}get contentHash(){const a="string"===typeof this.wrap?this.wrap:"object"===typeof this.wrap?`${this.wrap.horizontal}/${this.wrap.vertical}`: |
|
"",b=(c="")=>`d:${c},t:${this.transparent},w:${a}`;if(null!=this.url)return b(this.url);if(null!=this.data){if(this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement)return b(this.data.src);l.has(this.data)||l.set(this.data,++x);return b(l.get(this.data))}return b()}get memoryUsage(){let a;a=0+(null!=this.url?this.url.length:0);if(null!=this.data){const b=this.data;"data"in b?a+=b.data.byteLength:b instanceof HTMLImageElement?a+=b.naturalWidth*b.naturalHeight*3:b instanceof HTMLCanvasElement&& |
|
(a+=b.width*b.height*3)}return a}clone(){const a={url:this.url,data:this.data,wrap:this._cloneWrap()};return new h(a)}cloneWithDeduplication(a){var b=a.get(this);if(b)return b;b=this.clone();a.set(this,b);return b}_cloneWrap(){return"string"===typeof this.wrap?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}static from(a){return"string"===typeof a?new h({url:a}):a instanceof HTMLImageElement||a instanceof HTMLCanvasElement||a instanceof ImageData||a instanceof HTMLVideoElement? |
|
new h({data:a}):t.ensureClass(h,a)}};e.__decorate([g.property({type:String,json:{write:k.write}})],d.prototype,"url",null);e.__decorate([g.property({json:{write:{overridePolicy(){return{enabled:!this.url}}}}}),g.property()],d.prototype,"data",null);e.__decorate([w.writer("data")],d.prototype,"writeData",null);e.__decorate([u.reader("data")],d.prototype,"readData",null);e.__decorate([g.property({type:Boolean,json:{write:{overridePolicy(){return{enabled:this._isOverridden("transparent")}}}}})],d.prototype, |
|
"transparent",null);e.__decorate([g.property({json:{write:!0}})],d.prototype,"wrap",void 0);e.__decorate([g.property({readOnly:!0})],d.prototype,"contentHash",null);return d=h=e.__decorate([v.subclass("esri.geometry.support.MeshTexture")],d)}); |