-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
574 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @loaders.gl/image-api | ||
|
||
[loaders.gl](https://loaders.gl/docs) is a collection of framework independent 3D and geospatial parsers and encoders. | ||
|
||
This module contains category APIs for images that follow loaders.gl conventions and work under both node and browser. | ||
|
||
For documentation please visit the [website](https://loaders.gl). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Overview | ||
|
||
The `@loaders.gl/image-api` module contains loader and writers for images that follow loaders.gl conventions and work under both node and browser. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @loaders.gl/image-api | ||
``` | ||
|
||
## API | ||
|
||
### Parsed Image API | ||
|
||
A set of functions to work with parsed images returned by the `ImageLoader`. | ||
|
||
| Function | Description | | ||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | ||
| `isImageTypeSupported(type : string) : boolean` | Check if type is supported by current run-time environment | | ||
| `getDefaultImageType() : string` | Returns the image type selected by default ( `options.image.type: 'auto'` in current run-time environment | | ||
| `isImage(image : any) : boolean` | Checks any JavaScript value to see if it is an image of a type that loaders.gl can work with | | ||
| `getImageType(image : any) : string` | Returns the type name for this image. | | ||
| `getImageData(image : any) : object` | Returns an image data object with a `data` array representing the pixels of an image | | ||
|
||
### Binary Image API | ||
|
||
Note that `@loaders.gl/images` also exports a binary image API. | ||
|
||
### Image Loading API for WebGL Textures | ||
|
||
The images API also offers functions to load "composite" images for WebGL textures, cube textures and image mip levels. | ||
|
||
These functions take a `getUrl` parameter that enables the app to supply the url for each "sub-image", and return a single promise enabling applications to for instance load all the faces of a cube texture, with one image for each mip level for each face in a single async operation. | ||
|
||
| Function | Description | | ||
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | | ||
| [`loadImage`](modules/images/docs/api-reference/load-image) | Load a single image | | ||
| [`loadImageArray`](modules/images/docs/api-reference/load-image-array) | Load an array of images, e.g. for a `Texture2DArray` or `Texture3D` | | ||
| [`loadImageCube`](modules/images/docs/api-reference/load-image-cube) | Load a map of 6 images for the faces of a cube map, or a map of 6 arrays of images for the mip levels of the 6 faces. | | ||
|
||
As with all loaders.gl functions, while these functions are intended for use in WebGL applications, they do not call any WebGL functions, and do not actually create any WebGL textures.. | ||
|
||
## Image Types | ||
|
||
To support image loading on older browsers and Node.js, the `ImageLoader` can return different types, i.e. different representations of the parsed image. | ||
|
||
- `ImageBitmap` - An `ImageBitmap` object represents a bitmap image that can be performantly painted to a canvas ("without undue latency"). Due to the signficant performance advantages, and the fact that `ImageBitmap` instances can be transferred efficiently between threads, `ImageBitmap` is the preferred parsed image representation in browsers, when available. Currently only available in Chrome and Firefox. | ||
- `Image` (aka `HTMLImageElement`) - The traditional HTML image class. Available in all browsers. | ||
- `data` - Raw binary memory representing the image pixels, typically in RGBA `Uint8Array` format. JavaScript computations can be done on this data. Also, Node.js texture creation functions in headless gl accept `data` images. and browser `ImageData` objects can be initialized with this data. | ||
|
||
See [`ImageLoader`](modules/images/docs/api-reference/image-loader) for more details on options etc. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "@loaders.gl/image-api", | ||
"version": "2.3.0-alpha.7", | ||
"description": "Framework-independent API for images (PNG, JPG, ...)", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/visgl/loaders.gl" | ||
}, | ||
"keywords": [ | ||
"webgl", | ||
"loader", | ||
"image", | ||
"PNG", | ||
"JPEG", | ||
"JPG" | ||
], | ||
"types": "src/index.d.ts", | ||
"main": "dist/es5/index.js", | ||
"module": "dist/esm/index.js", | ||
"esnext": "dist/es6/index.js", | ||
"sideEffects": false, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"pre-build": "npm run build-bundle && npm run build-bundle -- --env.dev", | ||
"build-bundle": "webpack --display=minimal --config ../../scripts/bundle.config.js" | ||
}, | ||
"dependencies": { | ||
"@loaders.gl/loader-utils": "2.3.0-alpha.7", | ||
"@loaders.gl/images": "2.3.0-alpha.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global window, global */ | ||
const moduleExports = require('./index'); | ||
const _global = typeof window === 'undefined' ? global : window; | ||
// @ts-ignore | ||
_global.loaders = _global.loaders || {}; | ||
// @ts-ignore | ||
module.exports = Object.assign(_global.loaders, moduleExports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// TYPES | ||
export {ImageDataType, ImageType, ImageTypeEnum} from './types'; | ||
|
||
// IMAGE CATEGORY API | ||
|
||
// Parsed Image API | ||
export {isImageTypeSupported, getDefaultImageType} from './lib/category-api/image-type'; | ||
|
||
export { | ||
isImage, | ||
getImageType, | ||
getImageSize, | ||
getImageData | ||
} from './lib/category-api/parsed-image-api'; | ||
|
||
// Texture Loading API | ||
export {loadImage} from './lib/texture-api/load-image'; | ||
export {loadImageArray} from './lib/texture-api/load-image-array'; | ||
export {loadImageCube} from './lib/texture-api/load-image-cube'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// IMAGE CATEGORY API | ||
|
||
// Binary Image API | ||
export {getBinaryImageMetadata} from '@loaders.gl/images'; | ||
|
||
// Parsed Image API | ||
export {isImageTypeSupported} from './lib/category-api/image-type'; | ||
|
||
export { | ||
isImage, | ||
getImageType, | ||
getImageSize, | ||
getImageData | ||
} from './lib/category-api/parsed-image-api'; | ||
|
||
// Texture Loading API | ||
export {loadImage} from './lib/texture-api/load-image'; | ||
export {loadImageArray} from './lib/texture-api/load-image-array'; | ||
export {loadImageCube} from './lib/texture-api/load-image-cube'; | ||
|
||
// DEPRECATED in v2.3 | ||
export {getDefaultImageType} from './lib/category-api/image-type'; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../src/lib/category-api/parsed-image-api.js → .../src/lib/category-api/parsed-image-api.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...mages/src/lib/texture-api/generate-url.js → ...e-api/src/lib/texture-api/generate-url.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/src/lib/texture-api/load-image-array.js → ...i/src/lib/texture-api/load-image-array.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/src/lib/texture-api/load-image-cube.js → ...pi/src/lib/texture-api/load-image-cube.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.