Set up decoder infrastructure

This commit is contained in:
Surma
2018-07-04 15:18:47 +01:00
parent 6e8f8bbe41
commit 790a5b580d
10 changed files with 5450 additions and 3143 deletions

View File

@@ -0,0 +1,15 @@
import { canDecode, fileToBitmap } from '../../lib/util';
export const name = 'Browser PNG Decoder';
export const supportedExtensions = ['png'];
export const supportedMimeTypes = ['image/png'];
export async function decode(file: File): Promise<ImageBitmap> {
return fileToBitmap(file);
}
// tslint:disable-next-line:max-line-length Its a data URL. Whatcha gonna do?
const pngFile = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';
export function isSupported(): Promise<boolean> {
return canDecode(pngFile);
}