Dusk Audio Framework
Loading...
Searching...
No Matches
Vulkan.hpp
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
17#ifndef DGL_VULKAN_HPP_INCLUDED
18#define DGL_VULKAN_HPP_INCLUDED
19
20#include "ImageBase.hpp"
21
22#include <vulkan/vulkan_core.h>
23
24START_NAMESPACE_DGL
25
26// --------------------------------------------------------------------------------------------------------------------
27
28/**
29 Vulkan Graphics context.
30 */
34
35// --------------------------------------------------------------------------------------------------------------------
36
37/**
38 Vulkan Image class.
39
40 TODO ...
41 */
42class VulkanImage : public ImageBase
43{
44public:
45 /**
46 Constructor for a null Image.
47 */
49
50 /**
51 Constructor using raw image data.
52 @note @a rawData must remain valid for the lifetime of this Image.
53 */
54 VulkanImage(const char* rawData, uint width, uint height, ImageFormat format);
55
56 /**
57 Constructor using raw image data.
58 @note @a rawData must remain valid for the lifetime of this Image.
59 */
60 VulkanImage(const char* rawData, const Size<uint>& size, ImageFormat format);
61
62 /**
63 Constructor using another image data.
64 */
65 VulkanImage(const VulkanImage& image);
66
67 /**
68 Destructor.
69 */
70 ~VulkanImage() override;
71
72 /**
73 Load image data from memory.
74 @note @a rawData must remain valid for the lifetime of this Image.
75 */
76 void loadFromMemory(const char* rawData,
77 const Size<uint>& size,
78 ImageFormat format = kImageFormatBGRA) noexcept override;
79
80 /**
81 Draw this image at position @a pos using the graphics context @a context.
82 */
83 void drawAt(const GraphicsContext& context, const Point<int>& pos) override;
84
85 /**
86 TODO document this.
87 */
88 VulkanImage& operator=(const VulkanImage& image) noexcept;
89
90 // FIXME this should not be needed
91 inline void loadFromMemory(const char* rdata, uint w, uint h, ImageFormat fmt = kImageFormatBGRA)
92 { loadFromMemory(rdata, Size<uint>(w, h), fmt); };
93 inline void draw(const GraphicsContext& context)
94 { drawAt(context, Point<int>(0, 0)); };
95 inline void drawAt(const GraphicsContext& context, int x, int y)
96 { drawAt(context, Point<int>(x, y)); };
97};
98
99// --------------------------------------------------------------------------------------------------------------------
100
101END_NAMESPACE_DGL
102
103#endif
Definition Geometry.hpp:41
Definition Geometry.hpp:133
void drawAt(const GraphicsContext &context, const Point< int > &pos) override
~VulkanImage() override
VulkanImage(const VulkanImage &image)
VulkanImage & operator=(const VulkanImage &image) noexcept
VulkanImage(const char *rawData, uint width, uint height, ImageFormat format)
VulkanImage(const char *rawData, const Size< uint > &size, ImageFormat format)
void loadFromMemory(const char *rawData, const Size< uint > &size, ImageFormat format=kImageFormatBGRA) noexcept override
Definition Base.hpp:287
Definition Vulkan.hpp:32