-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
83 changed files
with
4,574 additions
and
2,175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Implement your own filter | ||
------------------------- | ||
In order develop your own filter, you have to create a class that inherits from BaseFilter and reimplement at least: | ||
|
||
public: | ||
<Constructor>(QObject * parent = 0); | ||
QString getIdentifier(); | ||
QString getName(); | ||
QMap<QString, QVariant> getSettings(); | ||
void setSettings(QMap <QString, QVariant> settings); | ||
protected: | ||
void compute(); | ||
|
||
This class should provide a Widget that implements the AbstractFilterWidget. The inherited methods (getWidget) from | ||
the BaseFilter don't need to be reimplemented in most cases. | ||
|
||
Each Filter should be placed somewhere appropiate under the filter folder. The name of the classes and files should | ||
beginn with the filer name as in getIdentifier(). | ||
If you create a new folder, don't forget to modifiy the INCLUDEPATH in yasw.pro. | ||
|
||
Have a look at the BaseFilter and the Rotation class (folder filter/rotation) for simple filter example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2014 Robert Chéramy ([email protected]) | ||
* | ||
* This file is part of YASW (Yet Another Scan Wizard). | ||
* | ||
* YASW 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 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* YASW 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 YASW. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "constants.h" | ||
|
||
QStringList Constants::displayUnits = QStringList() << "pixel" | ||
<< "milimeter" | ||
<< "inch"; | ||
QStringList Constants::dpiList = QStringList() << "150" | ||
<< "300" | ||
<< "600"; | ||
|
||
qreal const Constants::milimeterPerInch = 25.4; // 1 inch = 25,4 mm | ||
|
||
|
||
QStringList Constants::horizontalAlignment = QStringList() << "Left" | ||
<< "Center" | ||
<< "Right"; | ||
QStringList Constants::verticalAlignment = QStringList() << "Top" | ||
<< "Center" | ||
<< "Bottom"; | ||
|
||
QRegExp Constants::trailZero = QRegExp("0+$"); | ||
QRegExp Constants::trailDot = QRegExp("\\.$"); | ||
|
||
|
||
QString Constants::float2String(qreal n, int precision) | ||
{ | ||
QString str = QString::number(n, 'f', precision); | ||
str.remove(trailZero); | ||
str.remove(trailDot); | ||
|
||
return str; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2014 Robert Chéramy ([email protected]) | ||
* | ||
* This file is part of YASW (Yet Another Scan Wizard). | ||
* | ||
* YASW 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 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* YASW 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 YASW. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef CONSTANTS_H | ||
#define CONSTANTS_H | ||
|
||
#include <QStringList> | ||
// QDebug included centraly, so that it can be commented out. | ||
#include <QDebug> | ||
|
||
static const char VERSION[] = "0.6"; | ||
|
||
|
||
class Constants | ||
{ | ||
public: | ||
static QStringList displayUnits; | ||
static QStringList dpiList; | ||
static qreal const milimeterPerInch ; //= 25.4; | ||
|
||
static int const MIN_DPI = 10; | ||
static int const DEFAULT_DPI = 300; | ||
|
||
// Constants for Layout Filter & Widget | ||
enum horizintalAlignmentEnum {LeftHAlignment, CenterHAlignment, RightHAlignment}; | ||
enum verticalAlignmentEnum {TopVAlignment, CenterVAlignment, BottomVAlignment}; | ||
static QStringList horizontalAlignment; | ||
static QStringList verticalAlignment; | ||
|
||
static QString float2String(qreal n, int precision = 2); | ||
|
||
private: | ||
// Code optimisation: define these QRegExp once and loading a project is much faster. | ||
static QRegExp trailZero; | ||
static QRegExp trailDot; | ||
}; | ||
|
||
|
||
|
||
#endif // CONSTANTS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright (C) 2012 Robert Chéramy ([email protected]) | ||
* Copyright (C) 2012-2014 Robert Chéramy ([email protected]) | ||
* | ||
* This file is part of YASW (Yet Another Scan Wizard). | ||
* | ||
|
@@ -18,29 +19,9 @@ | |
*/ | ||
#include "abstractfilterwidget.h" | ||
|
||
/** \class FilterWidget | ||
\brief An abstract class for all Filter Widgets. | ||
NOTE: The class ist not really abstract anymore as is provides a basic implementation. | ||
|
||
This abstract class describes the members a Filter Widget must have. | ||
It has to be inherited by all Filter Widgets. | ||
*/ | ||
|
||
AbstractFilterWidget::AbstractFilterWidget(QWidget *parent) : | ||
QWidget(parent) | ||
{ | ||
} | ||
|
||
/** \brief Sets the input pixmap | ||
*/ | ||
void AbstractFilterWidget::setPixmap(QPixmap pixmap) | ||
{ | ||
inputPixmap = pixmap; | ||
} | ||
|
||
/** \brief Sets the filtered pixmap for preview */ | ||
void AbstractFilterWidget::setPreview(QPixmap pixmap) | ||
{ | ||
previewPixmap = pixmap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2012 Robert Chéramy ([email protected]) | ||
* Copyright (C) 2012-2014 Robert Chéramy ([email protected]) | ||
* | ||
* This file is part of YASW (Yet Another Scan Wizard). | ||
* | ||
|
@@ -21,17 +21,40 @@ | |
|
||
#include <QWidget> | ||
|
||
|
||
/* An abstract class for all Filter Widgets. | ||
This abstract class describes the members a Filter Widget must have. | ||
It has to be inherited by all Filter Widgets. | ||
A Filter Widget must provide a way to | ||
setPixmap - set the input image (for displaying it) | ||
setPreview - set the output image (for previewing the result) | ||
preview - inform if the preview is active | ||
parameterChanged - inform if parameter have been changed in the widget | ||
*/ | ||
|
||
|
||
class AbstractFilterWidget : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
AbstractFilterWidget(QWidget *parent = 0); | ||
//! \brief Sets the input pixmap | ||
virtual void setPixmap(QPixmap pixmap); | ||
//! \brief Sets the filtered pixmap for preview */ | ||
virtual void setPreview(QPixmap pixmap); | ||
// Sets the input pixmap | ||
virtual void setPixmap(QPixmap pixmap) = 0; | ||
// Sets the output pixmap for preview | ||
virtual void setPreview(QPixmap pixmap) = 0; | ||
// true if preview is active | ||
virtual bool preview() = 0; | ||
virtual void enableFilter(bool enable) = 0; | ||
protected: | ||
QPixmap inputPixmap; | ||
QPixmap previewPixmap; | ||
signals: | ||
void parameterChanged(); | ||
void enableFilterToggled(bool checked); | ||
void previewChecked(); | ||
|
||
}; | ||
|
||
#endif // ABSTRACTFILTERWIDGET_H |
Oops, something went wrong.