getPixels.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. return {
  2. summary = 'Get the pixels of the Texture.',
  3. description = [[
  4. Creates and returns a new `Image` object with the current pixels of the Texture. This function
  5. is very very slow because it stalls the CPU until the download is complete. It should only be
  6. used for debugging, non-interactive scripts, etc. For an asynchronous version that doesn't
  7. stall the CPU, see `Texture:newReadback`.
  8. ]],
  9. arguments = {
  10. x = {
  11. type = 'number',
  12. default = '0',
  13. description = 'The x offset of the region to download.'
  14. },
  15. y = {
  16. type = 'number',
  17. default = '0',
  18. description = 'The y offset of the region to download.'
  19. },
  20. layer = {
  21. type = 'number',
  22. default = '1',
  23. description = 'The index of the layer to download.'
  24. },
  25. mipmap = {
  26. type = 'number',
  27. default = '1',
  28. description = 'The index of the mipmap level to download.'
  29. },
  30. width = {
  31. type = 'number',
  32. default = 'nil',
  33. description = [[
  34. The width of the pixel rectangle to download. If nil, the "rest" of the width will be used,
  35. based on the texture width and x offset.
  36. ]]
  37. },
  38. height = {
  39. type = 'number',
  40. default = 'nil',
  41. description = [[
  42. The height of the pixel rectangle to download. If nil, the "rest" of the height will be
  43. used, based on the texture height and y offset.
  44. ]]
  45. }
  46. },
  47. returns = {
  48. image = {
  49. type = 'Image',
  50. description = 'The new image with the pixels.'
  51. }
  52. },
  53. variants = {
  54. {
  55. arguments = { 'x', 'y', 'layer', 'mipmap', 'width', 'height' },
  56. returns = { 'image' }
  57. }
  58. },
  59. notes = [[
  60. The texture must have been created with the `transfer` usage.
  61. Multisampled textures can not be read back.
  62. It is not currently possible to read back a texture view.
  63. ]],
  64. related = {
  65. 'Texture:newReadback'
  66. }
  67. }