File indexing completed on 2024-12-22 04:15:19
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * SPDX-FileCopyrightText: 2004 Cyrille Berger <cberger@cberger.net> 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #include "example.h" 0009 #include <stdlib.h> 0010 #include <vector> 0011 0012 #include <QPoint> 0013 #include <QTime> 0014 0015 #include <klocalizedstring.h> 0016 0017 #include <kis_debug.h> 0018 #include <kpluginfactory.h> 0019 0020 #include <kis_processing_information.h> 0021 #include <kis_types.h> 0022 #include <kis_selection.h> 0023 #include <kis_layer.h> 0024 #include <filter/kis_filter_category_ids.h> 0025 #include <filter/kis_filter_registry.h> 0026 #include <kis_global.h> 0027 #include "KoColorModelStandardIds.h" 0028 #include "kis_filter_configuration.h" 0029 0030 K_PLUGIN_FACTORY_WITH_JSON(KritaExampleFactory, "kritaexample.json", registerPlugin<KritaExample>();) 0031 0032 KritaExample::KritaExample(QObject *parent, const QVariantList &) 0033 : QObject(parent) 0034 { 0035 KisFilterRegistry::instance()->add(KisFilterSP(new KisFilterInvert())); 0036 } 0037 0038 KritaExample::~KritaExample() 0039 { 0040 } 0041 0042 KisFilterInvert::KisFilterInvert() : KisColorTransformationFilter(id(), FiltersCategoryAdjustId, i18n("&Invert")) 0043 { 0044 setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I)); 0045 setColorSpaceIndependence(FULLY_INDEPENDENT); 0046 setSupportsPainting(true); 0047 setShowConfigurationWidget(false); 0048 setSupportsLevelOfDetail(true); 0049 } 0050 0051 KoColorTransformation* KisFilterInvert::createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const 0052 { 0053 Q_UNUSED(config); 0054 return cs->createInvertTransformation(); 0055 } 0056 0057 bool KisFilterInvert::needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const 0058 { 0059 Q_UNUSED(config); 0060 return cs->colorModelId() == AlphaColorModelID; 0061 } 0062 0063 #include "example.moc"