index.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { ImageCallback } from '@jimp/core';
  2. type ColorActionName =
  3. | 'mix'
  4. | 'tint'
  5. | 'shade'
  6. | 'xor'
  7. | 'red'
  8. | 'green'
  9. | 'blue'
  10. | 'hue';
  11. type ColorAction = {
  12. apply: ColorActionName;
  13. params: any;
  14. };
  15. interface Color {
  16. brightness(val: number, cb?: ImageCallback<this>): this;
  17. contrast(val: number, cb?: ImageCallback<this>): this;
  18. posterize(n: number, cb?: ImageCallback<this>): this;
  19. greyscale(cb?: ImageCallback<this>): this;
  20. grayscale(cb?: ImageCallback<this>): this;
  21. opacity(f: number, cb?: ImageCallback<this>): this;
  22. sepia(cb?: ImageCallback<this>): this;
  23. fade(f: number, cb?: ImageCallback<this>): this;
  24. convolution(kernel: number[][], cb?: ImageCallback<this>): this;
  25. convolution<T>(
  26. kernel: number[][],
  27. edgeHandling: string,
  28. cb?: ImageCallback<this>
  29. ): this;
  30. opaque(cb?: ImageCallback<this>): this;
  31. pixelate(size: number, cb?: ImageCallback<this>): this;
  32. pixelate(
  33. size: number,
  34. x: number,
  35. y: number,
  36. w: number,
  37. h: number,
  38. cb?: ImageCallback<this>
  39. ): this;
  40. convolute(kernel: number[][], cb?: ImageCallback<this>): this;
  41. convolute(
  42. kernel: number[][],
  43. x: number,
  44. y: number,
  45. w: number,
  46. h: number,
  47. cb?: ImageCallback<this>
  48. ): this;
  49. color(actions: ColorAction[], cb?: ImageCallback<this>): this;
  50. colour(actions: ColorAction[], cb?: ImageCallback<this>): this;
  51. }
  52. export default function(): Color;