feat(glur): type definitions for glur (#44410)

- definition files
- tests

https://www.npmjs.com/package/glur
https://github.com/nodeca/glur#api

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-05-13 19:16:27 +02:00 committed by GitHub
parent cd8dce9ba2
commit 3095fe0caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 0 deletions

10
types/glur/glur-tests.ts Normal file
View File

@ -0,0 +1,10 @@
import blurRGBA = require('glur');
import blurRGBAMono = require('glur/mono16');
const testRGBA = (src: Uint8Array) => {
blurRGBA(src, 100, 100, 50); // $ExpectType void
};
const testMono16 = (src: Uint16Array) => {
blurRGBAMono(src, 100, 100, 50); // $ExpectType void
};

20
types/glur/index.d.ts vendored Normal file
View File

@ -0,0 +1,20 @@
// Type definitions for glur 1.1
// Project: https://github.com/andr83/glur/issues
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Fast Gaussian Blur in pure JavaScript, via IIR filer.
* Speed does not depend on blur radius
* @param src - typed array with image RGBA data (will be updated with blurred image)
* @param width - image width
* @param height - image height
* @param radius - blur radius
*/
declare function blurRGBA(src: Uint8Array, width: number, height: number, radius: number): void;
/**
* Fast gaussian blur in pure JavaScript via IIR filer
*/
export = blurRGBA;

16
types/glur/mono16.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
/**
* Fast Gaussian Blur in pure JavaScript, via IIR filer.
* Speed does not depend on blur radius
* Can be useful to calculate unsharp mask via brightness/lightness channel
* @param src - typed array with image grayscale data (will be updated with blurred image)
* @param width - image width
* @param height - image height
* @param radius - blur radius
*/
declare function blurMono16(src: Uint16Array, width: number, height: number, radius: number): void;
/**
* Fast gaussian blur in pure JavaScript via IIR filer.
* Input data is grayscale Uint16Array
*/
export = blurMono16;

23
types/glur/tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"glur-tests.ts"
]
}

1
types/glur/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }