newImage.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. return {
  2. summary = 'Create a new Image.',
  3. description = [[
  4. Creates a new Image. Image data can be loaded and decoded from an image file, or a raw block of
  5. pixels with a specified width, height, and format can be created.
  6. ]],
  7. arguments = {
  8. width = {
  9. type = 'number',
  10. description = 'The width of the texture.'
  11. },
  12. height = {
  13. type = 'number',
  14. description = 'The height of the texture.'
  15. },
  16. format = {
  17. type = 'TextureFormat',
  18. default = 'rgba8',
  19. description = 'The format of the texture\'s pixels.'
  20. },
  21. filename = {
  22. type = 'string',
  23. description = 'The filename of the image to load.'
  24. },
  25. blob = {
  26. type = 'Blob',
  27. description = 'The Blob containing image data to decode.'
  28. },
  29. data = {
  30. type = 'Blob',
  31. default = 'nil',
  32. description = 'Raw pixel values to use as the contents. If `nil`, the data will all be zero.'
  33. },
  34. source = {
  35. type = 'Image',
  36. description = 'The Image to clone.'
  37. }
  38. },
  39. returns = {
  40. image = {
  41. type = 'Image',
  42. description = 'The new Image.'
  43. }
  44. },
  45. variants = {
  46. {
  47. description = 'Load image data from a file.',
  48. arguments = { 'filename' },
  49. returns = { 'image' }
  50. },
  51. {
  52. description = 'Create an Image with a given size and pixel format.',
  53. arguments = { 'width', 'height', 'format', 'data' },
  54. returns = { 'image' }
  55. },
  56. {
  57. description = 'Clone an existing Image.',
  58. arguments = { 'source' },
  59. returns = { 'image' }
  60. },
  61. {
  62. description = 'Decode image data from a Blob.',
  63. arguments = { 'blob' },
  64. returns = { 'image' }
  65. }
  66. },
  67. notes = [[
  68. The supported image file formats are png, jpg, hdr, dds, ktx1, ktx2, and astc.
  69. DDS and KTX files can contain cubemaps and array textures, in any of the texture formats LÖVR
  70. supports.
  71. ]]
  72. }