newTextureData.lua 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. return {
  2. summary = 'Create a new TextureData.',
  3. description = [[
  4. Creates a new TextureData. Image data can be loaded and decoded from an image file, or a raw
  5. block of 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 = 'rgba',
  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 TextureData contents. If `nil`, the data will all be zero.'
  33. },
  34. source = {
  35. type = 'TextureData',
  36. description = 'The TextureData to clone.'
  37. },
  38. flip = {
  39. type = 'boolean',
  40. default = 'true',
  41. description = [[
  42. Whether to vertically flip the image on load. This should be true for normal textures, and
  43. false for textures that are going to be used in a cubemap.
  44. ]]
  45. }
  46. },
  47. returns = {
  48. textureData = {
  49. type = 'TextureData',
  50. description = 'The new TextureData.'
  51. }
  52. },
  53. variants = {
  54. {
  55. description = 'Load image data from a file.',
  56. arguments = { 'filename', 'flip' },
  57. returns = { 'textureData' }
  58. },
  59. {
  60. description = 'Create a TextureData with a given size and pixel format.',
  61. arguments = { 'width', 'height', 'format', 'data' },
  62. returns = { 'textureData' }
  63. },
  64. {
  65. description = 'Clone an existing TextureData.',
  66. arguments = { 'source' },
  67. returns = { 'textureData' }
  68. },
  69. {
  70. description = 'Decode image data from a Blob.',
  71. arguments = { 'blob', 'flip' },
  72. returns = { 'textureData' }
  73. }
  74. },
  75. notes = [[
  76. The supported image file formats are png, jpg, hdr, dds (DXT1, DXT3, DXT5), ktx, and astc.
  77. Only 2D textures are supported for DXT/ASTC.
  78. Currently textures loaded as KTX need to be in DXT/ASTC formats.
  79. ]]
  80. }