import { TgaLoader } from "https://deno.land/x/targadactyl@1.2.0/src/tga.ts";
Loads local or remote TGA files into a canvas rendering context.
Methods
private
decodeRLE(data: Uint8ClampedArray,
offset: number,
pixelSize: number,
outputSize: number,
Decode compressed TGA file
private
getImageData(imageData?: ImageData): Uint8ClampedArrayGet ImageData
interface for the TGA
private
getImageData16bits(imageData: Uint8ClampedArray,
pixels: Uint8ClampedArray,
_colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 16 bit RGB TGA file
private
getImageData24bits(imageData: Uint8ClampedArray,
pixels: Uint8ClampedArray,
_colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 24 bit RGB TGA file
private
getImageData32bits(imageData: Uint8ClampedArray,
pixels: Uint8ClampedArray,
_colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 32 bit RGB TGA file
private
getImageData8bits(imageData: Uint8ClampedArray,
indexes: Uint8ClampedArray,
colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 8 bit RGB TGA file
private
getImageDataGrey16bits(imageData: Uint8ClampedArray,
pixels: Uint8ClampedArray,
_colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 16 bit gray TGA file
private
getImageDataGrey8bits(imageData: Uint8ClampedArray,
pixels: Uint8ClampedArray,
_colorMap: Uint8ClampedArray,
width: number,
yStart: number,
yStep: number,
yEnd: number,
xStart: number,
xStep: number,
xEnd: number,
Copy image data from 8 bit gray TGA file
decode(contentType: "image/png" | "image/jpeg"): Uint8Array
Helper method for decoding the TGA file as an Uint8Array
. Useful for serving the image.
Returns a canvas containing the TGA image
getDataURL(type?: "image/png" | "image/jpeg"): string
Gets TGA image as Base64-encoded data URL
open(path: string): Promise<Uint8ClampedArray>
Open local TGA file. Requires read permissions.