Add PPI header recognition tests
This commit is contained in:
40
src/assets/ppi_header.h
Normal file
40
src/assets/ppi_header.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "foundation/result.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <span>
|
||||
|
||||
namespace pp::assets {
|
||||
|
||||
constexpr std::size_t ppi_header_size = 40;
|
||||
|
||||
struct PpiVersion {
|
||||
std::uint32_t major = 0;
|
||||
std::uint32_t minor = 0;
|
||||
};
|
||||
|
||||
struct PpiSoftwareVersion {
|
||||
std::uint32_t major = 0;
|
||||
std::uint32_t minor = 0;
|
||||
std::uint32_t fix = 0;
|
||||
std::uint32_t build = 0;
|
||||
};
|
||||
|
||||
struct PpiThumbnailInfo {
|
||||
std::uint32_t width = 0;
|
||||
std::uint32_t height = 0;
|
||||
std::uint32_t components = 0;
|
||||
};
|
||||
|
||||
struct PpiHeaderInfo {
|
||||
PpiVersion document_version;
|
||||
PpiSoftwareVersion software_version;
|
||||
PpiThumbnailInfo thumbnail;
|
||||
};
|
||||
|
||||
[[nodiscard]] pp::foundation::Result<PpiHeaderInfo> parse_ppi_header(
|
||||
std::span<const std::byte> bytes) noexcept;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user