forked from olcxjas-softworks/LarpixClient
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { ParsedGif, ParsedFrame } from 'gifuct-js';
|
|
import { GetArrTypeUnion } from './helper';
|
|
export type IFrames = Pick<ParsedGif, 'frames'>['frames'];
|
|
export type IFrame = GetArrTypeUnion<IFrames>;
|
|
export interface IParsedFrameInfo {
|
|
frames: ImageData[];
|
|
delays: number[];
|
|
parsedFrames: ParsedFrame[];
|
|
}
|
|
export declare class Decoder {
|
|
private url;
|
|
private parseGIF;
|
|
constructor(url: string);
|
|
decode(): Promise<ParsedGif>;
|
|
decompressFrames(): Promise<IParsedFrameInfo>;
|
|
/**
|
|
* Validates and fixes frames that have lost pixels.
|
|
* @param gif
|
|
*/
|
|
private validateAndFixFrame;
|
|
/**
|
|
* Generates ImageData objects from parsed frames.
|
|
* @param frames
|
|
*/
|
|
private generate2ImageData;
|
|
/**
|
|
* Generates ImageData objects from frames with modified pixels.
|
|
* @param frames
|
|
*/
|
|
private generate2ImageDataWithPixelsModified;
|
|
/**
|
|
* @param {string} url
|
|
* @returns
|
|
*/
|
|
private fetchImageData;
|
|
private handlePixels;
|
|
private putPixels;
|
|
}
|