| 1 | // Aseprite Render Library | 
|---|---|
| 2 | // Copyright (c) 2019 Igara Studio S.A. | 
| 3 | // Copyright (c) 2017 David Capello | 
| 4 | // | 
| 5 | // This file is released under the terms of the MIT license. | 
| 6 | // Read LICENSE.txt for more information. | 
| 7 | |
| 8 | #ifndef RENDER_DITHERING_H_INCLUDED | 
| 9 | #define RENDER_DITHERING_H_INCLUDED | 
| 10 | #pragma once | 
| 11 | |
| 12 | #include "render/dithering_algorithm.h" | 
| 13 | #include "render/dithering_matrix.h" | 
| 14 | |
| 15 | namespace render { | 
| 16 | |
| 17 | class Dithering { | 
| 18 | public: | 
| 19 | Dithering( | 
| 20 | DitheringAlgorithm algorithm = DitheringAlgorithm::None, | 
| 21 | const DitheringMatrix& matrix = DitheringMatrix(), | 
| 22 | double factor = 1.0) | 
| 23 | : m_algorithm(algorithm) | 
| 24 | , m_matrix(matrix) | 
| 25 | , m_factor(factor){ } | 
| 26 | |
| 27 | DitheringAlgorithm algorithm() const { return m_algorithm; } | 
| 28 | DitheringMatrix matrix() const { return m_matrix; } | 
| 29 | double factor() const { return m_factor; } | 
| 30 | |
| 31 | void algorithm(const DitheringAlgorithm algorithm) { m_algorithm = algorithm; } | 
| 32 | void matrix(const DitheringMatrix& matrix) { m_matrix = matrix; } | 
| 33 | void factor(const double factor) { m_factor = factor; } | 
| 34 | |
| 35 | private: | 
| 36 | DitheringAlgorithm m_algorithm; | 
| 37 | DitheringMatrix m_matrix; | 
| 38 | double m_factor; | 
| 39 | }; | 
| 40 | |
| 41 | } // namespace render | 
| 42 | |
| 43 | #endif | 
| 44 | 
