Loading...
Searching...
No Matches
ScreenSource.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
3
4#pragma once
5#ifndef MALENA_SCREEN_SOURCE_H
6#define MALENA_SCREEN_SOURCE_H
7
10#include <cstdint>
11#include <memory>
12#include <optional>
13#include <string>
14#include <vector>
15
16namespace ml {
17
39{
40public:
43
44 ScreenSource(const ScreenSource&) = delete;
46
48 void setDisplayIndex(int index);
49 int displayIndex() const;
50
56 void setMaxDimension(unsigned int pixels);
57
59 std::optional<sf::Image> grab();
60
62 static bool isSupported();
63
65 const std::string& lastError() const;
66
71 static std::optional<std::vector<std::uint8_t>> encodeJpeg(const sf::Image& frame);
72
74 static std::optional<sf::Image> decode(const std::uint8_t* data, std::size_t size);
75
76private:
77 struct Impl;
78 std::unique_ptr<Impl> _impl;
79};
80
81} // namespace ml
82
83#endif // MALENA_SCREEN_SOURCE_H
static std::optional< sf::Image > decode(const std::uint8_t *data, std::size_t size)
int displayIndex() const
ScreenSource & operator=(const ScreenSource &)=delete
const std::string & lastError() const
void setMaxDimension(unsigned int pixels)
static std::optional< std::vector< std::uint8_t > > encodeJpeg(const sf::Image &frame)
std::optional< sf::Image > grab()
void setDisplayIndex(int index)
static bool isSupported()
ScreenSource(const ScreenSource &)=delete
#define MALENA_API
Definition Animate.h:25