@loaders.gl/images 3.0.13 → 3.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.es5.min.js +1 -1
- package/dist/dist.es5.min.js.map +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/image-loader.js +7 -5
- package/dist/es5/image-loader.js.map +1 -1
- package/dist/es5/image-writer.js +1 -1
- package/dist/es5/image-writer.js.map +1 -1
- package/dist/es5/index.js +10 -10
- package/dist/es5/lib/category-api/binary-image-api.js +22 -22
- package/dist/es5/lib/category-api/binary-image-api.js.map +1 -1
- package/dist/es5/lib/category-api/image-type.js +5 -7
- package/dist/es5/lib/category-api/image-type.js.map +1 -1
- package/dist/es5/lib/category-api/parsed-image-api.js +8 -4
- package/dist/es5/lib/category-api/parsed-image-api.js.map +1 -1
- package/dist/es5/lib/encoders/encode-image.js +97 -45
- package/dist/es5/lib/encoders/encode-image.js.map +1 -1
- package/dist/es5/lib/parsers/parse-image.js +66 -31
- package/dist/es5/lib/parsers/parse-image.js.map +1 -1
- package/dist/es5/lib/parsers/parse-to-image-bitmap.js +98 -26
- package/dist/es5/lib/parsers/parse-to-image-bitmap.js.map +1 -1
- package/dist/es5/lib/parsers/parse-to-image.js +93 -27
- package/dist/es5/lib/parsers/parse-to-image.js.map +1 -1
- package/dist/es5/lib/parsers/parse-to-node-image.js +4 -6
- package/dist/es5/lib/parsers/parse-to-node-image.js.map +1 -1
- package/dist/es5/lib/parsers/svg-utils.js +5 -5
- package/dist/es5/lib/parsers/svg-utils.js.map +1 -1
- package/dist/es5/lib/texture-api/async-deep-map.js +156 -27
- package/dist/es5/lib/texture-api/async-deep-map.js.map +1 -1
- package/dist/es5/lib/texture-api/deep-load.js +67 -6
- package/dist/es5/lib/texture-api/deep-load.js.map +1 -1
- package/dist/es5/lib/texture-api/generate-url.js +11 -7
- package/dist/es5/lib/texture-api/generate-url.js.map +1 -1
- package/dist/es5/lib/texture-api/load-image.js +143 -39
- package/dist/es5/lib/texture-api/load-image.js.map +1 -1
- package/dist/es5/lib/utils/globals.js +14 -9
- package/dist/es5/lib/utils/globals.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,20 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.deepLoad = deepLoad;
|
|
7
9
|
exports.shallowLoad = shallowLoad;
|
|
8
10
|
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
|
|
9
15
|
var _asyncDeepMap = require("./async-deep-map");
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
return
|
|
17
|
+
function deepLoad(_x, _x2, _x3) {
|
|
18
|
+
return _deepLoad.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _deepLoad() {
|
|
22
|
+
_deepLoad = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(urlTree, load, options) {
|
|
23
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
24
|
+
while (1) {
|
|
25
|
+
switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
_context.next = 2;
|
|
28
|
+
return (0, _asyncDeepMap.asyncDeepMap)(urlTree, function (url) {
|
|
29
|
+
return shallowLoad(url, load, options);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
case 2:
|
|
33
|
+
return _context.abrupt("return", _context.sent);
|
|
34
|
+
|
|
35
|
+
case 3:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, _callee);
|
|
41
|
+
}));
|
|
42
|
+
return _deepLoad.apply(this, arguments);
|
|
13
43
|
}
|
|
14
44
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
45
|
+
function shallowLoad(_x4, _x5, _x6) {
|
|
46
|
+
return _shallowLoad.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _shallowLoad() {
|
|
50
|
+
_shallowLoad = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(url, load, options) {
|
|
51
|
+
var response, arrayBuffer;
|
|
52
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) {
|
|
54
|
+
switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
_context2.next = 2;
|
|
57
|
+
return fetch(url, options.fetch);
|
|
58
|
+
|
|
59
|
+
case 2:
|
|
60
|
+
response = _context2.sent;
|
|
61
|
+
_context2.next = 5;
|
|
62
|
+
return response.arrayBuffer();
|
|
63
|
+
|
|
64
|
+
case 5:
|
|
65
|
+
arrayBuffer = _context2.sent;
|
|
66
|
+
_context2.next = 8;
|
|
67
|
+
return load(arrayBuffer, options);
|
|
68
|
+
|
|
69
|
+
case 8:
|
|
70
|
+
return _context2.abrupt("return", _context2.sent);
|
|
71
|
+
|
|
72
|
+
case 9:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context2.stop();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, _callee2);
|
|
78
|
+
}));
|
|
79
|
+
return _shallowLoad.apply(this, arguments);
|
|
19
80
|
}
|
|
20
81
|
//# sourceMappingURL=deep-load.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/texture-api/deep-load.ts"],"names":["deepLoad","urlTree","load","options","url","shallowLoad","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/texture-api/deep-load.ts"],"names":["deepLoad","urlTree","load","options","url","shallowLoad","fetch","response","arrayBuffer"],"mappings":";;;;;;;;;;;;;;AAAA;;SAEsBA,Q;;;;;wEAAf,iBAAwBC,OAAxB,EAAiCC,IAAjC,EAAuCC,OAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBACQ,gCAAaF,OAAb,EAAsB,UAACG,GAAD;AAAA,qBAASC,WAAW,CAACD,GAAD,EAAMF,IAAN,EAAYC,OAAZ,CAApB;AAAA,aAAtB,CADR;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAIeE,W;;;;;2EAAf,kBAA2BD,GAA3B,EAAgCF,IAAhC,EAAsCC,OAAtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAEkBG,KAAK,CAACF,GAAD,EAAMD,OAAO,CAACG,KAAd,CAFvB;;AAAA;AAECC,YAAAA,QAFD;AAAA;AAAA,mBAGqBA,QAAQ,CAACC,WAAT,EAHrB;;AAAA;AAGCA,YAAAA,WAHD;AAAA;AAAA,mBAIQN,IAAI,CAACM,WAAD,EAAcL,OAAd,CAJZ;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import {asyncDeepMap} from './async-deep-map';\n\nexport async function deepLoad(urlTree, load, options) {\n return await asyncDeepMap(urlTree, (url) => shallowLoad(url, load, options));\n}\n\nexport async function shallowLoad(url, load, options) {\n // console.error('loading', url);\n const response = await fetch(url, options.fetch);\n const arrayBuffer = await response.arrayBuffer();\n return await load(arrayBuffer, options);\n}\n"],"file":"deep-load.js"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.generateUrl = generateUrl;
|
|
7
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
8
12
|
var _loaderUtils = require("@loaders.gl/loader-utils");
|
|
9
13
|
|
|
10
14
|
var _assert = require("../utils/assert");
|
|
11
15
|
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
12
20
|
function generateUrl(getUrl, options, urlOptions) {
|
|
13
|
-
|
|
21
|
+
var url = getUrl;
|
|
14
22
|
|
|
15
23
|
if (typeof getUrl === 'function') {
|
|
16
|
-
url = getUrl({
|
|
17
|
-
...urlOptions
|
|
18
|
-
});
|
|
24
|
+
url = getUrl(_objectSpread(_objectSpread({}, options), urlOptions));
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
(0, _assert.assert)(typeof url === 'string');
|
|
22
|
-
|
|
23
|
-
baseUrl
|
|
24
|
-
} = options;
|
|
28
|
+
var baseUrl = options.baseUrl;
|
|
25
29
|
|
|
26
30
|
if (baseUrl) {
|
|
27
31
|
url = baseUrl[baseUrl.length - 1] === '/' ? "".concat(baseUrl).concat(url) : "".concat(baseUrl, "/").concat(url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/texture-api/generate-url.ts"],"names":["generateUrl","getUrl","options","urlOptions","url","baseUrl","length"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/texture-api/generate-url.ts"],"names":["generateUrl","getUrl","options","urlOptions","url","baseUrl","length"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;;;AAGO,SAASA,WAAT,CAAqBC,MAArB,EAA6BC,OAA7B,EAAsCC,UAAtC,EAAkD;AAEvD,MAAIC,GAAG,GAAGH,MAAV;;AACA,MAAI,OAAOA,MAAP,KAAkB,UAAtB,EAAkC;AAChCG,IAAAA,GAAG,GAAGH,MAAM,iCAAKC,OAAL,GAAiBC,UAAjB,EAAZ;AACD;;AACD,sBAAO,OAAOC,GAAP,KAAe,QAAtB;AAGA,MAAOC,OAAP,GAAkBH,OAAlB,CAAOG,OAAP;;AACA,MAAIA,OAAJ,EAAa;AACXD,IAAAA,GAAG,GAAGC,OAAO,CAACA,OAAO,CAACC,MAAR,GAAiB,CAAlB,CAAP,KAAgC,GAAhC,aAAyCD,OAAzC,SAAmDD,GAAnD,cAA8DC,OAA9D,cAAyED,GAAzE,CAAN;AACD;;AAED,SAAO,8BAAYA,GAAZ,CAAP;AACD","sourcesContent":["import {resolvePath} from '@loaders.gl/loader-utils';\nimport {assert} from '../utils/assert';\n\n// Generate a url by calling getUrl with mix of options, applying options.baseUrl\nexport function generateUrl(getUrl, options, urlOptions) {\n // Get url\n let url = getUrl;\n if (typeof getUrl === 'function') {\n url = getUrl({...options, ...urlOptions});\n }\n assert(typeof url === 'string');\n\n // Apply options.baseUrl\n const {baseUrl} = options;\n if (baseUrl) {\n url = baseUrl[baseUrl.length - 1] === '/' ? `${baseUrl}${url}` : `${baseUrl}/${url}`;\n }\n\n return resolvePath(url);\n}\n"],"file":"generate-url.js"}
|
|
@@ -9,6 +9,12 @@ exports.loadImage = loadImage;
|
|
|
9
9
|
exports.getImageUrls = getImageUrls;
|
|
10
10
|
exports.getMipLevels = getMipLevels;
|
|
11
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
+
|
|
12
18
|
var _assert = require("../utils/assert");
|
|
13
19
|
|
|
14
20
|
var _parseImage = _interopRequireDefault(require("../parsers/parse-image"));
|
|
@@ -19,51 +25,149 @@ var _generateUrl = require("./generate-url");
|
|
|
19
25
|
|
|
20
26
|
var _deepLoad = require("./deep-load");
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
function loadImage(_x) {
|
|
33
|
+
return _loadImage.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _loadImage() {
|
|
37
|
+
_loadImage = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(getUrl) {
|
|
38
|
+
var options,
|
|
39
|
+
imageUrls,
|
|
40
|
+
_args = arguments;
|
|
41
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
+
while (1) {
|
|
43
|
+
switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
46
|
+
_context.next = 3;
|
|
47
|
+
return getImageUrls(getUrl, options);
|
|
48
|
+
|
|
49
|
+
case 3:
|
|
50
|
+
imageUrls = _context.sent;
|
|
51
|
+
_context.next = 6;
|
|
52
|
+
return (0, _deepLoad.deepLoad)(imageUrls, _parseImage.default, options);
|
|
53
|
+
|
|
54
|
+
case 6:
|
|
55
|
+
return _context.abrupt("return", _context.sent);
|
|
56
|
+
|
|
57
|
+
case 7:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, _callee);
|
|
63
|
+
}));
|
|
64
|
+
return _loadImage.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getImageUrls(_x2, _x3) {
|
|
68
|
+
return _getImageUrls.apply(this, arguments);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _getImageUrls() {
|
|
72
|
+
_getImageUrls = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(getUrl, options) {
|
|
73
|
+
var urlOptions,
|
|
74
|
+
mipLevels,
|
|
75
|
+
_args2 = arguments;
|
|
76
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
77
|
+
while (1) {
|
|
78
|
+
switch (_context2.prev = _context2.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
urlOptions = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
81
|
+
mipLevels = options && options.image && options.image.mipLevels || 0;
|
|
82
|
+
|
|
83
|
+
if (!(mipLevels !== 0)) {
|
|
84
|
+
_context2.next = 8;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_context2.next = 5;
|
|
89
|
+
return getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions);
|
|
90
|
+
|
|
91
|
+
case 5:
|
|
92
|
+
_context2.t0 = _context2.sent;
|
|
93
|
+
_context2.next = 9;
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case 8:
|
|
97
|
+
_context2.t0 = (0, _generateUrl.generateUrl)(getUrl, options, urlOptions);
|
|
98
|
+
|
|
99
|
+
case 9:
|
|
100
|
+
return _context2.abrupt("return", _context2.t0);
|
|
101
|
+
|
|
102
|
+
case 10:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context2.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee2);
|
|
108
|
+
}));
|
|
109
|
+
return _getImageUrls.apply(this, arguments);
|
|
25
110
|
}
|
|
26
111
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return mipLevels !== 0 ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) : (0, _generateUrl.generateUrl)(getUrl, options, urlOptions);
|
|
112
|
+
function getMipmappedImageUrls(_x4, _x5, _x6, _x7) {
|
|
113
|
+
return _getMipmappedImageUrls.apply(this, arguments);
|
|
30
114
|
}
|
|
31
115
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
116
|
+
function _getMipmappedImageUrls() {
|
|
117
|
+
_getMipmappedImageUrls = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(getUrl, mipLevels, options, urlOptions) {
|
|
118
|
+
var urls, url, image, _getImageSize, width, height, mipLevel, _url;
|
|
119
|
+
|
|
120
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
121
|
+
while (1) {
|
|
122
|
+
switch (_context3.prev = _context3.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
urls = [];
|
|
125
|
+
|
|
126
|
+
if (!(mipLevels === 'auto')) {
|
|
127
|
+
_context3.next = 9;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread(_objectSpread({}, urlOptions), {}, {
|
|
132
|
+
lod: 0
|
|
133
|
+
}));
|
|
134
|
+
_context3.next = 5;
|
|
135
|
+
return (0, _deepLoad.shallowLoad)(url, _parseImage.default, options);
|
|
136
|
+
|
|
137
|
+
case 5:
|
|
138
|
+
image = _context3.sent;
|
|
139
|
+
_getImageSize = (0, _parsedImageApi.getImageSize)(image), width = _getImageSize.width, height = _getImageSize.height;
|
|
140
|
+
mipLevels = getMipLevels({
|
|
141
|
+
width: width,
|
|
142
|
+
height: height
|
|
143
|
+
});
|
|
144
|
+
urls.push(url);
|
|
145
|
+
|
|
146
|
+
case 9:
|
|
147
|
+
(0, _assert.assert)(mipLevels > 0);
|
|
148
|
+
|
|
149
|
+
for (mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
|
|
150
|
+
_url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread(_objectSpread({}, urlOptions), {}, {
|
|
151
|
+
lod: mipLevel
|
|
152
|
+
}));
|
|
153
|
+
urls.push(_url);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return _context3.abrupt("return", urls);
|
|
157
|
+
|
|
158
|
+
case 12:
|
|
159
|
+
case "end":
|
|
160
|
+
return _context3.stop();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, _callee3);
|
|
164
|
+
}));
|
|
165
|
+
return _getMipmappedImageUrls.apply(this, arguments);
|
|
61
166
|
}
|
|
62
167
|
|
|
63
|
-
function getMipLevels({
|
|
64
|
-
width,
|
|
65
|
-
|
|
66
|
-
}) {
|
|
168
|
+
function getMipLevels(_ref) {
|
|
169
|
+
var width = _ref.width,
|
|
170
|
+
height = _ref.height;
|
|
67
171
|
return 1 + Math.floor(Math.log2(Math.max(width, height)));
|
|
68
172
|
}
|
|
69
173
|
//# sourceMappingURL=load-image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/texture-api/load-image.ts"],"names":["loadImage","getUrl","options","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/texture-api/load-image.ts"],"names":["loadImage","getUrl","options","getImageUrls","imageUrls","parseImage","urlOptions","mipLevels","image","getMipmappedImageUrls","urls","url","lod","width","height","getMipLevels","push","mipLevel","length","Math","floor","log2","max"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;SAEsBA,S;;;;;yEAAf,iBAAyBC,MAAzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAiCC,YAAAA,OAAjC,2DAA2C,EAA3C;AAAA;AAAA,mBACmBC,YAAY,CAACF,MAAD,EAASC,OAAT,CAD/B;;AAAA;AACCE,YAAAA,SADD;AAAA;AAAA,mBAEQ,wBAASA,SAAT,EAAoBC,mBAApB,EAAgCH,OAAhC,CAFR;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAKeC,Y;;;;;4EAAf,kBAA4BF,MAA5B,EAAoCC,OAApC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA6CI,YAAAA,UAA7C,8DAA0D,EAA1D;AACCC,YAAAA,SADD,GACcL,OAAO,IAAIA,OAAO,CAACM,KAAnB,IAA4BN,OAAO,CAACM,KAAR,CAAcD,SAA3C,IAAyD,CADtE;;AAAA,kBAEEA,SAAS,KAAK,CAFhB;AAAA;AAAA;AAAA;;AAAA;AAAA,mBAGKE,qBAAqB,CAACR,MAAD,EAASM,SAAT,EAAoBL,OAApB,EAA6BI,UAA7B,CAH1B;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA,2BAID,8BAAYL,MAAZ,EAAoBC,OAApB,EAA6BI,UAA7B,CAJC;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAOQG,qB;;;;;qFAAf,kBAAqCR,MAArC,EAA6CM,SAA7C,EAAwDL,OAAxD,EAAiEI,UAAjE;AAAA;;AAAA;AAAA;AAAA;AAAA;AACQI,YAAAA,IADR,GACyB,EADzB;;AAAA,kBAIMH,SAAS,KAAK,MAJpB;AAAA;AAAA;AAAA;;AAKUI,YAAAA,GALV,GAKgB,8BAAYV,MAAZ,EAAoBC,OAApB,kCAAiCI,UAAjC;AAA6CM,cAAAA,GAAG,EAAE;AAAlD,eALhB;AAAA;AAAA,mBAMwB,2BAAYD,GAAZ,EAAiBN,mBAAjB,EAA6BH,OAA7B,CANxB;;AAAA;AAMUM,YAAAA,KANV;AAAA,4BAQ4B,kCAAaA,KAAb,CAR5B,EAQWK,KARX,iBAQWA,KARX,EAQkBC,MARlB,iBAQkBA,MARlB;AASIP,YAAAA,SAAS,GAAGQ,YAAY,CAAC;AAACF,cAAAA,KAAK,EAALA,KAAD;AAAQC,cAAAA,MAAM,EAANA;AAAR,aAAD,CAAxB;AAGAJ,YAAAA,IAAI,CAACM,IAAL,CAAUL,GAAV;;AAZJ;AAgBE,gCAAOJ,SAAS,GAAG,CAAnB;;AAEA,iBAASU,QAAT,GAAoBP,IAAI,CAACQ,MAAzB,EAAiCD,QAAQ,GAAGV,SAA5C,EAAuD,EAAEU,QAAzD,EAAmE;AAC3DN,cAAAA,IAD2D,GACrD,8BAAYV,MAAZ,EAAoBC,OAApB,kCAAiCI,UAAjC;AAA6CM,gBAAAA,GAAG,EAAEK;AAAlD,iBADqD;AAEjEP,cAAAA,IAAI,CAACM,IAAL,CAAUL,IAAV;AACD;;AArBH,8CAuBSD,IAvBT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AA2BO,SAASK,YAAT,OAAuC;AAAA,MAAhBF,KAAgB,QAAhBA,KAAgB;AAAA,MAATC,MAAS,QAATA,MAAS;AAC5C,SAAO,IAAIK,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,IAAL,CAAUF,IAAI,CAACG,GAAL,CAAST,KAAT,EAAgBC,MAAhB,CAAV,CAAX,CAAX;AACD","sourcesContent":["import {assert} from '../utils/assert';\nimport parseImage from '../parsers/parse-image';\nimport {getImageSize} from '../category-api/parsed-image-api';\nimport {generateUrl} from './generate-url';\nimport {deepLoad, shallowLoad} from './deep-load';\n\nexport async function loadImage(getUrl, options = {}) {\n const imageUrls = await getImageUrls(getUrl, options);\n return await deepLoad(imageUrls, parseImage, options);\n}\n\nexport async function getImageUrls(getUrl, options, urlOptions = {}) {\n const mipLevels = (options && options.image && options.image.mipLevels) || 0;\n return mipLevels !== 0\n ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)\n : generateUrl(getUrl, options, urlOptions);\n}\n\nasync function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {\n const urls: string[] = [];\n\n // If no mip levels supplied, we need to load the level 0 image and calculate based on size\n if (mipLevels === 'auto') {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: 0});\n const image = await shallowLoad(url, parseImage, options);\n\n const {width, height} = getImageSize(image);\n mipLevels = getMipLevels({width, height});\n\n // TODO - push image and make `deepLoad` pass through non-url values, avoid loading twice?\n urls.push(url);\n }\n\n // We now know how many mipLevels we need, remaining image urls can now be constructed\n assert(mipLevels > 0);\n\n for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {\n const url = generateUrl(getUrl, options, {...urlOptions, lod: mipLevel});\n urls.push(url);\n }\n\n return urls;\n}\n\n// Calculates number of mipmaps based on texture size (log2)\nexport function getMipLevels({width, height}) {\n return 1 + Math.floor(Math.log2(Math.max(width, height)));\n}\n"],"file":"load-image.js"}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.nodeVersion = exports.isWorker = exports.isBrowser = exports.document = exports.global = exports.window = exports.self = void 0;
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var globals = {
|
|
8
13
|
self: typeof self !== 'undefined' && self,
|
|
9
14
|
window: typeof window !== 'undefined' && window,
|
|
10
15
|
global: typeof global !== 'undefined' && global,
|
|
11
16
|
document: typeof document !== 'undefined' && document
|
|
12
17
|
};
|
|
13
|
-
|
|
18
|
+
var self_ = globals.self || globals.window || globals.global;
|
|
14
19
|
exports.self = self_;
|
|
15
|
-
|
|
20
|
+
var window_ = globals.window || globals.self || globals.global;
|
|
16
21
|
exports.window = window_;
|
|
17
|
-
|
|
22
|
+
var global_ = globals.global || globals.self || globals.window;
|
|
18
23
|
exports.global = global_;
|
|
19
|
-
|
|
24
|
+
var document_ = globals.document || {};
|
|
20
25
|
exports.document = document_;
|
|
21
|
-
|
|
26
|
+
var isBrowser = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) !== 'object' || String(process) !== '[object process]' || process.browser;
|
|
22
27
|
exports.isBrowser = isBrowser;
|
|
23
|
-
|
|
28
|
+
var isWorker = typeof importScripts === 'function';
|
|
24
29
|
exports.isWorker = isWorker;
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
var matches = typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);
|
|
31
|
+
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
27
32
|
exports.nodeVersion = nodeVersion;
|
|
28
33
|
//# sourceMappingURL=globals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/globals.ts"],"names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","process","String","browser","isWorker","importScripts","matches","version","exec","nodeVersion","parseFloat"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/globals.ts"],"names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","process","String","browser","isWorker","importScripts","matches","version","exec","nodeVersion","parseFloat"],"mappings":";;;;;;;;;;;AAwBA,IAAMA,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAE,OAAOA,IAAP,KAAgB,WAAhB,IAA+BA,IADvB;AAEdC,EAAAA,MAAM,EAAE,OAAOA,MAAP,KAAkB,WAAlB,IAAiCA,MAF3B;AAGdC,EAAAA,MAAM,EAAE,OAAOA,MAAP,KAAkB,WAAlB,IAAiCA,MAH3B;AAIdC,EAAAA,QAAQ,EAAE,OAAOA,QAAP,KAAoB,WAApB,IAAmCA;AAJ/B,CAAhB;AAOA,IAAMC,KAAK,GAAGL,OAAO,CAACC,IAAR,IAAgBD,OAAO,CAACE,MAAxB,IAAkCF,OAAO,CAACG,MAAxD;;AACA,IAAMG,OAAO,GAAGN,OAAO,CAACE,MAAR,IAAkBF,OAAO,CAACC,IAA1B,IAAkCD,OAAO,CAACG,MAA1D;;AACA,IAAMI,OAAO,GAAGP,OAAO,CAACG,MAAR,IAAkBH,OAAO,CAACC,IAA1B,IAAkCD,OAAO,CAACE,MAA1D;;AACA,IAAMM,SAAS,GAAGR,OAAO,CAACI,QAAR,IAAoB,EAAtC;;AAIO,IAAMK,SAAS,GAEpB,QAAOC,OAAP,uDAAOA,OAAP,OAAmB,QAAnB,IAA+BC,MAAM,CAACD,OAAD,CAAN,KAAoB,kBAAnD,IAAyEA,OAAO,CAACE,OAF5E;;AAIA,IAAMC,QAAQ,GAAG,OAAOC,aAAP,KAAyB,UAA1C;;AAGP,IAAMC,OAAO,GACX,OAAOL,OAAP,KAAmB,WAAnB,IAAkCA,OAAO,CAACM,OAA1C,IAAqD,YAAYC,IAAZ,CAAiBP,OAAO,CAACM,OAAzB,CADvD;AAEO,IAAME,WAAW,GAAIH,OAAO,IAAII,UAAU,CAACJ,OAAO,CAAC,CAAD,CAAR,CAAtB,IAAuC,CAA3D","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// Purpose: include this in your module to avoids adding dependencies on\n// micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\nconst self_ = globals.self || globals.window || globals.global;\nconst window_ = globals.window || globals.self || globals.global;\nconst global_ = globals.global || globals.self || globals.window;\nconst document_ = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\nexport const isBrowser =\n // @ts-ignore\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n\nexport const isWorker = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);\nexport const nodeVersion = (matches && parseFloat(matches[1])) || 0;\n"],"file":"globals.js"}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
|
|
7
|
+
var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":";;;;;;AAGO,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":";;;;;;AAGO,IAAMA,OAAO,GAAG,oBAAuB,WAAvB,cAAmD,QAAnE","sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"file":"version.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = typeof "3.0.
|
|
1
|
+
export const VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/images",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "Framework-independent loaders and writers for images (PNG, JPG, ...)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"build-worker": "webpack --entry ./src/image-worker.js --output ./dist/image-worker.js --config ../../scripts/webpack/worker.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "3.0.
|
|
36
|
+
"@loaders.gl/loader-utils": "3.0.14"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "dc931768fc34de549ef6baeb94e2ee5aa8163baf"
|
|
39
39
|
}
|