Commit ee207df9 authored by Cyrille Berger's avatar Cyrille Berger

add the level filter to krita 1.6

CCMAIL: kimageshop@kde.org
CCMAIL: fcoiffie@gmail.com


svn path=/branches/koffice/1.6/koffice/; revision=597656
parent 6fdcd4e0
SUBDIRS = bumpmap cimg convolutionfilters embossfilter example imageenhancement \
oilpaintfilter pixelizefilter raindropsfilter roundcorners smalltilesfilter \
sobelfilter colorsfilters noisefilter wavefilter randompickfilter \
lenscorrectionfilter blur colors fastcolortransfer unsharp
lenscorrectionfilter blur colors fastcolortransfer unsharp levelfilter
kde_services_DATA = kritalevelfilter.desktop
INCLUDES = -I$(srcdir)/../../../sdk \
-I$(srcdir)/../../../core \
-I$(srcdir)/../../../kritacolor/ \
-I$(srcdir)/../../../ui \
$(KOFFICE_INCLUDES) \
$(all_includes)
kritalevelfilter_la_SOURCES = levelfilter.cc \
wdg_level.ui \
kis_level_filter.cc \
kgradientslider.cc
noinst_HEADERS = levelfilter.h \
kis_level_filter.h \
kgradientslider.h
kritalevelfilter_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
kritalevelfilter_la_LIBADD = ../../../libkritacommon.la
kde_module_LTLIBRARIES = kritalevelfilter.la
kritalevelfilter_la_METASOURCES = AUTO
This diff is collapsed.
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* 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.
*/
#ifndef KGRADIENTSLIDER_H
#define KGRADIENTSLIDER_H
// Qt includes.
#include <qwidget.h>
#include <qcolor.h>
#include <qptrlist.h>
#include <qpair.h>
class KGradientSlider : public QWidget
{
Q_OBJECT
typedef enum {
BlackCursor,
GammaCursor,
WhiteCursor
} eCursor;
public:
KGradientSlider(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
virtual ~KGradientSlider();
public slots:
void modifyBlack(int);
void modifyWhite(int);
void modifyGamma(double);
signals:
void modifiedBlack(int);
void modifiedWhite(int);
void modifiedGamma(double);
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent (QMouseEvent * e);
void mouseReleaseEvent ( QMouseEvent * e );
void mouseMoveEvent ( QMouseEvent * e );
void leaveEvent ( QEvent * );
public:
void enableGamma(bool b);
double getGamma(void);
private:
unsigned int m_leftmost;
unsigned int m_rightmost;
eCursor m_grab_cursor;
unsigned int m_grab_index;
bool m_dragging;
unsigned int m_blackcursor;
unsigned int m_whitecursor;
unsigned int m_gammacursor;
bool m_gammaEnabled;
double m_gamma;
};
#endif /* KGRADIENTSLIDER_H */
This diff is collapsed.
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* 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.
*/
#ifndef _KIS_LEVEL_FILTER_H_
#define _KIS_LEVEL_FILTER_H_
#include "kis_filter.h"
#include "kis_filter_config_widget.h"
class WdgLevel;
class QWidget;
class KisColorAdjustment;
class KisHistogram;
class KisLevelFilterConfiguration : public KisFilterConfiguration {
public:
KisLevelFilterConfiguration();
virtual ~KisLevelFilterConfiguration();
virtual void fromXML( const QString& );
virtual QString toString();
public:
Q_UINT8 blackvalue, whitevalue;
double gammavalue;
Q_UINT16 outblackvalue, outwhitevalue;
KisColorAdjustment * m_adjustment;
};
/**
* This class affect Intensity Y of the image
*/
class KisLevelFilter : public KisFilter
{
public:
KisLevelFilter();
public:
virtual KisFilterConfigWidget * createConfigurationWidget(QWidget* parent, KisPaintDeviceSP dev);
virtual KisFilterConfiguration * configuration(QWidget *);
virtual KisFilterConfiguration * configuration() { return new KisLevelFilterConfiguration(); };
virtual void process(KisPaintDeviceSP, KisPaintDeviceSP, KisFilterConfiguration* , const QRect&);
static inline KisID id() { return KisID("levels", i18n("Levels")); };
virtual bool supportsPainting() { return true; }
virtual bool supportsPreview() { return true; }
virtual bool supportsIncrementalPainting() { return false; }
virtual std::list<KisFilterConfiguration*> listOfExamplesConfiguration(KisPaintDeviceSP dev);
virtual ColorSpaceIndependence colorSpaceIndependence() { return TO_LAB16; };
virtual bool workWith(KisColorSpace* cs);
};
class KisLevelConfigWidget : public KisFilterConfigWidget {
Q_OBJECT
public:
KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev, const char * name = 0, WFlags f = 0 );
virtual ~KisLevelConfigWidget();
KisLevelFilterConfiguration * config();
void setConfiguration( KisFilterConfiguration * config );
WdgLevel * m_page;
protected slots:
void drawHistogram(bool logarithmic = false);
protected:
KisHistogram *histogram;
bool m_histlog;
};
#endif
[Desktop Entry]
Encoding=UTF-8
Name=Levels
Name[fr]=Niveaux
Comment=Levels
Comment[fr]=Niveaux
ServiceTypes=Krita/Filter
Type=Service
X-KDE-Library=kritalevelfilter
X-Krita-Version=2
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* 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 <math.h>
#include <stdlib.h>
#include <string.h>
#include <qslider.h>
#include <qpoint.h>
#include <qcolor.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kinstance.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_doc.h>
#include <kis_image.h>
#include <kis_layer.h>
#include <kis_global.h>
#include <kis_types.h>
#include <kis_iterators_pixel.h>
#include <kis_colorspace.h>
#include <kis_painter.h>
#include <kis_selection.h>
#include "levelfilter.h"
#include "kis_level_filter.h"
typedef KGenericFactory<LevelFilter> LevelFilterFactory;
K_EXPORT_COMPONENT_FACTORY( kritalevelfilter, LevelFilterFactory( "krita" ) )
LevelFilter::LevelFilter(QObject *parent, const char *name, const QStringList &)
: KParts::Plugin(parent, name)
{
setInstance(LevelFilterFactory::instance());
if (parent->inherits("KisFilterRegistry")) {
KisFilterRegistry * manager = dynamic_cast<KisFilterRegistry *>(parent);
manager->add(new KisLevelFilter());
}
}
LevelFilter::~LevelFilter()
{
}
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* 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. */
#ifndef LEVEL_H
#define LEVEL_H
#include <kparts/plugin.h>
class KisColorSpace;
class KisColorAdjustment;
class LevelFilter : public KParts::Plugin
{
public:
LevelFilter(QObject *parent, const char *name, const QStringList &);
virtual ~LevelFilter();
};
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment