diff --git a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.cpp b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.cpp index 0531e150cd..12236acd15 100644 --- a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.cpp +++ b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.cpp @@ -1,94 +1,99 @@ /* This file is part of the KDE project * Copyright (c) 2010 Cyrille Berger * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_multipliers_double_slider_spinbox.h" #include "kis_multipliers_double_slider_spinbox_p.h" #include "ui_wdgmultipliersdoublesliderspinbox.h" #include "kis_debug.h" qreal KisMultipliersDoubleSliderSpinBox::Private::currentMultiplier() { return form.comboBox->itemData(form.comboBox->currentIndex()).toDouble(); } void KisMultipliersDoubleSliderSpinBox::Private::updateRange() { qreal m = currentMultiplier(); form.sliderSpinBox->setRange(m * min, m * max, decimals); } KisMultipliersDoubleSliderSpinBox::KisMultipliersDoubleSliderSpinBox(QWidget* _parent) : QWidget(_parent) , d(new Private) { d->form.setupUi(this); addMultiplier(1.0); connect(d->form.sliderSpinBox, SIGNAL(valueChanged(qreal)), SIGNAL(valueChanged(qreal))); connect(d->form.comboBox, SIGNAL(activated(int)), SLOT(updateRange())); } KisMultipliersDoubleSliderSpinBox::~KisMultipliersDoubleSliderSpinBox() { delete d; } void KisMultipliersDoubleSliderSpinBox::addMultiplier(double v) { d->form.comboBox->addItem(i18n("x%1", v), v); } void KisMultipliersDoubleSliderSpinBox::setRange(qreal minimum, qreal maximum, int decimals) { d->min = minimum; d->max = maximum; d->decimals = decimals; d->updateRange(); } +void KisMultipliersDoubleSliderSpinBox::setPrefix(QString prefixText) +{ + d->form.sliderSpinBox->setPrefix(prefixText); +} + qreal KisMultipliersDoubleSliderSpinBox::value() { return d->form.sliderSpinBox->value(); } void KisMultipliersDoubleSliderSpinBox::setValue(qreal value) { qreal m = d->currentMultiplier(); if (value < m * d->min || value > m * d->max) { for(int i = 0; i < d->form.comboBox->count(); ++i) { qreal m = d->form.comboBox->itemData(i).toDouble(); if (value >= m * d->min && value <= m * d->max) { d->form.comboBox->setCurrentIndex(i); d->updateRange(); break; } } } d->form.sliderSpinBox->setValue(value); } void KisMultipliersDoubleSliderSpinBox::setExponentRatio(qreal dbl) { d->form.sliderSpinBox->setExponentRatio(dbl); } #include "moc_kis_multipliers_double_slider_spinbox.cpp" diff --git a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h index 870fd2fb9a..2aab8c4eee 100644 --- a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h +++ b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h @@ -1,60 +1,63 @@ /* This file is part of the KDE project * Copyright (c) 2010 Cyrille Berger * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _KIS_MULTIPLIERS_DOUBLE_SLIDER_SPINBOX_H_ #define _KIS_MULTIPLIERS_DOUBLE_SLIDER_SPINBOX_H_ #include #include /** * This class add a combobox to a \ref KisDoubleSliderSpinBox which * allows to define a multiplier to let the user change the range. */ class KRITAUI_EXPORT KisMultipliersDoubleSliderSpinBox : public QWidget { Q_OBJECT public: KisMultipliersDoubleSliderSpinBox(QWidget* _parent = 0); ~KisMultipliersDoubleSliderSpinBox() override; void addMultiplier(double v); /** * Set the range for the 1.0 multiplier */ void setRange(qreal minimum, qreal maximum, int decimals = 0); + /// Set Prefix that goes inside of slider + void setPrefix(QString prefixText); + ///Get the value, don't use value() qreal value(); ///Set the value, don't use setValue() void setValue(qreal value); void setExponentRatio(qreal dbl); Q_SIGNALS: void valueChanged(qreal value); private: Q_PRIVATE_SLOT(d, void updateRange()) struct Private; Private* const d; }; #endif diff --git a/plugins/paintops/libpaintop/forms/wdgtexturechooser.ui b/plugins/paintops/libpaintop/forms/wdgtexturechooser.ui index 9ca9aa5cd8..75ef6dd9e0 100644 --- a/plugins/paintops/libpaintop/forms/wdgtexturechooser.ui +++ b/plugins/paintops/libpaintop/forms/wdgtexturechooser.ui @@ -1,291 +1,318 @@ KisWdgTextureChooser 0 0 - 377 - 409 + 284 + 388 0 0 - - + + 0 0 1 Texture 0 0 + + + 0 + 100 + + + + + 16777215 + 260 + + QFrame::StyledPanel QFrame::Plain 0 + + + + Qt::Vertical + + + + 20 + 40 + + + + Options - - - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Cutoff - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 20 - - - - - - - - - 0 - 0 - - - - Cutoff Policy: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + + 0 0 - Texturing Mode: + Blending Mode: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - 0 - 0 - - - - - + 0 0 - - + + + + + + + 20 + 20 + + + + + + + + + 20 + 20 + + + + + + + + + 0 + 20 + + + + + + + + 0 0 - Scale: + Cutoff: - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - PushButton + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - + + - + 0 0 - - Random - - - - - - - - - - Random - - - - - - - Qt::Vertical - - - - 5 - 5 - - - - - - - - The border of the brush will be smoothed to avoid aliasing - - - Invert Pattern - - - - - - - Offset - + + + + + 20 + 20 + + + + PushButton + + + + + + + Offset + + + + + + + 0 + 0 + + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + + 20 + 20 + + + + + + + + Random + + + + + + + + 0 + 0 + + + + Random + + + + + + + + + + The border of the brush will be smoothed to avoid aliasing + + + Invert Pattern + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + KisDoubleSliderSpinBox QWidget
kis_slider_spin_box.h
1
KisSliderSpinBox QWidget
kis_slider_spin_box.h
1
KisPatternChooser QFrame
kis_pattern_chooser.h
1
KisGradientSlider QWidget
KisGradientSlider.h
1
KisMultipliersDoubleSliderSpinBox QWidget
kis_multipliers_double_slider_spinbox.h
1
diff --git a/plugins/paintops/libpaintop/kis_texture_chooser.cpp b/plugins/paintops/libpaintop/kis_texture_chooser.cpp index 47696ed7db..6873a090c0 100644 --- a/plugins/paintops/libpaintop/kis_texture_chooser.cpp +++ b/plugins/paintops/libpaintop/kis_texture_chooser.cpp @@ -1,74 +1,75 @@ /* * Copyright (c) 2017 Scott Petrovic * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_texture_chooser.h" #include "kis_texture_option.h" KisTextureChooser::KisTextureChooser(QWidget *parent) : QWidget(parent) { setupUi(this); textureSelectorWidget->setGrayscalePreview(true); textureSelectorWidget->setCurrentItem(0, 0); + scaleSlider->setPrefix(i18n("Scale: ")); scaleSlider->setRange(0.0, 2.0, 2); scaleSlider->setValue(1.0); scaleSlider->addMultiplier(0.1); scaleSlider->addMultiplier(2); scaleSlider->addMultiplier(10); brightnessSlider->setPrefix(i18n("Brightness: ")); brightnessSlider->setRange(-1.0, 1.0, 2); brightnessSlider->setValue(0.0); brightnessSlider->setToolTip(i18n("Makes texture lighter or darker")); contrastSlider->setPrefix(i18n("Contrast: ")); contrastSlider->setRange(0.0, 2.0, 2); contrastSlider->setValue(1.0); offsetSliderX->setPrefix(i18n("Horizontal: ")); offsetSliderX->setSuffix(i18n(" px")); offsetSliderY->setPrefix(i18n("Vertical: ")); offsetSliderY->setSuffix(i18n(" px")); QStringList texturingModes; texturingModes << i18n("Multiply") << i18n("Subtract"); cmbTexturingMode->addItems(texturingModes); cmbTexturingMode->setCurrentIndex(KisTextureProperties::SUBTRACT); QStringList cutOffPolicies; - cutOffPolicies << i18n("Cut Off Disabled") << i18n("Cut Off Brush") << i18n("Cut Off Pattern"); + cutOffPolicies << i18n("Disabled") << i18n("Brush") << i18n("Pattern"); cmbCutoffPolicy->addItems(cutOffPolicies); cutoffSlider->setMinimumSize(20, 30); cutoffSlider->enableGamma(false); cutoffSlider->setToolTip(i18n("When pattern texture values are outside the range specified" " by the slider, the cut-off policy will be applied.")); chkInvert->setChecked(false); } KisTextureChooser::~KisTextureChooser() { } diff --git a/plugins/paintops/libpaintop/kis_texture_option.cpp b/plugins/paintops/libpaintop/kis_texture_option.cpp index 4a851c23a8..b10caeb235 100644 --- a/plugins/paintops/libpaintop/kis_texture_option.cpp +++ b/plugins/paintops/libpaintop/kis_texture_option.cpp @@ -1,273 +1,289 @@ /* This file is part of the KDE project * Copyright (C) Boudewijn Rempt , (C) 2012 * Copyright (C) Mohit Goyal , (C) 2014 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_texture_option.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kis_embedded_pattern_manager.h" #include #include "kis_texture_chooser.h" #include KisTextureOption::KisTextureOption() : KisPaintOpOption(KisPaintOpOption::TEXTURE, true) , m_textureOptions(new KisTextureChooser()) { setObjectName("KisTextureOption"); setConfigurationPage(m_textureOptions); connect(m_textureOptions->textureSelectorWidget, SIGNAL(resourceSelected(KoResource*)), SLOT(resetGUI(KoResource*))); connect(m_textureOptions->textureSelectorWidget, SIGNAL(resourceSelected(KoResource*)), SLOT(emitSettingChanged())); connect(m_textureOptions->scaleSlider, SIGNAL(valueChanged(qreal)), SLOT(emitSettingChanged())); connect(m_textureOptions->brightnessSlider, SIGNAL(valueChanged(qreal)), SLOT(emitSettingChanged())); connect(m_textureOptions->contrastSlider, SIGNAL(valueChanged(qreal)), SLOT(emitSettingChanged())); connect(m_textureOptions->offsetSliderX, SIGNAL(valueChanged(int)), SLOT(emitSettingChanged())); connect(m_textureOptions->randomOffsetX, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); connect(m_textureOptions->randomOffsetY, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); connect(m_textureOptions->offsetSliderY, SIGNAL(valueChanged(int)), SLOT(emitSettingChanged())); connect(m_textureOptions->cmbTexturingMode, SIGNAL(currentIndexChanged(int)), SLOT(emitSettingChanged())); - connect(m_textureOptions->cmbCutoffPolicy, SIGNAL(currentIndexChanged(int)), SLOT(emitSettingChanged())); connect(m_textureOptions->cutoffSlider, SIGNAL(sigModifiedBlack(int)), SLOT(emitSettingChanged())); connect(m_textureOptions->cutoffSlider, SIGNAL(sigModifiedWhite(int)), SLOT(emitSettingChanged())); connect(m_textureOptions->chkInvert, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); - resetGUI(m_textureOptions->textureSelectorWidget->currentResource()); + connect(m_textureOptions->cmbCutoffPolicy, SIGNAL(currentIndexChanged(int)), SLOT(setCutoffPolicy(int))); + + resetGUI(m_textureOptions->textureSelectorWidget->currentResource()); } KisTextureOption::~KisTextureOption() { delete m_textureOptions; } void KisTextureOption::writeOptionSetting(KisPropertiesConfigurationSP setting) const { m_textureOptions->textureSelectorWidget->blockSignals(true); // Checking if (!m_textureOptions->textureSelectorWidget->currentResource()) return; KoPattern *pattern = static_cast(m_textureOptions->textureSelectorWidget->currentResource()); m_textureOptions->textureSelectorWidget->blockSignals(false); // Checking if (!pattern) return; setting->setProperty("Texture/Pattern/Enabled", isChecked()); if (!isChecked()) { return; } qreal scale = m_textureOptions->scaleSlider->value(); qreal brightness = m_textureOptions->brightnessSlider->value(); qreal contrast = m_textureOptions->contrastSlider->value(); int offsetX = m_textureOptions->offsetSliderX->value(); if (m_textureOptions ->randomOffsetX->isChecked()) { m_textureOptions->offsetSliderX ->setEnabled(false); m_textureOptions->offsetSliderX ->blockSignals(true); m_textureOptions->offsetSliderX ->setValue(offsetX); m_textureOptions->offsetSliderX ->blockSignals(false); } else { m_textureOptions->offsetSliderX ->setEnabled(true); } int offsetY = m_textureOptions->offsetSliderY->value(); if (m_textureOptions ->randomOffsetY->isChecked()) { m_textureOptions->offsetSliderY ->setEnabled(false); m_textureOptions->offsetSliderY ->blockSignals(true); m_textureOptions->offsetSliderY ->setValue(offsetY); m_textureOptions->offsetSliderY ->blockSignals(false); } else { m_textureOptions->offsetSliderY ->setEnabled(true); } int texturingMode = m_textureOptions->cmbTexturingMode->currentIndex(); bool invert = (m_textureOptions->chkInvert->checkState() == Qt::Checked); setting->setProperty("Texture/Pattern/Scale", scale); setting->setProperty("Texture/Pattern/Brightness", brightness); setting->setProperty("Texture/Pattern/Contrast", contrast); setting->setProperty("Texture/Pattern/OffsetX", offsetX); setting->setProperty("Texture/Pattern/OffsetY", offsetY); setting->setProperty("Texture/Pattern/TexturingMode", texturingMode); setting->setProperty("Texture/Pattern/CutoffLeft", m_textureOptions->cutoffSlider->black()); setting->setProperty("Texture/Pattern/CutoffRight", m_textureOptions->cutoffSlider->white()); setting->setProperty("Texture/Pattern/CutoffPolicy", m_textureOptions->cmbCutoffPolicy->currentIndex()); setting->setProperty("Texture/Pattern/Invert", invert); setting->setProperty("Texture/Pattern/MaximumOffsetX",m_textureOptions->offsetSliderX ->maximum()); setting->setProperty("Texture/Pattern/MaximumOffsetY",m_textureOptions->offsetSliderY ->maximum()); setting->setProperty("Texture/Pattern/isRandomOffsetX",m_textureOptions ->randomOffsetX ->isChecked()); setting->setProperty("Texture/Pattern/isRandomOffsetY",m_textureOptions ->randomOffsetY ->isChecked()); KisEmbeddedPatternManager::saveEmbeddedPattern(setting, pattern); } void KisTextureOption::readOptionSetting(const KisPropertiesConfigurationSP setting) { setChecked(setting->getBool("Texture/Pattern/Enabled")); if (!isChecked()) { return; } KoPattern *pattern = KisEmbeddedPatternManager::loadEmbeddedPattern(setting); if (!pattern) { pattern = static_cast(m_textureOptions->textureSelectorWidget->currentResource()); } m_textureOptions->textureSelectorWidget->setCurrentPattern(pattern); m_textureOptions->scaleSlider->setValue(setting->getDouble("Texture/Pattern/Scale", 1.0)); m_textureOptions->brightnessSlider->setValue(setting->getDouble("Texture/Pattern/Brightness")); m_textureOptions->contrastSlider->setValue(setting->getDouble("Texture/Pattern/Contrast", 1.0)); m_textureOptions->offsetSliderX->setValue(setting->getInt("Texture/Pattern/OffsetX")); m_textureOptions->offsetSliderY->setValue(setting->getInt("Texture/Pattern/OffsetY")); m_textureOptions->randomOffsetX->setChecked(setting->getBool("Texture/Pattern/isRandomOffsetX")); m_textureOptions->randomOffsetY->setChecked(setting->getBool("Texture/Pattern/isRandomOffsetY")); m_textureOptions->cmbTexturingMode->setCurrentIndex(setting->getInt("Texture/Pattern/TexturingMode", KisTextureProperties::MULTIPLY)); m_textureOptions->cmbCutoffPolicy->setCurrentIndex(setting->getInt("Texture/Pattern/CutoffPolicy")); m_textureOptions->cutoffSlider->slotModifyBlack(setting->getInt("Texture/Pattern/CutoffLeft", 0)); m_textureOptions->cutoffSlider->slotModifyWhite(setting->getInt("Texture/Pattern/CutoffRight", 255)); m_textureOptions->chkInvert->setChecked(setting->getBool("Texture/Pattern/Invert")); + setCutoffPolicy(setting->getInt("Texture/Pattern/CutoffPolicy")); + + } void KisTextureOption::lodLimitations(KisPaintopLodLimitations *l) const { l->limitations << KoID("texture-pattern", i18nc("PaintOp instant preview limitation", "Texture->Pattern (low quality preview)")); } void KisTextureOption::resetGUI(KoResource* res) { KoPattern *pattern = static_cast(res); if (!pattern) return; m_textureOptions->offsetSliderX->setRange(0, pattern->pattern().width() / 2); m_textureOptions->offsetSliderY->setRange(0, pattern->pattern().height() / 2); } +void KisTextureOption::setCutoffPolicy(int index) +{ + qDebug() << "changing cutoff slider"; + if (index == 0) { + m_textureOptions->cutoffSlider->setVisible(false); + } else { + m_textureOptions->cutoffSlider->setVisible(true); + } + + emitSettingChanged(); +} + /**********************************************************************/ /* KisTextureProperties */ /**********************************************************************/ KisTextureProperties::KisTextureProperties(int levelOfDetail) : m_levelOfDetail(levelOfDetail) { } void KisTextureProperties::fillProperties(const KisPropertiesConfigurationSP setting) { if (!setting->hasProperty("Texture/Pattern/PatternMD5")) { m_enabled = false; return; } m_maskInfo = toQShared(new KisTextureMaskInfo(m_levelOfDetail)); if (!m_maskInfo->fillProperties(setting)) { warnKrita << "WARNING: Couldn't load the pattern for a stroke"; m_enabled = false; return; } m_maskInfo = KisTextureMaskInfoCache::instance()->fetchCachedTextureInfo(m_maskInfo); m_enabled = setting->getBool("Texture/Pattern/Enabled", false); m_offsetX = setting->getInt("Texture/Pattern/OffsetX"); m_offsetY = setting->getInt("Texture/Pattern/OffsetY"); m_texturingMode = (TexturingMode) setting->getInt("Texture/Pattern/TexturingMode", MULTIPLY); m_strengthOption.readOptionSetting(setting); m_strengthOption.resetAllSensors(); } void KisTextureProperties::apply(KisFixedPaintDeviceSP dab, const QPoint &offset, const KisPaintInformation & info) { if (!m_enabled) return; KisPaintDeviceSP fillDevice = new KisPaintDevice(KoColorSpaceRegistry::instance()->alpha8()); QRect rect = dab->bounds(); KisPaintDeviceSP mask = m_maskInfo->mask(); const QRect maskBounds = m_maskInfo->maskBounds(); KIS_SAFE_ASSERT_RECOVER_RETURN(mask); int x = offset.x() % maskBounds.width() - m_offsetX; int y = offset.y() % maskBounds.height() - m_offsetY; KisFillPainter fillPainter(fillDevice); fillPainter.fillRect(x - 1, y - 1, rect.width() + 2, rect.height() + 2, mask, maskBounds); fillPainter.end(); qreal pressure = m_strengthOption.apply(info); quint8 *dabData = dab->data(); KisHLineIteratorSP iter = fillDevice->createHLineIteratorNG(x, y, rect.width()); for (int row = 0; row < rect.height(); ++row) { for (int col = 0; col < rect.width(); ++col) { if (m_texturingMode == MULTIPLY) { dab->colorSpace()->multiplyAlpha(dabData, quint8(*iter->oldRawData() * pressure), 1); } else { int pressureOffset = (1.0 - pressure) * 255; qint16 maskA = *iter->oldRawData() + pressureOffset; quint8 dabA = dab->colorSpace()->opacityU8(dabData); dabA = qMax(0, (qint16)dabA - maskA); dab->colorSpace()->setOpacity(dabData, dabA, 1); } iter->nextPixel(); dabData += dab->pixelSize(); } iter->nextRow(); } } diff --git a/plugins/paintops/libpaintop/kis_texture_option.h b/plugins/paintops/libpaintop/kis_texture_option.h index 3100bfc023..13b456ddea 100644 --- a/plugins/paintops/libpaintop/kis_texture_option.h +++ b/plugins/paintops/libpaintop/kis_texture_option.h @@ -1,97 +1,98 @@ /* This file is part of the KDE project * Copyright (C) Boudewijn Rempt , (C) 2012 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KIS_TEXTURE_OPTION_H #define KIS_TEXTURE_OPTION_H #include #include #include #include "kis_paintop_option.h" #include "kis_pressure_texture_strength_option.h" #include "KisTextureMaskInfo.h" #include class KisTextureChooser; class KoPattern; class KoResource; class KisPropertiesConfiguration; class KisPaintopLodLimitations; class PAINTOP_EXPORT KisTextureOption : public KisPaintOpOption { Q_OBJECT public: explicit KisTextureOption(); ~KisTextureOption() override; public Q_SLOTS: void writeOptionSetting(KisPropertiesConfigurationSP setting) const override; void readOptionSetting(const KisPropertiesConfigurationSP setting) override; void lodLimitations(KisPaintopLodLimitations *l) const override; private Q_SLOTS: void resetGUI(KoResource*); /// called when a new pattern is selected + void setCutoffPolicy(int index); private: /// UI Widget that stores all the texture options KisTextureChooser* m_textureOptions; }; class PAINTOP_EXPORT KisTextureProperties { public: KisTextureProperties(int levelOfDetail); enum TexturingMode { MULTIPLY, SUBTRACT }; bool m_enabled; /** * @brief apply combine the texture map with the dab * @param dab the colored, final representation of the dab, after mirroring and everything. * @param offset the position of the dab on the image. used to calculate the position of the mask pattern */ void apply(KisFixedPaintDeviceSP dab, const QPoint& offset, const KisPaintInformation & info); void fillProperties(const KisPropertiesConfigurationSP setting); private: int m_offsetX; int m_offsetY; TexturingMode m_texturingMode; int m_levelOfDetail; private: KisPressureTextureStrengthOption m_strengthOption; KisTextureMaskInfoSP m_maskInfo; }; #endif // KIS_TEXTURE_OPTION_H