dumpTools.d.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import type { AbstractEngine } from "../Engines/abstractEngine";
  2. /**
  3. * Class containing a set of static utilities functions to dump data from a canvas
  4. */
  5. export declare class DumpTools {
  6. private static _DumpToolsEngine;
  7. private static _CreateDumpRenderer;
  8. /**
  9. * Dumps the current bound framebuffer
  10. * @param width defines the rendering width
  11. * @param height defines the rendering height
  12. * @param engine defines the hosting engine
  13. * @param successCallback defines the callback triggered once the data are available
  14. * @param mimeType defines the mime type of the result
  15. * @param fileName defines the filename to download. If present, the result will automatically be downloaded
  16. * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
  17. * @returns a void promise
  18. */
  19. static DumpFramebuffer(width: number, height: number, engine: AbstractEngine, successCallback?: (data: string) => void, mimeType?: string, fileName?: string, quality?: number): Promise<void>;
  20. /**
  21. * Dumps an array buffer
  22. * @param width defines the rendering width
  23. * @param height defines the rendering height
  24. * @param data the data array
  25. * @param mimeType defines the mime type of the result
  26. * @param fileName defines the filename to download. If present, the result will automatically be downloaded
  27. * @param invertY true to invert the picture in the Y dimension
  28. * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
  29. * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
  30. * @returns a promise that resolve to the final data
  31. */
  32. static DumpDataAsync(width: number, height: number, data: ArrayBufferView, mimeType?: string, fileName?: string, invertY?: boolean, toArrayBuffer?: boolean, quality?: number): Promise<string | ArrayBuffer>;
  33. /**
  34. * Dumps an array buffer
  35. * @param width defines the rendering width
  36. * @param height defines the rendering height
  37. * @param data the data array
  38. * @param successCallback defines the callback triggered once the data are available
  39. * @param mimeType defines the mime type of the result
  40. * @param fileName defines the filename to download. If present, the result will automatically be downloaded
  41. * @param invertY true to invert the picture in the Y dimension
  42. * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string
  43. * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.
  44. */
  45. static DumpData(width: number, height: number, data: ArrayBufferView, successCallback?: (data: string | ArrayBuffer) => void, mimeType?: string, fileName?: string, invertY?: boolean, toArrayBuffer?: boolean, quality?: number): void;
  46. /**
  47. * Dispose the dump tools associated resources
  48. */
  49. static Dispose(): void;
  50. }