File indexing completed on 2024-12-22 04:16:22
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Agata Cacko <cacko.azh@gmail.com> 0003 * SPDX-FileCopyrightText: 2008-2010 Lukáš Tvrdý <lukast.dev@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #include "KisSprayOpOption.h" 0008 #include <KisPaintOpOptionUtils.h> 0009 0010 namespace kpou = KisPaintOpOptionUtils; 0011 0012 KisSprayOpOption::KisSprayOpOption(const KisPropertiesConfiguration *setting) 0013 : KisSprayOpOption(kpou::loadOptionData<KisSprayOpOptionData>(setting)) 0014 { 0015 } 0016 0017 KisSprayOpOption::KisSprayOpOption(const KisSprayOpOptionData &_data) 0018 { 0019 data = _data; 0020 } 0021 0022 0023 void KisSprayOpOption::updateDistributions() 0024 { 0025 if (data.angularDistributionType == KisSprayOpOptionData::ParticleDistribution_CurveBased) { 0026 m_angularCurveBasedDistribution = KisSprayCurveBasedDistribution(data.angularDistributionCurve, data.angularDistributionCurveRepeat); 0027 } 0028 if (data.radialDistributionType == KisSprayOpOptionData::ParticleDistribution_Gaussian) { 0029 if (data.radialDistributionCenterBiased) { 0030 m_normalDistribution = KisSprayNormalDistribution(0.0, data.radialDistributionStdDeviation); 0031 } else { 0032 m_normalDistributionPolarDistance = KisSprayNormalDistributionPolarDistance(0.0, data.radialDistributionStdDeviation); 0033 } 0034 } else if (data.radialDistributionType == KisSprayOpOptionData::ParticleDistribution_ClusterBased) { 0035 m_clusterBasedDistributionPolarDistance = KisSprayClusterBasedDistributionPolarDistance(data.radialDistributionClusteringAmount); 0036 } else if (data.radialDistributionType == KisSprayOpOptionData::ParticleDistribution_CurveBased) { 0037 m_radialCurveBasedDistributionPolarDistance = KisSprayCurveBasedDistributionPolarDistance(data.radialDistributionCurve, data.radialDistributionCurveRepeat); 0038 } 0039 }