Blender V4.5
COM_symmetric_blur_weights.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <cstdint>
8#include <memory>
9
10#include "BLI_array.hh"
11#include "BLI_map.hh"
13
15#include "COM_result.hh"
16
17namespace blender::compositor {
18
19class Context;
20
21/* ------------------------------------------------------------------------------------------------
22 * Symmetric Blur Weights Key.
23 */
25 public:
26 int type;
28
30
31 uint64_t hash() const;
32};
33
35
36/* -------------------------------------------------------------------------------------------------
37 * Symmetric Blur Weights.
38 *
39 * A cached resource that computes and caches a result containing the weights of the filter of the
40 * given type and radius. The filter is assumed to be symmetric, because the filter functions are
41 * evaluated on the normalized distance to the center. Consequently, only the upper right quadrant
42 * are computed and the user takes that into consideration. */
44 private:
45 Array<float> weights_;
46
47 public:
49
50 SymmetricBlurWeights(Context &context, int type, float2 radius);
51
53};
54
55/* ------------------------------------------------------------------------------------------------
56 * Symmetric Blur Weights Container.
57 */
59 private:
61
62 public:
63 void reset() override;
64
65 /* Check if there is an available SymmetricBlurWeights cached resource with the given parameters
66 * in the container, if one exists, return it, otherwise, return a newly created one and add it
67 * to the container. In both cases, tag the cached resource as needed to keep it cached for the
68 * next evaluation. */
69 Result &get(Context &context, int type, float2 radius);
70};
71
72} // namespace blender::compositor
unsigned long long int uint64_t
Result & get(Context &context, int type, float2 radius)
SymmetricBlurWeights(Context &context, int type, float2 radius)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
VecBase< float, 2 > float2