Krita Source Code Documentation
Loading...
Searching...
No Matches
KoAlphaMaskApplicatorFactory.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
10#include <kis_assert.h>
11
13
14template <typename channels_type>
16{
17 KoAlphaMaskApplicatorBase *operator() (int numChannels, int alphaPos) {
18 if (numChannels == 4) {
19 KIS_ASSERT(alphaPos == 3);
22 } else if (numChannels == 5) {
23 KIS_ASSERT(alphaPos == 4);
26 } else if (numChannels == 2) {
27 KIS_ASSERT(alphaPos == 1);
30 } else if (numChannels == 1) {
31 KIS_ASSERT(alphaPos == 0);
34 } else {
35 KIS_ASSERT(0);
36 }
37
38 return 0;
39 }
40};
41
43{
44 return channelTypeForColorDepthId<CreateApplicator>(depthId, numChannels, alphaPos);
45}
auto createOptimizedClass(Args &&...param)
static KoAlphaMaskApplicatorBase * create(KoID depthId, int numChannels, int alphaPos)
Definition KoID.h:30
#define KIS_ASSERT(cond)
Definition kis_assert.h:33
KoAlphaMaskApplicatorBase * operator()(int numChannels, int alphaPos)