Targadactyl
A .tga file loader for Deno. (Forked from tga-js)
Usage Examples
Instantiate the TgaLoader
class and pass an Uint8ClampedArray
of image data
to the load()
method before attempting to get the canvas, image data or
header information.
A TgaLoaderReferenceError
will be thrown by TgaLoader.getImageData()
,
TgaLoader.getCanvas()
and TgaLoader.header
if the TGA file has not loaded
prior to the method call.
Loading a Local .tga File
import TgaLoader from "https://deno.land/x/targadactyl@1.0.1/mod.ts";
const tga = new TgaLoader();
tga.load(
await tga.open("./test/test.tga"),
);
Loading a Remote .tga File
import TgaLoader from "https://deno.land/x/targadactyl@1.0.1/mod.ts";
const tga = new TgaLoader();
const res = await fetch(
"https://raw.githubusercontent.com/jasonjgardner/targadactyl/main/test/test.tga",
);
const buffer = res.arrayBuffer();
tga.load(
new Uint8ClampedArray(buffer),
);
Serving a .tga File
🎉
Serving./test/test.tga
via deno.dev