tomato/src/image_loader.hpp
Green Sky d5709c421c
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Failing after 4m26s
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 5m33s
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 5m29s
ContinuousIntegration / linux (push) Successful in 3m42s
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Failing after 5m8s
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Failing after 5m27s
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
add os inspector and minor stuff
2024-07-16 15:03:37 +02:00

44 lines
1020 B
C++

#pragma once
#include <cstdint>
#include <map>
#include <vector>
#include <string>
struct ImageLoaderI {
virtual ~ImageLoaderI(void) {}
struct ImageInfo final {
uint32_t width {0};
uint32_t height {0};
const char* file_ext {nullptr};
};
virtual ImageInfo loadInfoFromMemory(const uint8_t* data, uint64_t data_size) = 0;
struct ImageResult final {
uint32_t width {0};
uint32_t height {0};
struct Frame {
int32_t ms {0};
std::vector<uint8_t> data;
};
std::vector<Frame> frames;
const char* file_ext {nullptr};
// only positive values are valid
ImageResult crop(int32_t c_x, int32_t c_y, int32_t c_w, int32_t c_h) const;
// TODO: scale
};
virtual ImageResult loadFromMemoryRGBA(const uint8_t* data, uint64_t data_size) = 0;
};
struct ImageEncoderI {
virtual ~ImageEncoderI(void) {}
using ImageResult = ImageLoaderI::ImageResult;
virtual std::vector<uint8_t> encodeToMemoryRGBA(const ImageResult& input_image, const std::map<std::string, float>& extra_options = {}) = 0;
};