Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.0 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2022 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */
#include "KisPaintingModeOptionData.h"

#include "kis_properties_configuration.h"


bool KisPaintingModeOptionData::read(const KisPropertiesConfiguration *setting)
{
    hasPaintingModeProperty = setting->hasProperty("PaintOpAction");

    switch (setting->getInt("PaintOpAction", 2)) {
    case 1:
        paintingMode = enumPaintingMode::BUILDUP;
        break;
    case 3:
        paintingMode = enumPaintingMode::CLAMP;
        break;
    default:
        paintingMode = enumPaintingMode::WASH;
        break;
    }

    return true;
}

void KisPaintingModeOptionData::write(KisPropertiesConfiguration *setting) const
{
    int value;
    switch (paintingMode) {
    case enumPaintingMode::BUILDUP:
        value = 1;
        break;
    case enumPaintingMode::CLAMP:
        value = 3;
        break;
    default:
        value = 2;
        break;
    }

    setting->setProperty("PaintOpAction", value);
}