copyTools.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import type { ISize } from "../Maths/math.size";
  2. import type { Nullable } from "../types";
  3. import type { BaseTexture } from "../Materials/Textures/baseTexture";
  4. /**
  5. * Transform some pixel data to a base64 string
  6. * @param pixels defines the pixel data to transform to base64
  7. * @param size defines the width and height of the (texture) data
  8. * @param invertY true if the data must be inverted for the Y coordinate during the conversion
  9. * @returns The base64 encoded string or null
  10. */
  11. export declare function GenerateBase64StringFromPixelData(pixels: ArrayBufferView, size: ISize, invertY?: boolean): Nullable<string>;
  12. /**
  13. * Reads the pixels stored in the webgl texture and returns them as a base64 string
  14. * @param texture defines the texture to read pixels from
  15. * @param faceIndex defines the face of the texture to read (in case of cube texture)
  16. * @param level defines the LOD level of the texture to read (in case of Mip Maps)
  17. * @returns The base64 encoded string or null
  18. */
  19. export declare function GenerateBase64StringFromTexture(texture: BaseTexture, faceIndex?: number, level?: number): Nullable<string>;
  20. /**
  21. * Reads the pixels stored in the webgl texture and returns them as a base64 string
  22. * @param texture defines the texture to read pixels from
  23. * @param faceIndex defines the face of the texture to read (in case of cube texture)
  24. * @param level defines the LOD level of the texture to read (in case of Mip Maps)
  25. * @returns The base64 encoded string or null wrapped in a promise
  26. */
  27. export declare function GenerateBase64StringFromTextureAsync(texture: BaseTexture, faceIndex?: number, level?: number): Promise<Nullable<string>>;
  28. /**
  29. * Class used to host copy specific utilities
  30. * (Back-compat)
  31. */
  32. export declare const CopyTools: {
  33. /**
  34. * Transform some pixel data to a base64 string
  35. * @param pixels defines the pixel data to transform to base64
  36. * @param size defines the width and height of the (texture) data
  37. * @param invertY true if the data must be inverted for the Y coordinate during the conversion
  38. * @returns The base64 encoded string or null
  39. */
  40. GenerateBase64StringFromPixelData: typeof GenerateBase64StringFromPixelData;
  41. /**
  42. * Reads the pixels stored in the webgl texture and returns them as a base64 string
  43. * @param texture defines the texture to read pixels from
  44. * @param faceIndex defines the face of the texture to read (in case of cube texture)
  45. * @param level defines the LOD level of the texture to read (in case of Mip Maps)
  46. * @returns The base64 encoded string or null
  47. */
  48. GenerateBase64StringFromTexture: typeof GenerateBase64StringFromTexture;
  49. /**
  50. * Reads the pixels stored in the webgl texture and returns them as a base64 string
  51. * @param texture defines the texture to read pixels from
  52. * @param faceIndex defines the face of the texture to read (in case of cube texture)
  53. * @param level defines the LOD level of the texture to read (in case of Mip Maps)
  54. * @returns The base64 encoded string or null wrapped in a promise
  55. */
  56. GenerateBase64StringFromTextureAsync: typeof GenerateBase64StringFromTextureAsync;
  57. };