CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
heic_settings.h
Go to the documentation of this file.
1
25#pragma once
26
27#include <string>
28
30
34namespace Heic {
35
36// ═══════════════════════════════════════════════════════════════════════════════
37// ENUMERATIONS FOR HEIF SETTINGS
38// ═══════════════════════════════════════════════════════════════════════════════
39
54enum class AlphaMode : std::uint8_t {
57};
58
59// ═══════════════════════════════════════════════════════════════════════════════
60// HEIF SETTINGS STRUCTURE (INPUT ONLY)
61// ═══════════════════════════════════════════════════════════════════════════════
62
92
93 // ═════════════════════════════════════════════════════════════════════════
94 // INPUT SETTINGS (used by SourceManager)
95 // ═════════════════════════════════════════════════════════════════════════
96
97private:
114 bool m_reorient{true};
115
133 AlphaMode m_alpha_mode{AlphaMode::premultiply};
134
135public:
140 [[nodiscard]] constexpr bool get_reorient() const noexcept { return m_reorient; }
141
147 constexpr void set_reorient(bool reorient) noexcept { m_reorient = reorient; }
148
153 [[nodiscard]] constexpr int get_reorient_value() const noexcept {
154 return m_reorient ? 1 : 0;
155 }
156
161 [[nodiscard]] constexpr AlphaMode get_alpha_mode() const noexcept { return m_alpha_mode; }
162
167 constexpr void set_alpha_mode(AlphaMode mode) noexcept { m_alpha_mode = mode; }
168
173 [[nodiscard]] constexpr int get_unassociated_alpha_value() const noexcept {
174 return (m_alpha_mode == AlphaMode::unassociated) ? 1 : 0;
175 }
176
177 // ═════════════════════════════════════════════════════════════════════════
178 // PRESET FACTORY METHODS
179 // ═════════════════════════════════════════════════════════════════════════
180
194 [[nodiscard]] static constexpr HeicSettings fast_settings() noexcept {
195 HeicSettings settings;
196 settings.m_reorient = false;
197 settings.m_alpha_mode = AlphaMode::premultiply;
198 return settings;
199 }
200
213 [[nodiscard]] static constexpr HeicSettings default_settings() noexcept {
214 return HeicSettings{};
215 }
216
217 // ═════════════════════════════════════════════════════════════════════════
218 // UTILITY METHODS
219 // ═════════════════════════════════════════════════════════════════════════
220
224 void reset_to_defaults() noexcept {
225 *this = HeicSettings{};
226 }
227};
228
229} // namespace Heic
230
231} // namespace CaptureMoment::Core::ImageConfig
AlphaMode
Controls how unassociated alpha channels are handled during reading.
@ unassociated
Leave alpha unassociated. Preserve original color values without modification.
@ premultiply
Default OIIO behavior: premultiply color channels by alpha if unassociated.
Input configuration for HEIF/HEIC/AVIF image loading via OIIO/libheif.
constexpr int get_reorient_value() const noexcept
Gets the reorient value as integer (for OIIO attribute).
constexpr void set_reorient(bool reorient) noexcept
Enables or disables automatic reorientation.
constexpr bool get_reorient() const noexcept
Checks if automatic reorientation is enabled.
constexpr void set_alpha_mode(AlphaMode mode) noexcept
Sets the alpha handling mode.
void reset_to_defaults() noexcept
Resets all settings to their default values.
static constexpr HeicSettings default_settings() noexcept
Creates a HeicSettings with default values.
constexpr int get_unassociated_alpha_value() const noexcept
Gets the unassociated alpha value as integer (for OIIO attribute).
constexpr AlphaMode get_alpha_mode() const noexcept
Gets the alpha handling mode.
static constexpr HeicSettings fast_settings() noexcept
Creates a HeicSettings configured for maximum processing speed.
CaptureMoment — footer