Package Exports
- tga-js
- tga-js/dist/cjs/tga.js
- tga-js/dist/umd/tga.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tga-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tga-js
tga-js is a tga file loader written in JavaScript, working in the browser environment. It provides a simple and really fast solution for loading TGA file format.
Lot of games are using TGA files to store textures. So, since browsers try to bring games in the web it can be a good idea to have a TGA loader (actually a better idea to use another smaller file format).
🔗 Used by :
🚀 Installation
Install with yarn:
$ yarn add tga-jsOr install using npm:
$ npm i tga-js📖 Usage
Loading a remote tga file.
import TgaLoader from 'tga-js';
const tga = new TgaLoader();
tga.open('./assets/resource.tga', () => {
document.body.appendChild(tga.getCanvas());
});Loading a tga from buffer.
import TgaLoader from 'tga-js';
const tga = new TgaLoader();
// Your own function returning a buffer from cache/memory/..
const buffer = getImageBufferFromCache('resource/data');
tga.load(new UInt8Array(buffer));
document.body.appendChild(tga.getCanvas());Get data-uri as output
tga.getDataURL('image/png');