Porytiles
Loading...
Searching...
No Matches
palette_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <compare>
5#include <cstddef>
6#include <optional>
7#include <vector>
8
14
15namespace porytiles {
16
26 std::size_t source_group_index;
27 std::size_t palette_index;
28 std::size_t target_slot;
31
32 auto operator<=>(const PrefilledDestinationConflictDetail &) const = default;
33 bool operator==(const PrefilledDestinationConflictDetail &) const = default;
34};
35
45 std::size_t source_group_index;
46 std::size_t source_pal_index;
48 std::size_t ref_pal_index;
50
51 auto operator<=>(const PrefilledSourceConflictDetail &) const = default;
52 bool operator==(const PrefilledSourceConflictDetail &) const = default;
53};
54
64 std::size_t source_group_index;
65 std::size_t source_pal_index;
67 std::size_t source_final_slot;
68 std::size_t ref_pal_index;
70 std::size_t ref_final_slot;
71
72 auto operator<=>(const PostResolutionMismatchDetail &) const = default;
73 bool operator==(const PostResolutionMismatchDetail &) const = default;
74};
75
88 std::size_t source_group_index;
89 std::size_t source_pal_index;
96
97 auto operator<=>(const FirstWriterWinsDetail &) const = default;
98 bool operator==(const FirstWriterWinsDetail &) const = default;
99};
100
111 std::vector<PrefilledDestinationConflictDetail> prefilled_destination_conflict_details;
112 std::vector<PrefilledSourceConflictDetail> prefilled_source_conflict_details;
113 std::vector<FirstWriterWinsDetail> first_writer_wins_details;
114 std::vector<PostResolutionMismatchDetail> post_resolution_mismatch_details;
115
116 [[nodiscard]] std::size_t total() const
117 {
120 }
121};
122
177[[nodiscard]] std::array<std::optional<Palette<Rgba32, pal::max_size>>, pal::num_pals> build_all_output_palettes(
178 const std::vector<PackedPalette> &packed_pals,
179 const std::array<std::optional<Palette<Rgba32, pal::max_size>>, pal::num_pals> &prefilled_pals,
180 const ColorIndexMap<Rgba32> &color_map,
181 const Rgba32 &default_slot_zero,
182 const std::vector<IndirectLink> &indirect_links,
183 AlignmentFailureCounts *failure_counts = nullptr);
184
185} // namespace porytiles
Represents a 32-bit RGBA color.
Definition rgba32.hpp:23
constexpr std::size_t num_pals
Definition palette.hpp:21
std::array< std::optional< Palette< Rgba32, pal::max_size > >, pal::num_pals > build_all_output_palettes(const std::vector< PackedPalette > &packed_pals, const std::array< std::optional< Palette< Rgba32, pal::max_size > >, pal::num_pals > &prefilled_pals, const ColorIndexMap< Rgba32 > &color_map, const Rgba32 &default_slot_zero, const std::vector< IndirectLink > &indirect_links, AlignmentFailureCounts *failure_counts=nullptr)
Builds all output palettes from packed palettes and Indirect links in a single call.
Detailed records of alignment failures during Indirect link application and chain resolution.
std::vector< PrefilledDestinationConflictDetail > prefilled_destination_conflict_details
std::vector< PostResolutionMismatchDetail > post_resolution_mismatch_details
std::vector< PrefilledSourceConflictDetail > prefilled_source_conflict_details
std::vector< FirstWriterWinsDetail > first_writer_wins_details
Detail record for a single first-writer-wins conflict during Indirect link application.
bool operator==(const FirstWriterWinsDetail &) const =default
auto operator<=>(const FirstWriterWinsDetail &) const =default
Detail record for a post-resolution slot mismatch.
bool operator==(const PostResolutionMismatchDetail &) const =default
auto operator<=>(const PostResolutionMismatchDetail &) const =default
Detail record for a single prefilled destination conflict during Indirect chain resolution.
bool operator==(const PrefilledDestinationConflictDetail &) const =default
auto operator<=>(const PrefilledDestinationConflictDetail &) const =default
Detail record for a single prefilled source conflict during Indirect link application.
bool operator==(const PrefilledSourceConflictDetail &) const =default
auto operator<=>(const PrefilledSourceConflictDetail &) const =default