Commit f04e0e1a authored by Sharaf Zaman's avatar Sharaf Zaman

Merge branch 'master' into sh-zam/T10784-android-port

parents 096ca427 bb0edcc8
......@@ -183,6 +183,7 @@ add_subdirectory( ext_exiv2 )
add_subdirectory( ext_ilmbase )
add_subdirectory( ext_lcms2 )
add_subdirectory( ext_openexr )
add_subdirectory( ext_openssl )
add_subdirectory( ext_vc )
add_subdirectory( ext_gsl )
add_subdirectory( ext_fftw3 )
......
SET(PREFIX_ext_openssl "${EXTPREFIX}" )
ExternalProject_Add( ext_openssl
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://www.openssl.org/source/openssl-1.1.1b.tar.gz
URL_HASH SHA1=e9710abf5e95c48ebf47991b10cbb48c09dae102
CONFIGURE_COMMAND <SOURCE_DIR>/config --prefix=${PREFIX_ext_openssl} --openssldir=ssl
BUILD_COMMAND make depend COMMAND make
INSTALL_COMMAND make install
INSTALL_DIR ${PREFIX_ext_openssl}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_fftw3} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE}
UPDATE_COMMAND ""
)
\ No newline at end of file
......@@ -13,7 +13,7 @@ if (WIN32)
#
-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg
#
-opensource -confirm-license
-opensource -confirm-license -openssl-linked
#
-release -platform win32-g++ -prefix ${EXTPREFIX_qt}
QMAKE_LFLAGS_APP+=${SECURITY_EXE_LINKER_FLAGS}
......@@ -41,6 +41,8 @@ if (WIN32)
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0004-Fix-debug-on-openGL-ES.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0005-cumulative-patch-for-hdr.patch
CMAKE_ARGS -DOPENSSL_LIBS='-L${EXTPREFIX_qt}/lib -lssl -lcrypto'
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure.bat ${_QT_conf}
......@@ -65,7 +67,9 @@ elseif (NOT APPLE)
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0012-Synthesize-Enter-LeaveEvent-when-QTabletEvent-is-acc.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0013-Poison-Qt-s-headers-with-a-mark-about-presence-of-En.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -verbose -nomake examples -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard --skip qtmultimedia
CMAKE_ARGS -DOPENSSL_LIBS='-L${EXTPREFIX_qt}/lib -lssl -lcrypto'
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -openssl-linked -verbose -nomake examples -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -skip qtmultimedia
INSTALL_DIR ${EXTPREFIX_qt}
BUILD_COMMAND $(MAKE)
......@@ -210,10 +214,12 @@ else( APPLE )
URL https://download.qt.io/archive/qt/5.12/5.12.1/single/qt-everywhere-src-5.12.1.tar.xz
URL_HASH MD5=6a37466c8c40e87d4a19c3f286ec2542
CMAKE_ARGS -DOPENSSL_LIBS='-L${EXTPREFIX_qt}/lib -lssl -lcrypto'
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure
-skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtgraphicaleffects -skip qtlocation -skip qtsensors -skip qtserialport -skip qtwayland
-skip qtwebchannel -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtnetworkauth -skip qtpurchasing -skip qtremoteobjects -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-qml-debug -no-libproxy -no-system-proxies -no-icu -no-mtdev -system-zlib -qt-pcre -opensource -confirm-license -prefix ${EXTPREFIX_qt}
-skip qtwebchannel -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtnetworkauth -skip qtpurchasing -skip qtremoteobjects -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-qml-debug -no-libproxy -no-system-proxies -no-icu -no-mtdev -system-zlib -qt-pcre -opensource -confirm-license -openssl-linked -prefix ${EXTPREFIX_qt}
BUILD_COMMAND ${PARALLEL_MAKE}
INSTALL_COMMAND make install
UPDATE_COMMAND ""
......
......@@ -2,8 +2,8 @@
Name=DSLR Templates
Name[ar]=قوالب DSLR
Name[bs]=DSLR Predlošci
Name[ca]=Plantilles DSLR
Name[ca@valencia]=Plantilles DSLR
Name[ca]=Plantilles de rèflex digitals
Name[ca@valencia]=Plantilles de rèflex digitals
Name[cs]=Šablony DSLR
Name[da]=DSLR-skabeloner
Name[de]=DSLR-Vorlagen
......
......@@ -306,6 +306,9 @@ extern "C" int main(int argc, char **argv)
// first create the application so we can create a pixmap
KisApplication app(key, argc, argv);
KisUsageLogger::writeHeader();
if (!language.isEmpty()) {
if (rightToLeft) {
app.setLayoutDirection(Qt::RightToLeft);
......
......@@ -181,8 +181,8 @@
<p xml:lang="zh-TW">Krita 是創造概念藝術、漫畫、彩現紋理和場景繪畫的絕佳選擇。Krita 在 8 位元和 16 位元整數色版,以及 16 位元和 32 位元浮點色版中支援 RGB 和 CMYK 等多種色彩空間。</p>
<p>Have fun painting with the advanced brush engines, amazing filters and many handy features that make Krita enormously productive.</p>
<p xml:lang="bs">Zabavite se kreirajući napredne pogone četki, filtere i mnoge praktične osobine koje čine Krita vrlo produktivnim.</p>
<p xml:lang="ca">Gaudiu pintant amb els motors de pinzells avançats, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="ca-valencia">Gaudiu pintant amb els motors de pinzells avançats, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="ca">Gaudiu pintant amb els motors avançats del pinzell, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="ca-valencia">Gaudiu pintant amb els motors avançats del pinzell, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="el">Διασκεδάστε ζωγραφίζοντας με τις προηγμένες μηχανές πινέλων, με εκπληκτικά φίλτρα και πολλά εύκολης χρήσης χαρακτηριστικά που παρέχουν στο Krita εξαιρετικά αυξημένη παραγωγικότητα.</p>
<p xml:lang="en-GB">Have fun painting with the advanced brush engines, amazing filters and many handy features that make Krita enormously productive.</p>
<p xml:lang="es">Diviértase pintando con los avanzados motores de pinceles, los espectaculares filtros y muchas funcionalidades prácticas que hacen que Krita sea enormemente productivo.</p>
......
......@@ -26,7 +26,7 @@
#include <QDesktopWidget>
#include <QClipboard>
#include <QThread>
#include <QApplication>
#include <klocalizedstring.h>
#include <KritaVersionWrapper.h>
......@@ -47,7 +47,6 @@ KisUsageLogger::KisUsageLogger()
rotateLog();
d->logFile.open(QFile::Append);
writeHeader();
}
KisUsageLogger::~KisUsageLogger()
......@@ -93,9 +92,12 @@ void KisUsageLogger::write(const QString &message)
void KisUsageLogger::writeHeader()
{
Q_ASSERT(d->logFile.isOpen());
Q_ASSERT(s_instance->d->logFile.isOpen());
QString sessionHeader = QString("SESSION: %1. Executing %2\n\n")
.arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date))
.arg(qApp->arguments().join(' '));
QString sessionHeader = QString("SESSION: %1\n\n").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date));
QString disclaimer = i18n("WARNING: This file contains information about your system and the\n"
"images you have been working with.\n"
"\n"
......@@ -113,7 +115,9 @@ void KisUsageLogger::writeHeader()
// Krita version info
systemInfo.append("Krita\n");
systemInfo.append("\n Version: ").append(KritaVersionWrapper::versionString(true));
systemInfo.append("\n Version: ").append(KritaVersionWrapper::versionString(true));
systemInfo.append("\n Languages: ").append(KLocalizedString::languages().join(", "));
systemInfo.append("\n Hidpi: ").append(QCoreApplication::testAttribute(Qt::AA_EnableHighDpiScaling) ? "true" : "false");
systemInfo.append("\n\n");
systemInfo.append("Qt\n");
......@@ -133,10 +137,10 @@ void KisUsageLogger::writeHeader()
systemInfo.append("\n Product Version: ").append(QSysInfo::productVersion());
systemInfo.append("\n\n");
d->logFile.write(s_sectionHeader.toUtf8());
d->logFile.write(sessionHeader.toUtf8());
d->logFile.write(disclaimer.toUtf8());
d->logFile.write(systemInfo.toUtf8());
s_instance->d->logFile.write(s_sectionHeader.toUtf8());
s_instance->d->logFile.write(sessionHeader.toUtf8());
s_instance->d->logFile.write(disclaimer.toUtf8());
s_instance->d->logFile.write(systemInfo.toUtf8());
}
......
......@@ -43,9 +43,11 @@ public:
/// Writes without date/time
static void write(const QString &message);
static void writeHeader();
private:
void writeHeader();
void rotateLog();
Q_DISABLE_COPY(KisUsageLogger)
......
......@@ -1099,6 +1099,8 @@ void KisPainter::paintPolyline(const vQPointF &points,
fillPolygon(points, d->fillStyle);
}
if (d->strokeStyle == StrokeStyleNone) return;
if (index >= points.count())
return;
......@@ -1110,11 +1112,12 @@ void KisPainter::paintPolyline(const vQPointF &points,
if (numPoints > 1) {
KisDistanceInformation saveDist(points[0],
KisAlgebra2D::directionBetweenPoints(points[0], points[1], 0.0));
KisAlgebra2D::directionBetweenPoints(points[0], points[1], 0.0));
for (int i = index; i < index + numPoints - 1; i++) {
paintLine(points [i], points [i + 1], &saveDist);
}
}
}
static void getBezierCurvePoints(const KisVector2D &pos1,
......
......@@ -95,6 +95,9 @@
#include "widgets/KisScreenColorPicker.h"
#include "KisDlgInternalColorSelector.h"
#include <dialogs/KisAsyncAnimationFramesSaveDialog.h>
#include <kis_image_animation_interface.h>
namespace {
const QTime appStartTime(QTime::currentTime());
}
......@@ -386,12 +389,13 @@ bool KisApplication::start(const KisApplicationArguments &args)
const bool doNewImage = args.doNewImage();
const bool doTemplate = args.doTemplate();
const bool exportAs = args.exportAs();
const bool exportSequence = args.exportSequence();
const QString exportFileName = args.exportFileName();
d->batchRun = (exportAs || !exportFileName.isEmpty());
const bool needsMainWindow = !exportAs;
d->batchRun = (exportAs || exportSequence || !exportFileName.isEmpty());
const bool needsMainWindow = (!exportAs && !exportSequence);
// only show the mainWindow when no command-line mode option is passed
bool showmainWindow = !exportAs; // would be !batchRun;
bool showmainWindow = (!exportAs && !exportSequence); // would be !batchRun;
const bool showSplashScreen = !d->batchRun && qEnvironmentVariableIsEmpty("NOSPLASH");
if (showSplashScreen && d->splashScreen) {
......@@ -545,6 +549,34 @@ bool KisApplication::start(const KisApplicationArguments &args)
}
QTimer::singleShot(0, this, SLOT(quit()));
}
else if (exportSequence) {
KisDocument *doc = kisPart->createDocument();
doc->setFileBatchMode(d->batchRun);
doc->openUrl(QUrl::fromLocalFile(fileName));
qApp->processEvents(); // For vector layers to be updated
if (!doc->image()->animationInterface()->hasAnimation()) {
errKrita << "This file has no animation." << endl;
QTimer::singleShot(0, this, SLOT(quit()));
return 1;
}
doc->setFileBatchMode(true);
int sequenceStart = 0;
KisAsyncAnimationFramesSaveDialog exporter(doc->image(),
doc->image()->animationInterface()->fullClipRange(),
exportFileName,
sequenceStart,
0);
exporter.setBatchMode(d->batchRun);
KisAsyncAnimationFramesSaveDialog::Result result =
exporter.regenerateRange(0);
if (result == KisAsyncAnimationFramesSaveDialog::RenderFailed) {
errKrita << i18n("Failed to render animation frames!") << endl;
}
QTimer::singleShot(0, this, SLOT(quit()));
}
else if (d->mainWindow) {
if (fileName.endsWith(".bundle")) {
d->mainWindow->installBundle(fileName);
......
......@@ -43,6 +43,7 @@ struct Q_DECL_HIDDEN KisApplicationArguments::Private
int dpiY {72};
bool doTemplate {false};
bool exportAs {false};
bool exportSequence {false};
QString exportFileName;
QString workspace;
QString windowLayout;
......@@ -98,6 +99,7 @@ KisApplicationArguments::KisApplicationArguments(const QApplication &app)
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("fullscreen"), i18n("Start Krita in full-screen mode")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("dpi"), i18n("Override display DPI"), QLatin1String("dpiX,dpiY")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export"), i18n("Export to the given filename and exit")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export-sequence"), i18n("Export animation to the given filename and exit")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("export-filename"), i18n("Filename for export"), QLatin1String("filename")));
parser.addPositionalArgument(QLatin1String("[file(s)]"), i18n("File(s) or URL(s) to open"));
parser.process(app);
......@@ -140,6 +142,7 @@ KisApplicationArguments::KisApplicationArguments(const QApplication &app)
d->session = parser.value("load-session");
d->doTemplate = parser.isSet("template");
d->exportAs = parser.isSet("export");
d->exportSequence = parser.isSet("export-sequence");
d->canvasOnly = parser.isSet("canvasonly");
d->noSplash = parser.isSet("nosplash");
d->fullScreen = parser.isSet("fullscreen");
......@@ -282,6 +285,11 @@ bool KisApplicationArguments::exportAs() const
return d->exportAs;
}
bool KisApplicationArguments::exportSequence() const
{
return d->exportSequence;
}
QString KisApplicationArguments::exportFileName() const
{
return d->exportFileName;
......
......@@ -46,6 +46,7 @@ public:
int dpiY() const;
bool doTemplate() const;
bool exportAs() const;
bool exportSequence() const;
QString exportFileName() const;
QString workspace() const;
QString windowLayout() const;
......
......@@ -1187,7 +1187,7 @@ bool KisDocument::openUrl(const QUrl &_url, OpenFlags flags)
else {
if (ret) {
if ((flags & DontAddToRecent)) {
if (!(flags & DontAddToRecent)) {
KisPart::instance()->addRecentURLToAllMainWindows(_url);
}
......
......@@ -217,6 +217,8 @@ void KisResourcesSnapshot::setupMaskingBrushPainter(KisPainter *painter)
painter->setMirrorInformation(m_d->axesCenter, m_d->mirrorMaskHorizontal, m_d->mirrorMaskVertical);
painter->setStrokeStyle(m_d->strokeStyle);
/**
* The paintOp should be initialized the last, because it may
* ask the painter for some options while initialization
......
......@@ -23,6 +23,7 @@
#include <QResizeEvent>
#include "kis_debug.h"
#include <config-hdr.h>
#include <opengl/kis_opengl.h>
#include "KisGLImageF16.h"
......@@ -67,6 +68,12 @@ KisGLImageWidget::KisGLImageWidget(QSurfaceFormat::ColorSpace colorSpace,
setUpdateBehavior(QOpenGLWidget::NoPartialUpdate);
}
KisGLImageWidget::~KisGLImageWidget()
{
// force releasing the reourses on destruction
slotOpenGLContextDestroyed();
}
void KisGLImageWidget::initializeGL()
{
initializeOpenGLFunctions();
......@@ -91,7 +98,7 @@ void KisGLImageWidget::initializeGL()
vertSource.prepend(versionDefinition);
fragSource.prepend(versionDefinition);
} else {
const char *versionDefinition = "#version 330 core\n";
const char *versionDefinition = KisOpenGL::supportsLoD() ? "#version 130\n" : "#version 120\n";
vertSource.prepend(versionDefinition);
fragSource.prepend(versionDefinition);
}
......
......@@ -37,6 +37,8 @@ public:
KisGLImageWidget(QSurfaceFormat::ColorSpace colorSpace,
QWidget *parent = nullptr);
~KisGLImageWidget();
void initializeGL();
void paintGL();
......
......@@ -51,7 +51,6 @@
KisGridPaintOp::KisGridPaintOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image)
: KisPaintOp(painter)
, m_settings(static_cast<KisGridPaintOpSettings*>(const_cast<KisPaintOpSettings*>(settings.data())))
, m_image(image)
, m_node(node)
{
m_properties.readOptionSetting(settings);
......
......@@ -67,7 +67,6 @@ private:
private:
KisGridPaintOpSettingsSP m_settings;
KisImageWSP m_image;
KisPaintDeviceSP m_dab;
KisPainter* m_painter;
qreal m_xSpacing;
......
......@@ -47,7 +47,6 @@
KisHatchingPaintOp::KisHatchingPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image)
: KisBrushBasedPaintOp(settings, painter)
, m_image(image)
{
Q_UNUSED(node);
......
......@@ -65,7 +65,6 @@ protected:
private:
KisHatchingPaintOpSettingsSP m_settings;
KisImageWSP m_image;
HatchingBrush *m_hatchingBrush;
/**
......
......@@ -37,7 +37,7 @@
#include "kis_brush_server.h"
KisClipboardBrushWidget::KisClipboardBrushWidget(QWidget *parent, const QString &caption, KisImageWSP image)
: KisWdgClipboardBrush(parent), m_image(image)
: KisWdgClipboardBrush(parent)
{
setWindowTitle(caption);
preview->setScaledContents(true);
......
......@@ -70,7 +70,6 @@ Q_SIGNALS:
private:
KisClipboard* m_clipboard;
KisPaintDeviceSP pd;
KisImageWSP m_image;
KisBrushSP m_brush;
QSharedPointer<KoAbstractResourceServerAdapter> m_rServerAdapter;
};
......
......@@ -46,7 +46,6 @@
KisRoundMarkerOp::KisRoundMarkerOp(KisPaintOpSettingsSP settings, KisPainter* painter, KisNodeSP node, KisImageSP image)
: KisPaintOp(painter)
, m_firstRun(true)
, m_image(image)
, m_lastRadius(1.0)
{
Q_UNUSED(node);
......
......@@ -48,7 +48,6 @@ private:
private:
bool m_firstRun;
KisImageSP m_image;
KisPaintDeviceSP m_tempDev;
KisPressureSizeOption m_sizeOption;
KisPressureSpacingOption m_spacingOption;
......
......@@ -60,7 +60,7 @@ def writeJson(configDictionary = {}):
role = str(authorDict["role"]).title()
if "editor" in role.lower():
role = "Editor"
if "cover" in role.lower:
if "cover" in role.lower():
role = "Cover"
if role in listOfRoles:
author["role"] = role
......
# let's make a module
from .highpass import *
from .highpass import HighpassExtension
Scripter.addExtension(HighpassExtension(Krita.instance()))
'''
This script is licensed CC 0 1.0, so that you can learn from it.
# This script is licensed CC 0 1.0, so that you can learn from it.
------ CC 0 1.0 ---------------
# ------ CC 0 1.0 ---------------
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
# The person who associated a work with this deed has dedicated the
# work to the public domain by waiving all of his or her rights to the
# work worldwide under copyright law, including all related and
# neighboring rights, to the extent allowed by law.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
# You can copy, modify, distribute and perform the work, even for
# commercial purposes, all without asking permission.
https://creativecommons.org/publicdomain/zero/1.0/legalcode
'''
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from krita import *
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
from PyQt5 import QtCore
from PyQt5.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QDialogButtonBox,
QFormLayout,
QMessageBox,
QSpinBox,
QVBoxLayout,
)
from krita import Extension
class HighpassExtension(Extension):
......@@ -22,15 +33,18 @@ class HighpassExtension(Extension):
def setup(self):
pass
def createActions(self, window):
action = window.createAction("high_pass_filter", i18n("High Pass"))
action.triggered.connect(self.showDialog)
def showDialog(self):
doc = Application.activeDocument()
if doc == None:
QMessageBox.information(Application.activeWindow().qwindow(), i18n("High Pass Filter"), i18n("There is no active image."))
if doc is None:
QMessageBox.information(
Application.activeWindow().qwindow(),
i18n("High Pass Filter"),
i18n("There is no active image."))
return
self.dialog = QDialog(Application.activeWindow().qwindow())
......@@ -40,7 +54,10 @@ class HighpassExtension(Extension):
self.intRadius.setRange(2, 200)
self.cmbMode = QComboBox()
self.cmbMode.addItems(["Color", "Preserve DC", "Greyscale", "Greyscale, Apply Chroma", "Redrobes"])
self.cmbMode.addItems(
["Color", "Preserve DC", "Greyscale",
"Greyscale, Apply Chroma", "Redrobes"]
)
self.keepOriginal = QCheckBox(i18n("Keep original layer"))
self.keepOriginal.setChecked(True)
form = QFormLayout()
......@@ -50,7 +67,8 @@ class HighpassExtension(Extension):
self.buttonBox = QDialogButtonBox(self.dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.setStandardButtons(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.accepted.connect(self.dialog.accept)
self.buttonBox.accepted.connect(self.highpass)
self.buttonBox.rejected.connect(self.dialog.reject)
......@@ -72,36 +90,47 @@ class HighpassExtension(Extension):
# We can only highpass on paint layers
if self.keepOriginal.isChecked() or original.type() != "paintlayer":
working_layer = image.createNode("working", "paintlayer")
working_layer.setColorSpace(original.colorModel(), original.colorSpace(), original.profile())
working_layer.writeBytes(original.readBytes(0, 0, image.width(), image.height()),
0, 0, image.width(), image.height())
original.parentNode().addChildNode(working_layer, original) # XXX: Unimplemented
working_layer.setColorSpace(
original.colorModel(),
original.colorSpace(),
original.profile())
working_layer.writeBytes(
original.readBytes(0, 0, image.width(), image.height()),
0, 0, image.width(), image.height())
# XXX: Unimplemented:
original.parentNode().addChildNode(working_layer, original)
image.setActiveNode(working_layer)
colors_layer = None
# if keeping colors
if self.cmbMode.currentIndex() == 1 or self.cmbMode.currentIndex() == 3:
colors_layer = working_layer.duplicate() # XXX: Unimplemented
if (self.cmbMode.currentIndex() == 1
or self.cmbMode.currentIndex() == 3):
# XXX: Unimplemented:
colors_layer = working_layer.duplicate()
colors_layer.setName("colors")
original.parentNode().addChildNode(working_layer, colors_layer) # XXX: Unimplemented
# XXX: Unimplemented:
original.parentNode().addChildNode(working_layer, colors_layer)
# if greyscale, desature
if (self.cmbMode.currentIndex() == 2 or self.cmbMode.currentIndex() == 3):
if (self.cmbMode.currentIndex() == 2
or self.cmbMode.currentIndex() == 3):
filter = Application.filter("desaturate")
filter.apply(working_layer, 0, 0, image.width(), image.height())
# Duplicate on top and blur
blur_layer = working_layer.duplicate()
blur_layer.setName("blur")
original.parentNode().addChildNode(blur_layer, working_layer) # XXX: Unimplemented
# XXX: Unimplemented:
original.parentNode().addChildNode(blur_layer, working_layer)
# blur
filter = Application.filter("gaussian blur")
filter_configuration = filter.configuration()
filter_configuration.setProperty("horizRadius", self.intRadius.value())
filter_configuration.setProperty("vertRadius", self.intRadius.value())
filter_configuration.setProperty("lockAspect", true)
filter_configuration.setProperty("lockAspect", True)
filter.setConfiguration(filter_configuration)
filter.apply(blur_layer, 0, 0, image.width(), image.height())
......@@ -109,12 +138,15 @@ class HighpassExtension(Extension):
blur_layer.setBlendingMode("grain_extract")
working_layer = image.mergeDown(blur_layer)
# if preserve chroma, change set the mode to value and merge down with the layer we kept earlier.
# if preserve chroma, change set the mode to value and
# merge down with the layer we kept earlier.
if self.cmbMode.currentIndex() == 3:
working_layer.setBlendingMode("value")
working_layer = image.mergeDown(working_layer)
# if preserve DC, change set the mode to overlay and merge down with the average colour of the layer we kept earlier.
# if preserve DC, change set the mode to overlay and merge
# down with the average colour of the layer we kept
# earlier.
if self.cmbMode.currentIndex() == 1:
# get the average color of the entire image
# clear the colors layer to the given color
......@@ -126,5 +158,3 @@ class HighpassExtension(Extension):
# copy the solid colour layer
# copy the blurred layer
# XXX: End undo macro
Scripter.addExtension(HighpassExtension(Krita.instance()))
from .krita_script_starter import *
\ No newline at end of file
from .krita_script_starter import KritaScriptStarter
Scripter.addExtension(KritaScriptStarter(Krita.instance()))
# let's make a module
from .scriptdocker import *
import krita
from .scriptdocker import ScriptDocker
Application.addDockWidgetFactory(
krita.DockWidgetFactory("scriptdocker",
krita.DockWidgetFactoryBase.DockRight,
ScriptDocker)
)
'''
This script is licensed CC 0 1.0, so that you can learn from it.
# This script is licensed CC 0 1.0, so that you can learn from it.
------ CC 0 1.0 ---------------
# ------ CC 0 1.0 ---------------
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
# The person who associated a work with this deed has dedicated the
# work to the public domain by waiving all of his or her rights to the
# work worldwide under copyright law, including all related and
# neighboring rights, to the extent allowed by law.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
# You can copy, modify, distribute and perform the work, even for
# commercial purposes, all without asking permission.
https://creativecommons.org/publicdomain/zero/1.0/legalcode
'''
rom PyQt5.QtWidgets import (QWidget, QVBoxLayout, QListView, QFormLayout,
QHBoxLayout, QPushButton, QLineEdit, QListWidget)
from PyQt5.QtCore import QObject
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QFormLayout,
QHBoxLayout, QPushButton, QLineEdit)
import krita
......@@ -47,7 +49,9 @@ class ScriptDocker(krita.DockWidget):
directorySelectorLayout.addWidget(directoryTextField)
directorySelectorLayout.addWidget(directoryDialogButton)
self.scriptsLayout.addRow(str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout)
self.scriptsLayout.addRow(
str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1),
directorySelectorLayout)
def test(self):
obj = self.sender()
......@@ -61,6 +65,3 @@ class ScriptDocker(krita.DockWidget):
def writeSettings(self):
pass
Application.addDockWidgetFactory(krita.DockWidgetFactory("scriptdocker", krita.DockWidgetFactoryBase.DockRight, ScriptDocker))
......@@ -142,6 +142,13 @@ void TransformStrokeStrategy::doStrokeCallback(KisStrokeJobData *data)
"transformed_image");
KisGroupLayerSP clonedGroup = dynamic_cast<KisGroupLayer*>(group->clone().data());
// In case the group is pass-through, it needs to be disabled for the preview,
// otherwise it will crash (no parent for a preview leaf).
// Also it needs to be done before setting the root layer for clonedImage.
// Result: preview for pass-through group is the same as for standard group
// (i.e. filter layers in the group won't affect the layer stack for a moment).
clonedGroup->setPassThroughMode(false);
clonedImage->setRootLayer(clonedGroup);
QQueue<KisNodeSP> linearizedSrcNodes;
......
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