@loaders.gl/images 3.1.0-beta.7 → 3.1.3
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/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/image-loader.js +8 -6
- 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 +11 -11
- 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-format.js +5 -7
- package/dist/es5/lib/category-api/image-format.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 +35 -7
- 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/version.js +1 -1
- package/dist/es5/lib/utils/version.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js.map +1 -1
- package/package.json +3 -3
|
@@ -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 _loaderUtils = require("@loaders.gl/loader-utils");
|
|
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, _loaderUtils.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;;;;S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BE,qCAAOJ,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 '@loaders.gl/loader-utils';\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"}
|
|
@@ -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.1.3" !== 'undefined' ? "3.1.3" : '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,mBAAuB,WAAvB,aAAmD,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.1.
|
|
1
|
+
export const VERSION = typeof "3.1.3" !== 'undefined' ? "3.1.3" : 'latest';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":"AAGA,OAAO,MAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":"AAGA,OAAO,MAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/images",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Framework-independent loaders and writers for images (PNG, JPG, ...)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/loader-utils": "3.1.
|
|
35
|
+
"@loaders.gl/loader-utils": "3.1.3"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4a690c369779346d73c9a27395d1c08d77d279a4"
|
|
38
38
|
}
|