Skip to main content
Module

x/targadactyl/mod.ts>TgaLoader

tga.js implemented in Deno
Latest
class TgaLoader
Re-export
import { TgaLoader } from "https://deno.land/x/targadactyl@1.2.0/mod.ts";

Loads local or remote TGA files into a canvas rendering context.

Properties

optional
_header: TgaHeader

TGA file header information

header: TgaHeader

Getter method for accessing header information

optional
imageData: Uint8ClampedArray

Array containing TGA image data

optional
palette: Uint8ClampedArray

Array containing TGA image color data

Methods

private
decodeRLE(
data: Uint8ClampedArray,
offset: number,
pixelSize: number,
outputSize: number,
): Uint8ClampedArray

Decode compressed TGA file

private
getImageData(imageData?: ImageData): Uint8ClampedArray

Get 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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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.

fetch(uri: URL): Promise<Uint8ClampedArray>

Open remote TGA file

Returns a canvas containing the TGA image

getDataURL(type?: "image/png" | "image/jpeg"): string

Gets TGA image as Base64-encoded data URL

load(data: Uint8ClampedArray): TgaLoader

Parse Uint8ClampedArray of TGA data

open(path: string): Promise<Uint8ClampedArray>

Open local TGA file. Requires read permissions.

Properties

optional
_header: TgaHeader

TGA file header information

header: TgaHeader

Getter method for accessing header information

optional
imageData: Uint8ClampedArray

Array containing TGA image data

optional
palette: Uint8ClampedArray

Array containing TGA image color data

Methods

private
decodeRLE(
data: Uint8ClampedArray,
offset: number,
pixelSize: number,
outputSize: number,
): Uint8ClampedArray

Decode compressed TGA file

private
getImageData(imageData?: ImageData): Uint8ClampedArray

Get 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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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,
): Uint8ClampedArray

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.

fetch(uri: URL): Promise<Uint8ClampedArray>

Open remote TGA file

Returns a canvas containing the TGA image

getDataURL(type?: "image/png" | "image/jpeg"): string

Gets TGA image as Base64-encoded data URL

load(data: Uint8ClampedArray): TgaLoader

Parse Uint8ClampedArray of TGA data

open(path: string): Promise<Uint8ClampedArray>

Open local TGA file. Requires read permissions.