Fix GIF and Overlay issues; Release NightShot v0.19
This commit is contained in:
1 parent
dfcbacfb0c
commit
ceb0b5552e
10 files changed
+528
-208
No files matched your search
+42
-11
@@ -2,26 +2,57 @@
|
||||
#include "config.hpp"
|
||||
#include <windows.h>
|
||||
|
||||
struct ScreenCapture {
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
struct ScreenCaptureSurface {
|
||||
HDC memoryDc = nullptr;
|
||||
HBITMAP bitmap = nullptr;
|
||||
HGDIOBJ oldBitmap = nullptr;
|
||||
void* pixels = nullptr;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
std::uint8_t* pixels = nullptr;
|
||||
RECT rect{}; // local coordinates inside the virtual-desktop window
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int stride = 0;
|
||||
|
||||
ScreenCapture() = default;
|
||||
ScreenCapture(const ScreenCapture&) = delete;
|
||||
ScreenCapture& operator=(const ScreenCapture&) = delete;
|
||||
ScreenCapture(ScreenCapture&& other) noexcept;
|
||||
ScreenCapture& operator=(ScreenCapture&& other) noexcept;
|
||||
~ScreenCapture();
|
||||
ScreenCaptureSurface() = default;
|
||||
ScreenCaptureSurface(const ScreenCaptureSurface&) = delete;
|
||||
ScreenCaptureSurface& operator=(const ScreenCaptureSurface&) = delete;
|
||||
ScreenCaptureSurface(ScreenCaptureSurface&& other) noexcept;
|
||||
ScreenCaptureSurface& operator=(ScreenCaptureSurface&& other) noexcept;
|
||||
~ScreenCaptureSurface();
|
||||
|
||||
[[nodiscard]] bool valid() const noexcept { return memoryDc && bitmap && width > 0 && height > 0; }
|
||||
[[nodiscard]] bool valid() const noexcept {
|
||||
return memoryDc && bitmap && pixels && width > 0 && height > 0;
|
||||
}
|
||||
void reset() noexcept;
|
||||
};
|
||||
|
||||
struct ScreenCapture {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
std::vector<ScreenCaptureSurface> surfaces;
|
||||
|
||||
ScreenCapture() = default;
|
||||
ScreenCapture(const ScreenCapture&) = delete;
|
||||
ScreenCapture& operator=(const ScreenCapture&) = delete;
|
||||
ScreenCapture(ScreenCapture&&) noexcept = default;
|
||||
ScreenCapture& operator=(ScreenCapture&&) noexcept = default;
|
||||
~ScreenCapture() = default;
|
||||
|
||||
[[nodiscard]] bool valid() const noexcept {
|
||||
return width > 0 && height > 0 && !surfaces.empty();
|
||||
}
|
||||
|
||||
// Copies a local virtual-desktop rectangle into destination. Empty space
|
||||
// between physically arranged monitors is filled with black instead of
|
||||
// forcing NightShot to keep one enormous bounding-box DIB in RAM.
|
||||
[[nodiscard]] bool blitTo(HDC destination, int destinationX, int destinationY,
|
||||
const RECT& sourceLocal) const noexcept;
|
||||
|
||||
[[nodiscard]] bool samplePixel(int localX, int localY, COLORREF& color) const noexcept;
|
||||
};
|
||||
|
||||
[[nodiscard]] ScreenCapture captureVirtualDesktop();
|
||||
Reference in new issue
Block a user