2017-05-24 07:41:30 +08:00
|
|
|
// Aseprite Render Library
|
2019-04-02 08:44:06 +08:00
|
|
|
// Copyright (c) 2019 Igara Studio S.A.
|
2017-05-24 07:41:30 +08:00
|
|
|
// Copyright (c) 2017 David Capello
|
|
|
|
//
|
|
|
|
// This file is released under the terms of the MIT license.
|
|
|
|
// Read LICENSE.txt for more information.
|
|
|
|
|
|
|
|
#ifndef RENDER_DITHERING_H_INCLUDED
|
|
|
|
#define RENDER_DITHERING_H_INCLUDED
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "render/dithering_algorithm.h"
|
|
|
|
#include "render/dithering_matrix.h"
|
2019-04-04 06:32:24 +08:00
|
|
|
|
|
|
|
namespace render {
|
|
|
|
|
|
|
|
class Dithering {
|
|
|
|
public:
|
|
|
|
Dithering(DitheringAlgorithm algorithm = DitheringAlgorithm::None,
|
|
|
|
const DitheringMatrix& matrix = DitheringMatrix(),
|
2025-06-12 22:25:20 +08:00
|
|
|
bool zigzag = true,
|
2019-04-04 06:32:24 +08:00
|
|
|
double factor = 1.0)
|
|
|
|
: m_algorithm(algorithm)
|
|
|
|
, m_matrix(matrix)
|
2025-06-12 22:25:20 +08:00
|
|
|
, m_zigzag(zigzag)
|
2019-04-04 06:32:24 +08:00
|
|
|
, m_factor(factor)
|
|
|
|
{
|
|
|
|
}
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2019-04-04 06:32:24 +08:00
|
|
|
DitheringAlgorithm algorithm() const { return m_algorithm; }
|
|
|
|
DitheringMatrix matrix() const { return m_matrix; }
|
2025-06-12 22:25:20 +08:00
|
|
|
bool zigzag() const { return m_zigzag; }
|
2019-04-04 06:32:24 +08:00
|
|
|
double factor() const { return m_factor; }
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2019-04-04 06:32:24 +08:00
|
|
|
void algorithm(const DitheringAlgorithm algorithm) { m_algorithm = algorithm; }
|
|
|
|
void matrix(const DitheringMatrix& matrix) { m_matrix = matrix; }
|
2025-06-12 22:25:20 +08:00
|
|
|
void zigzag(bool zigzag) { m_zigzag = zigzag; }
|
2019-04-04 06:32:24 +08:00
|
|
|
void factor(const double factor) { m_factor = factor; }
|
2024-12-17 01:52:19 +08:00
|
|
|
|
2019-04-04 06:32:24 +08:00
|
|
|
private:
|
|
|
|
DitheringAlgorithm m_algorithm;
|
|
|
|
DitheringMatrix m_matrix;
|
2025-06-12 22:25:20 +08:00
|
|
|
bool m_zigzag;
|
2019-04-04 06:32:24 +08:00
|
|
|
double m_factor;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace render
|
2017-05-24 07:41:30 +08:00
|
|
|
|
|
|
|
#endif
|