Image.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Copyright (c) 2006-2020 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #pragma once
  21. // LOVE
  22. #include "graphics/Image.h"
  23. #include "graphics/Volatile.h"
  24. // OpenGL
  25. #include "OpenGL.h"
  26. namespace love
  27. {
  28. namespace graphics
  29. {
  30. namespace opengl
  31. {
  32. class Image final : public love::graphics::Image, public Volatile
  33. {
  34. public:
  35. Image(const Slices &data, const Settings &settings);
  36. Image(TextureType textype, PixelFormat format, int width, int height, int slices, const Settings &settings);
  37. virtual ~Image();
  38. // Implements Volatile.
  39. bool loadVolatile() override;
  40. void unloadVolatile() override;
  41. ptrdiff_t getHandle() const override;
  42. void setFilter(const Texture::Filter &f) override;
  43. bool setWrap(const Texture::Wrap &w) override;
  44. bool setMipmapSharpness(float sharpness) override;
  45. private:
  46. void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r) override;
  47. void generateMipmaps() override;
  48. void loadDefaultTexture();
  49. void loadData();
  50. // OpenGL texture identifier.
  51. GLuint texture;
  52. }; // Image
  53. } // opengl
  54. } // graphics
  55. } // love