Image.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #include "Image.hpp"
  2. #include "Defs.hpp"
  3. #include "Vector2.hpp"
  4. #include "Rect2.hpp"
  5. #include "Color.hpp"
  6. #include "String.hpp"
  7. #include "PoolArrays.hpp"
  8. #include <godot/godot_image.h>
  9. namespace godot {
  10. Image::Image()
  11. {
  12. godot_image_new(&_godot_image);
  13. }
  14. Image::Image(const int width, const int height, const bool mipmaps, const Format format)
  15. {
  16. godot_image_new_with_size_format(&_godot_image, width, height, mipmaps, (godot_image_format) format);
  17. }
  18. void Image::blit_rect(const Image& src, const Rect2& src_rect, const Vector2& dest)
  19. {
  20. // @DLScript @Todo
  21. }
  22. void Image::brush_transfer(const Image& src, const Image& brush, const Vector2& pos)
  23. {
  24. // @DLScript @Todo
  25. }
  26. Image Image::brushed(const Image& src, const Image& brush, const Vector2& pos)
  27. {
  28. return *this; // @DLScript @Todo
  29. }
  30. Image Image::compressed(const Format format)
  31. {
  32. return *this; // @DLScript @Todo
  33. }
  34. Image Image::converted(const Format format)
  35. {
  36. return *this; // @DLScript @Todo
  37. }
  38. Image Image::decompressed()
  39. {
  40. return *this; // @DLScript @Todo
  41. }
  42. bool Image::empty() const
  43. {
  44. return true; // @DLScript @Todo
  45. }
  46. void Image::fix_alpha_edges()
  47. {
  48. // @DLScript @Todo
  49. }
  50. PoolByteArray Image::get_data()
  51. {
  52. // @Todo
  53. return PoolByteArray();
  54. }
  55. Image::Format Image::get_format() const
  56. {
  57. return Format::FORMAT_RGBAH; // @DLScript @Todo
  58. }
  59. int Image::get_height() const
  60. {
  61. return godot_image_get_height(&_godot_image);
  62. }
  63. Color Image::get_pixel(const int x, const int y, const int mipmap_level)
  64. {
  65. return Color(); // @DLScript @Todo
  66. }
  67. Image Image::get_rect(const Rect2& area)
  68. {
  69. return *this; // @DLScript @Todo
  70. }
  71. Rect2 Image::get_used_rect() const
  72. {
  73. return Rect2(); // @DLScript @Todo
  74. }
  75. int Image::get_width() const
  76. {
  77. return godot_image_get_width(&_godot_image);
  78. }
  79. Error Image::load(const String& path)
  80. {
  81. return (Error) godot_image_load(&_godot_image, (godot_string *) &path);
  82. }
  83. void Image::put_pixel(const int x, const int y, const Color& color, int mipmap_level)
  84. {
  85. // @DLScript @Todo
  86. }
  87. Image Image::resized(const int x, const int y, const Interpolation interpolation)
  88. {
  89. return *this; // @DLScript @Todo
  90. }
  91. Error Image::save_png(const String& path)
  92. {
  93. return (Error) godot_image_save_png(&_godot_image, (godot_string *) &path); // @Todo Error enum
  94. }
  95. Image::~Image()
  96. {
  97. godot_image_destroy(&_godot_image);
  98. }
  99. }