Files
Renderive/web_server/Pixel_Frame.h
T
2026-08-11 13:49:53 +08:00

22 lines
795 B
C++

#pragma once
#include "render_2D/base/Types.h"
#include <cstddef>
#include <string>
#include <vector>
namespace renderive::web {
inline constexpr std::size_t pixel_frame_header_size = 16;
struct Pixel_Frame_Copy {
int width{};
int height{};
std::vector<Pixel> pixels;
[[nodiscard]] bool empty() const noexcept {
return width <= 0 || height <= 0 || pixels.empty();
}
};
[[nodiscard]] Pixel_Frame_Copy copy_pixel_frame(Image_View image);
[[nodiscard]] std::string encode_pixel_frame(Image_View image,
Color background = Color::black());
[[nodiscard]] std::string encode_pixel_frame(const Pixel_Frame_Copy& image,
Color background = Color::black());
} // namespace renderive::web