File indexing completed on 2024-12-22 04:16:04

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisGradientOption.h"
0007 
0008 #include <KisColorSmudgeStandardOptionData.h>
0009 #include <KoColor.h>
0010 #include <resources/KoAbstractGradient.h>
0011 
0012 #include <KisPaintOpOptionUtils.h>
0013 namespace kpou = KisPaintOpOptionUtils;
0014 
0015 
0016 KisGradientOption::KisGradientOption(const KisPropertiesConfiguration *setting)
0017     : KisCurveOption(kpou::loadOptionData<KisGradientOptionData>(setting))
0018 {
0019 }
0020 
0021 void KisGradientOption::apply(KoColor& color, const KoAbstractGradientSP gradient, const KisPaintInformation& info) const
0022 {
0023     if (isChecked() && gradient) {
0024         gradient->colorAt(color, computeSizeLikeValue(info));
0025     }
0026 }