DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.1KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DGL_VULKAN_HPP_INCLUDED
  17. #define DGL_VULKAN_HPP_INCLUDED
  18. #include "ImageBase.hpp"
  19. #include <vulkan/vulkan_core.h>
  20. START_NAMESPACE_DGL
  21. // --------------------------------------------------------------------------------------------------------------------
  22. /**
  23. Vulkan Graphics context.
  24. */
  25. struct VulkanGraphicsContext : GraphicsContext
  26. {
  27. };
  28. // --------------------------------------------------------------------------------------------------------------------
  29. /**
  30. Vulkan Image class.
  31. TODO ...
  32. */
  33. class VulkanImage : public ImageBase
  34. {
  35. public:
  36. /**
  37. Constructor for a null Image.
  38. */
  39. VulkanImage();
  40. /**
  41. Constructor using raw image data.
  42. @note @a rawData must remain valid for the lifetime of this Image.
  43. */
  44. VulkanImage(const char* rawData, uint width, uint height, ImageFormat format);
  45. /**
  46. Constructor using raw image data.
  47. @note @a rawData must remain valid for the lifetime of this Image.
  48. */
  49. VulkanImage(const char* rawData, const Size<uint>& size, ImageFormat format);
  50. /**
  51. Constructor using another image data.
  52. */
  53. VulkanImage(const VulkanImage& image);
  54. /**
  55. Destructor.
  56. */
  57. ~VulkanImage() override;
  58. /**
  59. Load image data from memory.
  60. @note @a rawData must remain valid for the lifetime of this Image.
  61. */
  62. void loadFromMemory(const char* rawData,
  63. const Size<uint>& size,
  64. ImageFormat format = kImageFormatBGRA) noexcept override;
  65. /**
  66. Draw this image at position @a pos using the graphics context @a context.
  67. */
  68. void drawAt(const GraphicsContext& context, const Point<int>& pos) override;
  69. /**
  70. TODO document this.
  71. */
  72. VulkanImage& operator=(const VulkanImage& image) noexcept;
  73. // FIXME this should not be needed
  74. inline void loadFromMemory(const char* rdata, uint w, uint h, ImageFormat fmt = kImageFormatBGRA)
  75. { loadFromMemory(rdata, Size<uint>(w, h), fmt); };
  76. inline void draw(const GraphicsContext& context)
  77. { drawAt(context, Point<int>(0, 0)); };
  78. inline void drawAt(const GraphicsContext& context, int x, int y)
  79. { drawAt(context, Point<int>(x, y)); };
  80. };
  81. // --------------------------------------------------------------------------------------------------------------------
  82. END_NAMESPACE_DGL
  83. #endif