remove TileLayer.Grayscale.js
This commit is contained in:
parent
2492d44c70
commit
26adc34322
56
www/external/TileLayer.Grayscale.js
vendored
56
www/external/TileLayer.Grayscale.js
vendored
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* L.TileLayer.Grayscale is a regular tilelayer with grayscale makeover.
|
||||
*/
|
||||
|
||||
L.TileLayer.Grayscale = L.TileLayer.extend({
|
||||
options: {
|
||||
quotaRed: 21,
|
||||
quotaGreen: 71,
|
||||
quotaBlue: 8,
|
||||
quotaDividerTune: 0,
|
||||
quotaDivider: function() {
|
||||
return this.quotaRed + this.quotaGreen + this.quotaBlue + this.quotaDividerTune;
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function (url, options) {
|
||||
options = options || {}
|
||||
options.crossOrigin = true;
|
||||
L.TileLayer.prototype.initialize.call(this, url, options);
|
||||
|
||||
this.on('tileload', function(e) {
|
||||
this._makeGrayscale(e.tile);
|
||||
});
|
||||
},
|
||||
|
||||
_createTile: function () {
|
||||
var tile = L.TileLayer.prototype._createTile.call(this);
|
||||
tile.crossOrigin = "Anonymous";
|
||||
return tile;
|
||||
},
|
||||
|
||||
_makeGrayscale: function (img) {
|
||||
if (img.getAttribute('data-grayscaled'))
|
||||
return;
|
||||
|
||||
img.crossOrigin = '';
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0);
|
||||
|
||||
var imgd = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
var pix = imgd.data;
|
||||
for (var i = 0, n = pix.length; i < n; i += 4) {
|
||||
pix[i] = pix[i + 1] = pix[i + 2] = (this.options.quotaRed * pix[i] + this.options.quotaGreen * pix[i + 1] + this.options.quotaBlue * pix[i + 2]) / this.options.quotaDivider();
|
||||
}
|
||||
ctx.putImageData(imgd, 0, 0);
|
||||
img.setAttribute('data-grayscaled', true);
|
||||
img.src = canvas.toDataURL();
|
||||
}
|
||||
});
|
||||
|
||||
L.tileLayer.grayscale = function (url, options) {
|
||||
return new L.TileLayer.Grayscale(url, options);
|
||||
};
|
@ -33,7 +33,6 @@
|
||||
|
||||
<!-- Leaflet -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin="anonymous"></script>
|
||||
<!-- <script type="text/javascript" src="external/TileLayer.Grayscale.js"></script> --> <! version of 2017-11-01 downloaded 2020-07-15 -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-dvf/0.3.1/leaflet-dvf.markers.min.js" integrity="sha512-R/iucaxFnDFUTdZRxUvxzc+sypDQhqnxInBmNjgGE0RaiMl/ektVB1wFS/L0xDZmLFPpEGR0Kw3GEBgtQNFHyg==" crossorigin="anonymous"></script>
|
||||
<script src="external/leaflet-providers.js"></script>
|
||||
<script src="external/jQuery.print.min.js"></script>
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
<!-- Leaflet -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin="anonymous"></script>
|
||||
<!-- <script type="text/javascript" src="external/TileLayer.Grayscale.js"></script> --> <! version of 2017-11-01 downloaded 2020-07-15 -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-dvf/0.3.1/leaflet-dvf.markers.min.js" integrity="sha512-R/iucaxFnDFUTdZRxUvxzc+sypDQhqnxInBmNjgGE0RaiMl/ektVB1wFS/L0xDZmLFPpEGR0Kw3GEBgtQNFHyg==" crossorigin="anonymous"></script>
|
||||
<script src="external/leaflet-providers.js"></script>
|
||||
<script src="external/jQuery.print.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user