Compare commits
3 commits
5ef36a7b93
...
0b7fdd43cb
Author | SHA1 | Date | |
---|---|---|---|
chayleaf | 0b7fdd43cb | ||
chayleaf | b0b136b6d7 | ||
chayleaf | 8b6a6035c6 |
|
@ -324,11 +324,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714645000,
|
"lastModified": 1722906996,
|
||||||
"narHash": "sha256-RelIgcYWJnUdE96Hjh8gR6wmsNgLc1LHDZY5VtdR6Eo=",
|
"narHash": "sha256-QD6cZNmEJ+0b7G23E9qbcXiuy17k+0bgT7Z1dGUcHC0=",
|
||||||
"owner": "chayleaf",
|
"owner": "chayleaf",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "2a477b78f5e95a0b8ed741786524ca0fbfe0c230",
|
"rev": "510b84097597d94f19f3231c7d657add01858dec",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
} // args.specialArgs or { };
|
} // args.specialArgs or { };
|
||||||
modules = [
|
modules = [
|
||||||
{ _module.args = {
|
{ _module.args = {
|
||||||
pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays; };
|
pkgs-kernel = import inputs.nixpkgs-kernel { inherit (args) system; overlays = all-overlays ++ config.nixpkgs.overlays; };
|
||||||
}; }
|
}; }
|
||||||
(getPrivSys hostname)
|
(getPrivSys hostname)
|
||||||
{ networking.hostName = lib.mkDefault hostname;
|
{ networking.hostName = lib.mkDefault hostname;
|
||||||
|
@ -238,7 +238,11 @@
|
||||||
extraSpecialArgs = { inherit inputs; };
|
extraSpecialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
./home/hosts/remote.nix
|
./home/hosts/remote.nix
|
||||||
({ pkgs, ... }: { home.file.hysteria.source = pkgs.hysteria; })
|
({ pkgs, ... }: {
|
||||||
|
home.file.hysteria.source = pkgs.hysteria;
|
||||||
|
home.file.shadowsocks-libev.source = pkgs.shadowsocks-libev;
|
||||||
|
home.file.shadowsocks-rust.source = pkgs.shadowsocks-rust;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -261,7 +265,6 @@
|
||||||
++ [
|
++ [
|
||||||
(getPrivUser hostname user)
|
(getPrivUser hostname user)
|
||||||
({ pkgs, lib, ... }: {
|
({ pkgs, lib, ... }: {
|
||||||
nixpkgs.overlays = all-overlays;
|
|
||||||
nix.package = lib.mkDefault pkgs.nixForNixPlugins;
|
nix.package = lib.mkDefault pkgs.nixForNixPlugins;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{
|
{
|
||||||
imports = [ ./gui.nix ];
|
imports = [ ./gui.nix ];
|
||||||
|
|
||||||
programs.firefox = {
|
programs.librewolf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.wrapFirefox pkgs.librewolf-unwrapped {
|
package = pkgs.wrapFirefox pkgs.librewolf-unwrapped {
|
||||||
inherit (pkgs.librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
|
inherit (pkgs.librewolf-unwrapped) extraPrefsFiles extraPoliciesFiles;
|
||||||
|
@ -15,6 +15,17 @@
|
||||||
libName = "librewolf";
|
libName = "librewolf";
|
||||||
nativeMessagingHosts = with pkgs; [ keepassxc ];
|
nativeMessagingHosts = with pkgs; [ keepassxc ];
|
||||||
};
|
};
|
||||||
|
profiles.other.id = 1;
|
||||||
|
profiles.other.bookmarks = [{
|
||||||
|
name = "bookmarklets";
|
||||||
|
toolbar = true;
|
||||||
|
bookmarks = [
|
||||||
|
{
|
||||||
|
name = "example.com";
|
||||||
|
url = "https://example.com";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}];
|
||||||
profiles.chayleaf = lib.mkMerge [
|
profiles.chayleaf = lib.mkMerge [
|
||||||
{
|
{
|
||||||
extensions = (with config.nur.repos.rycee.firefox-addons; [
|
extensions = (with config.nur.repos.rycee.firefox-addons; [
|
||||||
|
|
|
@ -172,11 +172,11 @@ commonConfig = {
|
||||||
names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ];
|
names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ];
|
||||||
size = 16.0;
|
size = 16.0;
|
||||||
};
|
};
|
||||||
gaps = {
|
# gaps = {
|
||||||
smartBorders = "on";
|
# smartBorders = "on";
|
||||||
smartGaps = true;
|
# smartGaps = true;
|
||||||
inner = 10;
|
# inner = 10;
|
||||||
};
|
# };
|
||||||
window.hideEdgeBorders = "smart";
|
window.hideEdgeBorders = "smart";
|
||||||
workspaceAutoBackAndForth = true;
|
workspaceAutoBackAndForth = true;
|
||||||
};
|
};
|
||||||
|
@ -297,6 +297,11 @@ in
|
||||||
app_id = "^org.keepassxc.KeePassXC$";
|
app_id = "^org.keepassxc.KeePassXC$";
|
||||||
title = "^KeePassXC - (?:Browser |ブラウザーの)?(?:Access Request|アクセス要求)$";
|
title = "^KeePassXC - (?:Browser |ブラウザーの)?(?:Access Request|アクセス要求)$";
|
||||||
}; }
|
}; }
|
||||||
|
{ command = "floating on; border normal";
|
||||||
|
criteria = {
|
||||||
|
class = "ghidra-Ghidra";
|
||||||
|
title = "\\[CodeBrowser.*\\]$";
|
||||||
|
}; }
|
||||||
]; };
|
]; };
|
||||||
assigns = {
|
assigns = {
|
||||||
"2" = [
|
"2" = [
|
||||||
|
|
|
@ -22,6 +22,8 @@ in
|
||||||
inherit (inputs.osu-wine.packages.${pkgs.system}) osu-wine;
|
inherit (inputs.osu-wine.packages.${pkgs.system}) osu-wine;
|
||||||
matrix-appservice-discord = pkgs.callPackage ./matrix-appservice-discord { inherit (pkgs) matrix-appservice-discord; };
|
matrix-appservice-discord = pkgs.callPackage ./matrix-appservice-discord { inherit (pkgs) matrix-appservice-discord; };
|
||||||
|
|
||||||
|
krita = pkgs.callPackage ./krita { inherit (pkgs) krita; };
|
||||||
|
|
||||||
openssh = pkgs.openssh.overrideAttrs (old: rec {
|
openssh = pkgs.openssh.overrideAttrs (old: rec {
|
||||||
version = "9.8p1";
|
version = "9.8p1";
|
||||||
src = pkgs.fetchurl {
|
src = pkgs.fetchurl {
|
||||||
|
@ -39,8 +41,12 @@ in
|
||||||
gimp = callPackage ./gimp { inherit (pkgs) gimp; };
|
gimp = callPackage ./gimp { inherit (pkgs) gimp; };
|
||||||
home-daemon = callPackage ./home-daemon { };
|
home-daemon = callPackage ./home-daemon { };
|
||||||
# pin version
|
# pin version
|
||||||
looking-glass-client = pkgs.looking-glass-client.overrideAttrs (old: {
|
looking-glass-client = pkgs.looking-glass-client.overrideAttrs (old: rec {
|
||||||
version = "B6";
|
version = "B6";
|
||||||
|
postUnpack = ''
|
||||||
|
echo ${src.rev} > source/VERSION
|
||||||
|
export sourceRoot="source/client"
|
||||||
|
'';
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "gnif";
|
owner = "gnif";
|
||||||
repo = "LookingGlass";
|
repo = "LookingGlass";
|
||||||
|
@ -50,8 +56,7 @@ in
|
||||||
};
|
};
|
||||||
patches = [ ];
|
patches = [ ];
|
||||||
});
|
});
|
||||||
kvmfrOverlay = kvmfr: kvmfr.overrideAttrs (old: {
|
kvmfrOverlay = kvmfr: (kvmfr.override { inherit (pkgs') looking-glass-client; }).overrideAttrs (old: {
|
||||||
inherit (pkgs'.looking-glass-client) version src;
|
|
||||||
patches = [ ./looking-glass.patch ];
|
patches = [ ./looking-glass.patch ];
|
||||||
});
|
});
|
||||||
mobile-config-firefox = callPackage ./mobile-config-firefox { };
|
mobile-config-firefox = callPackage ./mobile-config-firefox { };
|
||||||
|
|
12
pkgs/krita/default.nix
Normal file
12
pkgs/krita/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ krita, python3Packages }:
|
||||||
|
|
||||||
|
(krita.override {
|
||||||
|
unwrapped = krita.unwrapped.overrideAttrs (old: { patches = old.patches or [] ++ [
|
||||||
|
./painting-api.patch
|
||||||
|
./fix-painting-api-crashes.patch
|
||||||
|
./painting-api-options.patch
|
||||||
|
./painting-api-pressure.patch
|
||||||
|
]; });
|
||||||
|
}).overrideAttrs (old: {
|
||||||
|
buildInputs = old.buildInputs ++ [ python3Packages.requests ];
|
||||||
|
})
|
145
pkgs/krita/fix-painting-api-crashes.patch
Normal file
145
pkgs/krita/fix-painting-api-crashes.patch
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
diff --git a/libs/libkis/Node.cpp b/libs/libkis/Node.cpp
|
||||||
|
index 84f24d3..0e2370e 100644
|
||||||
|
--- a/libs/libkis/Node.cpp
|
||||||
|
+++ b/libs/libkis/Node.cpp
|
||||||
|
@@ -76,6 +76,8 @@
|
||||||
|
#include "KisAsynchronousStrokeUpdateHelper.h"
|
||||||
|
#include "kis_stroke_strategy.h"
|
||||||
|
#include "PaintingResources.h"
|
||||||
|
+#include "KisMainWindow.h"
|
||||||
|
+#include "kis_canvas2.h"
|
||||||
|
|
||||||
|
|
||||||
|
struct Node::Private {
|
||||||
|
@@ -833,8 +835,48 @@ KisNodeSP Node::node() const
|
||||||
|
return d->node;
|
||||||
|
}
|
||||||
|
|
||||||
|
+QString Node::paintAbility()
|
||||||
|
+{
|
||||||
|
+ // Taken from KisTool:nodePaintAbility().
|
||||||
|
+ KisMainWindow *mainWindow = KisPart::instance()->currentMainwindow();
|
||||||
|
+ KisCanvas2 *canvas = mainWindow->activeView()->canvasBase();
|
||||||
|
+ if (canvas->resourceManager()->resource(KoCanvasResource::CurrentPaintOpPreset).isNull()) {
|
||||||
|
+ return "UNPAINTABLE";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!d->node) {
|
||||||
|
+ return "UNPAINTABLE";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (d->node->inherits("KisShapeLayer")) {
|
||||||
|
+ return "VECTOR";
|
||||||
|
+ }
|
||||||
|
+ if (d->node->inherits("KisCloneLayer")) {
|
||||||
|
+ return "CLONE";
|
||||||
|
+ }
|
||||||
|
+ if (d->node->paintDevice()) {
|
||||||
|
+
|
||||||
|
+ KisPaintOpPresetSP currentPaintOpPreset = canvas->resourceManager()->resource(KoCanvasResource::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
|
||||||
|
+ if (currentPaintOpPreset->paintOp().id() == "mypaintbrush") {
|
||||||
|
+ const KoColorSpace *colorSpace = d->node->paintDevice()->colorSpace();
|
||||||
|
+ if (colorSpace->colorModelId() != RGBAColorModelID) {
|
||||||
|
+ return "MYPAINTBRUSH_UNPAINTABLE";
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return "PAINT";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return "UNPAINTABLE";
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void Node::paintLine(const QPointF pointOne, const QPointF pointTwo)
|
||||||
|
{
|
||||||
|
+ if (paintAbility() != "PAINT") {
|
||||||
|
+ dbgScript << "Script attempted to use Node::paintLine() on an unpaintable node, ignoring.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
KisPaintInformation pointOneInfo;
|
||||||
|
pointOneInfo.setPressure(1.0);
|
||||||
|
pointOneInfo.setPos(pointOne);
|
||||||
|
@@ -850,6 +892,11 @@ void Node::paintLine(const QPointF pointOne, const QPointF pointTwo)
|
||||||
|
|
||||||
|
void Node::paintRectangle(const QRectF &rect)
|
||||||
|
{
|
||||||
|
+ if (paintAbility() != "PAINT") {
|
||||||
|
+ dbgScript << "Script attempted to use Node::paintRectangle() on an unpaintable node, ignoring.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// reference class where this stuff is being done. Maybe can use the "facade" like that does for setup?
|
||||||
|
// void KisFigurePaintingToolHelper::paintRect(const QRectF &rect)
|
||||||
|
|
||||||
|
@@ -860,6 +907,11 @@ void Node::paintRectangle(const QRectF &rect)
|
||||||
|
|
||||||
|
void Node::paintPolygon(const QList<QPointF> listPoint)
|
||||||
|
{
|
||||||
|
+ if (paintAbility() != "PAINT") {
|
||||||
|
+ dbgScript << "Script attempted to use Node::paintPolygon() on an unpaintable node, ignoring.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// strategy needs points in vPointF format
|
||||||
|
QVector<QPointF> points = points.fromList(listPoint);
|
||||||
|
KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
@@ -869,6 +921,11 @@ void Node::paintPolygon(const QList<QPointF> listPoint)
|
||||||
|
|
||||||
|
void Node::paintEllipse(const QRectF &rect)
|
||||||
|
{
|
||||||
|
+ if (paintAbility() != "PAINT") {
|
||||||
|
+ dbgScript << "Script attempted to use Node::paintEllipse() on an unpaintable node, ignoring.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
helper.paintEllipse(rect);
|
||||||
|
}
|
||||||
|
@@ -876,6 +933,11 @@ void Node::paintEllipse(const QRectF &rect)
|
||||||
|
|
||||||
|
void Node::paintPath(const QPainterPath &path)
|
||||||
|
{
|
||||||
|
+ if (paintAbility() != "PAINT") {
|
||||||
|
+ dbgScript << "Script attempted to use Node::paintPath() on an unpaintable node, ignoring.";
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
helper.paintPainterPath(path);
|
||||||
|
}
|
||||||
|
diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h
|
||||||
|
index 10daba4..89a6f40 100644
|
||||||
|
--- a/libs/libkis/Node.h
|
||||||
|
+++ b/libs/libkis/Node.h
|
||||||
|
@@ -601,6 +601,18 @@ public Q_SLOTS:
|
||||||
|
*/
|
||||||
|
void paintPath(const QPainterPath &path);
|
||||||
|
|
||||||
|
+ /**
|
||||||
|
+ * @brief paintAbility can be used to determine whether this node can be painted on with the current brush preset.
|
||||||
|
+ * @return QString, one of the following:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>VECTOR - This node is vector-based.</li>
|
||||||
|
+ * <li>CLONE - This node is a Clone Layer.</li>
|
||||||
|
+ * <li>PAINT - This node is paintable by the current brush preset.</li>
|
||||||
|
+ * <li>UNPAINTABLE - This node is not paintable, or a null preset is somehow selected./li>
|
||||||
|
+ * <li>MYPAINTBRUSH_UNPAINTABLE - This node's non-RGBA colorspace cannot be painted on by the currently selected MyPaint brush.</li>
|
||||||
|
+ */
|
||||||
|
+ QString paintAbility();
|
||||||
|
+
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class Filter;
|
||||||
|
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
index cbcef0f..6270bd9 100644
|
||||||
|
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
@@ -75,6 +75,7 @@ public Q_SLOTS:
|
||||||
|
void paintPolygon(const QList<QPointF> points);
|
||||||
|
void paintEllipse(const QRectF &rect);
|
||||||
|
void paintPath(const QPainterPath &path);
|
||||||
|
+ QString paintAbility();
|
||||||
|
Q_SIGNALS:
|
||||||
|
private:
|
||||||
|
};
|
332
pkgs/krita/painting-api-options.patch
Normal file
332
pkgs/krita/painting-api-options.patch
Normal file
|
@ -0,0 +1,332 @@
|
||||||
|
diff --git a/libs/libkis/Node.cpp b/libs/libkis/Node.cpp
|
||||||
|
index 0e2370e..3eed4ea 100644
|
||||||
|
--- a/libs/libkis/Node.cpp
|
||||||
|
+++ b/libs/libkis/Node.cpp
|
||||||
|
@@ -870,7 +870,7 @@ QString Node::paintAbility()
|
||||||
|
return "UNPAINTABLE";
|
||||||
|
}
|
||||||
|
|
||||||
|
-void Node::paintLine(const QPointF pointOne, const QPointF pointTwo)
|
||||||
|
+void Node::paintLine(const QPointF pointOne, const QPointF pointTwo, const QString strokeStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintLine() on an unpaintable node, ignoring.";
|
||||||
|
@@ -885,12 +885,12 @@ void Node::paintLine(const QPointF pointOne, const QPointF pointTwo)
|
||||||
|
pointTwoInfo.setPressure(1.0);
|
||||||
|
pointTwoInfo.setPos(pointTwo);
|
||||||
|
|
||||||
|
- KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle);
|
||||||
|
helper.paintLine(pointOneInfo, pointTwoInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-void Node::paintRectangle(const QRectF &rect)
|
||||||
|
+void Node::paintRectangle(const QRectF &rect, const QString strokeStyle, const QString fillStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintRectangle() on an unpaintable node, ignoring.";
|
||||||
|
@@ -900,12 +900,12 @@ void Node::paintRectangle(const QRectF &rect)
|
||||||
|
// reference class where this stuff is being done. Maybe can use the "facade" like that does for setup?
|
||||||
|
// void KisFigurePaintingToolHelper::paintRect(const QRectF &rect)
|
||||||
|
|
||||||
|
- KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle, fillStyle);
|
||||||
|
helper.paintRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-void Node::paintPolygon(const QList<QPointF> listPoint)
|
||||||
|
+void Node::paintPolygon(const QList<QPointF> listPoint, const QString strokeStyle, const QString fillStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintPolygon() on an unpaintable node, ignoring.";
|
||||||
|
@@ -914,30 +914,30 @@ void Node::paintPolygon(const QList<QPointF> listPoint)
|
||||||
|
|
||||||
|
// strategy needs points in vPointF format
|
||||||
|
QVector<QPointF> points = points.fromList(listPoint);
|
||||||
|
- KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle, fillStyle);
|
||||||
|
helper.paintPolygon(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-void Node::paintEllipse(const QRectF &rect)
|
||||||
|
+void Node::paintEllipse(const QRectF &rect, const QString strokeStyle, const QString fillStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintEllipse() on an unpaintable node, ignoring.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle, fillStyle);
|
||||||
|
helper.paintEllipse(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-void Node::paintPath(const QPainterPath &path)
|
||||||
|
+void Node::paintPath(const QPainterPath &path, const QString strokeStyle, const QString fillStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintPath() on an unpaintable node, ignoring.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle, fillStyle);
|
||||||
|
helper.paintPainterPath(path);
|
||||||
|
}
|
||||||
|
diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h
|
||||||
|
index 89a6f40..ecf9845 100644
|
||||||
|
--- a/libs/libkis/Node.h
|
||||||
|
+++ b/libs/libkis/Node.h
|
||||||
|
@@ -13,6 +13,8 @@
|
||||||
|
#include "kritalibkis_export.h"
|
||||||
|
#include "libkis.h"
|
||||||
|
|
||||||
|
+#include "PaintingResources.h"
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Node represents a layer or mask in a Krita image's Node hierarchy. Group layers can contain
|
||||||
|
* other layers and masks; layers can contain masks.
|
||||||
|
@@ -574,33 +576,101 @@ public Q_SLOTS:
|
||||||
|
* @brief paint a line on the canvas. Uses current brush preset
|
||||||
|
* @param pointOne starting point
|
||||||
|
* @param pointTwo end point
|
||||||
|
+ * @param strokeStyle appearance of the outline, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None - will use Foreground Color, since line would be invisible otherwise
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * </ul>
|
||||||
|
*/
|
||||||
|
- void paintLine(const QPointF pointOne, const QPointF pointTwo);
|
||||||
|
+ void paintLine(const QPointF pointOne, const QPointF pointTwo, const QString strokeStyle = PaintingResources::defaultStrokeStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief paint a rectangle on the canvas. Uses current brush preset
|
||||||
|
* @param rect QRect with x, y, width, and height
|
||||||
|
+ * @param strokeStyle appearance of the outline, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is ForegroundColor.
|
||||||
|
+ * @param fillStyle appearance of the fill, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * <li>Pattern</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is None.
|
||||||
|
*/
|
||||||
|
- void paintRectangle(const QRectF &rect);
|
||||||
|
+ void paintRectangle(const QRectF &rect,
|
||||||
|
+ const QString strokeStyle = PaintingResources::defaultStrokeStyle,
|
||||||
|
+ const QString fillStyle = PaintingResources::defaultFillStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief paint a polygon on the canvas. Uses current brush preset
|
||||||
|
* @param list of Qpoints
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is ForegroundColor.
|
||||||
|
+ * @param fillStyle appearance of the fill, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * <li>Pattern</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is None.
|
||||||
|
*/
|
||||||
|
- void paintPolygon(const QList<QPointF> points);
|
||||||
|
-
|
||||||
|
+ void paintPolygon(const QList<QPointF> points,
|
||||||
|
+ const QString strokeStyle = PaintingResources::defaultStrokeStyle,
|
||||||
|
+ const QString fillStyle = PaintingResources::defaultFillStyle);
|
||||||
|
/**
|
||||||
|
* @brief paint an ellipse on the canvas. Uses current brush preset
|
||||||
|
* @param rect QRect with x, y, width, and height
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is ForegroundColor.
|
||||||
|
+ * @param fillStyle appearance of the fill, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * <li>Pattern</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is None.
|
||||||
|
*/
|
||||||
|
- void paintEllipse(const QRectF &rect);
|
||||||
|
-
|
||||||
|
+ void paintEllipse(const QRectF &rect,
|
||||||
|
+ const QString strokeStyle = PaintingResources::defaultStrokeStyle,
|
||||||
|
+ const QString fillStyle = PaintingResources::defaultFillStyle);
|
||||||
|
/**
|
||||||
|
* @brief paint a custom path on the canvas. Uses current brush preset
|
||||||
|
* @param path QPainterPath to determine path
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is ForegroundColor.
|
||||||
|
+ * @param fillStyle appearance of the fill, one of:
|
||||||
|
+ * <ul>
|
||||||
|
+ * <li>None
|
||||||
|
+ * <li>ForegroundColor</li>
|
||||||
|
+ * <li>BackgroundColor</li>
|
||||||
|
+ * <li>Pattern</li>
|
||||||
|
+ * </ul>
|
||||||
|
+ * Default is None.
|
||||||
|
*/
|
||||||
|
- void paintPath(const QPainterPath &path);
|
||||||
|
-
|
||||||
|
+ void paintPath(const QPainterPath &path,
|
||||||
|
+ const QString strokeStyle = PaintingResources::defaultStrokeStyle,
|
||||||
|
+ const QString fillStyle = PaintingResources::defaultFillStyle);
|
||||||
|
/**
|
||||||
|
* @brief paintAbility can be used to determine whether this node can be painted on with the current brush preset.
|
||||||
|
* @return QString, one of the following:
|
||||||
|
@@ -610,6 +680,7 @@ public Q_SLOTS:
|
||||||
|
* <li>PAINT - This node is paintable by the current brush preset.</li>
|
||||||
|
* <li>UNPAINTABLE - This node is not paintable, or a null preset is somehow selected./li>
|
||||||
|
* <li>MYPAINTBRUSH_UNPAINTABLE - This node's non-RGBA colorspace cannot be painted on by the currently selected MyPaint brush.</li>
|
||||||
|
+ * </ul>
|
||||||
|
*/
|
||||||
|
QString paintAbility();
|
||||||
|
|
||||||
|
diff --git a/libs/libkis/PaintingResources.cpp b/libs/libkis/PaintingResources.cpp
|
||||||
|
index 62abb26..58d67ae 100644
|
||||||
|
--- a/libs/libkis/PaintingResources.cpp
|
||||||
|
+++ b/libs/libkis/PaintingResources.cpp
|
||||||
|
@@ -53,9 +53,28 @@
|
||||||
|
#include "kis_painting_information_builder.h"
|
||||||
|
#include "KisAsynchronousStrokeUpdateHelper.h"
|
||||||
|
#include "kis_stroke_strategy.h"
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-KisFigurePaintingToolHelper PaintingResources::createHelper(KisImageWSP image)
|
||||||
|
+#include "KisViewManager.h"
|
||||||
|
+#include "KisMainWindow.h"
|
||||||
|
+#include "kis_image.h"
|
||||||
|
+#include "KisToolShapeUtils.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+const QStringList StrokeStyle = {
|
||||||
|
+ "None", // 0 = KisToolShapeUtils::StrokeStyle::StrokeStyleNone
|
||||||
|
+ "ForegroundColor", // KisToolShapeUtils::StrokeStyle::StrokeStyleForeground
|
||||||
|
+ "BackgroundColor" // KisToolShapeUtils::StrokeStyle::StrokeStyleBackground
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+const QStringList FillStyle = {
|
||||||
|
+ "None", // 0 = KisToolShapeUtils::FillStyle::FillStyleNone
|
||||||
|
+ "ForegroundColor", // KisToolShapeUtils::FillStyle::FillStyleForegroundColor
|
||||||
|
+ "BackgroundColor", // KisToolShapeUtils::FillStyle::FillStyleBackgroundColor
|
||||||
|
+ "Pattern" // KisToolShapeUtils::FillStyle::FillStylePattern
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+KisFigurePaintingToolHelper PaintingResources::createHelper(KisImageWSP image,
|
||||||
|
+ const QString strokeStyleString,
|
||||||
|
+ const QString fillStyleString)
|
||||||
|
{
|
||||||
|
// need to grab the resource provider
|
||||||
|
KisView *activeView = KisPart::instance()->currentMainwindow()->activeView();
|
||||||
|
@@ -64,13 +83,35 @@ KisFigurePaintingToolHelper PaintingResources::createHelper(KisImageWSP image)
|
||||||
|
// grab the image and current layer
|
||||||
|
KisNodeSP node = activeView->currentNode();
|
||||||
|
|
||||||
|
- const KUndo2MagicString name = kundo2_noi18n("python_stroke");
|
||||||
|
+ int strokeIndex = StrokeStyle.indexOf(strokeStyleString);
|
||||||
|
+ if (strokeIndex == -1) {
|
||||||
|
+ dbgScript << "Script tried to paint with invalid strokeStyle" << strokeStyleString << ", ignoring and using" << defaultStrokeStyle << ".";
|
||||||
|
+ strokeIndex = StrokeStyle.indexOf(defaultStrokeStyle);
|
||||||
|
+ if (strokeIndex == -1) {
|
||||||
|
+ warnScript << "PaintingResources::createHelper(): defaultStrokeStyle" << defaultStrokeStyle << "is invalid!";
|
||||||
|
+ strokeIndex = 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ KisToolShapeUtils::StrokeStyle strokeStyle = (KisToolShapeUtils::StrokeStyle) strokeIndex;
|
||||||
|
+
|
||||||
|
+ int fillIndex = FillStyle.indexOf(fillStyleString);
|
||||||
|
+ if (fillIndex == -1) {
|
||||||
|
+ dbgScript << "Script tried to paint with invalid fillStyle" << fillStyleString << ", ignoring and using" << defaultFillStyle << ".";
|
||||||
|
+ fillIndex = FillStyle.indexOf(defaultFillStyle);
|
||||||
|
+ if (fillIndex == -1) {
|
||||||
|
+ warnScript << "PaintingResources::createHelper(): defaultFillStyle" << defaultFillStyle << " is invalid!";
|
||||||
|
+ fillIndex = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ KisToolShapeUtils::FillStyle fillStyle = (KisToolShapeUtils::FillStyle) fillIndex;
|
||||||
|
+
|
||||||
|
+ const KUndo2MagicString name = kundo2_i18n("Scripted Brush Stroke");
|
||||||
|
KisFigurePaintingToolHelper helper(
|
||||||
|
name,
|
||||||
|
image,
|
||||||
|
node, resourceManager,
|
||||||
|
- KisToolShapeUtils::StrokeStyle::StrokeStyleForeground,
|
||||||
|
- KisToolShapeUtils::FillStyle::FillStyleNone
|
||||||
|
+ strokeStyle,
|
||||||
|
+ fillStyle
|
||||||
|
);
|
||||||
|
|
||||||
|
return helper;
|
||||||
|
diff --git a/libs/libkis/PaintingResources.h b/libs/libkis/PaintingResources.h
|
||||||
|
index 19bb0d4..174057a 100644
|
||||||
|
--- a/libs/libkis/PaintingResources.h
|
||||||
|
+++ b/libs/libkis/PaintingResources.h
|
||||||
|
@@ -35,12 +35,19 @@
|
||||||
|
/**
|
||||||
|
* @brief The PaintingResources namespace
|
||||||
|
* Sets up information related to making painting strokes.
|
||||||
|
- * Used primarily in the Document class
|
||||||
|
+ * Used primarily in the Node class
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace PaintingResources
|
||||||
|
{
|
||||||
|
- KisFigurePaintingToolHelper createHelper(KisImageWSP image);
|
||||||
|
+ // These are set in Node.sip
|
||||||
|
+ const QString defaultStrokeStyle = "ForegroundColor";
|
||||||
|
+ const QString defaultFillStyle = "None";
|
||||||
|
+
|
||||||
|
+ KisFigurePaintingToolHelper createHelper(KisImageWSP image,
|
||||||
|
+ const QString strokeStyle = defaultStrokeStyle,
|
||||||
|
+ const QString fillStyle = defaultFillStyle);
|
||||||
|
+
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LIBKIS_PAINTINGRESOURCES_H
|
||||||
|
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
index 6270bd9..884e615 100644
|
||||||
|
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
@@ -70,11 +70,11 @@ public Q_SLOTS:
|
||||||
|
int index() const;
|
||||||
|
QUuid uniqueId() const;
|
||||||
|
|
||||||
|
- void paintLine(const QPoint pointOne, const QPoint pointTwo);
|
||||||
|
- void paintRectangle(const QRectF &rect);
|
||||||
|
- void paintPolygon(const QList<QPointF> points);
|
||||||
|
- void paintEllipse(const QRectF &rect);
|
||||||
|
- void paintPath(const QPainterPath &path);
|
||||||
|
+ void paintLine(const QPoint pointOne, const QPoint pointTwo, const QString strokeStyle = "ForegroundColor");
|
||||||
|
+ void paintRectangle(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
+ void paintPolygon(const QList<QPointF> points, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
+ void paintEllipse(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
+ void paintPath(const QPainterPath &path, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
QString paintAbility();
|
||||||
|
Q_SIGNALS:
|
||||||
|
private:
|
66
pkgs/krita/painting-api-pressure.patch
Normal file
66
pkgs/krita/painting-api-pressure.patch
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
diff --git a/libs/libkis/Node.cpp b/libs/libkis/Node.cpp
|
||||||
|
index 7e15b58c2c..a187c18aad 100644
|
||||||
|
--- a/libs/libkis/Node.cpp
|
||||||
|
+++ b/libs/libkis/Node.cpp
|
||||||
|
@@ -863,7 +863,7 @@ QString Node::paintAbility()
|
||||||
|
return "UNPAINTABLE";
|
||||||
|
}
|
||||||
|
|
||||||
|
-void Node::paintLine(const QPointF pointOne, const QPointF pointTwo, const QString strokeStyle)
|
||||||
|
+void Node::paintLine(const QPointF pointOne, const QPointF pointTwo, double pressureOne, double pressureTwo, const QString strokeStyle)
|
||||||
|
{
|
||||||
|
if (paintAbility() != "PAINT") {
|
||||||
|
dbgScript << "Script attempted to use Node::paintLine() on an unpaintable node, ignoring.";
|
||||||
|
@@ -871,11 +871,11 @@ void Node::paintLine(const QPointF pointOne, const QPointF pointTwo, const QStri
|
||||||
|
}
|
||||||
|
|
||||||
|
KisPaintInformation pointOneInfo;
|
||||||
|
- pointOneInfo.setPressure(1.0);
|
||||||
|
+ pointOneInfo.setPressure(pressureOne);
|
||||||
|
pointOneInfo.setPos(pointOne);
|
||||||
|
|
||||||
|
KisPaintInformation pointTwoInfo;
|
||||||
|
- pointTwoInfo.setPressure(1.0);
|
||||||
|
+ pointTwoInfo.setPressure(pressureTwo);
|
||||||
|
pointTwoInfo.setPos(pointTwo);
|
||||||
|
|
||||||
|
KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image, strokeStyle);
|
||||||
|
diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h
|
||||||
|
index ecf9845a22..ce63d3f1bc 100644
|
||||||
|
--- a/libs/libkis/Node.h
|
||||||
|
+++ b/libs/libkis/Node.h
|
||||||
|
@@ -576,6 +576,8 @@ public Q_SLOTS:
|
||||||
|
* @brief paint a line on the canvas. Uses current brush preset
|
||||||
|
* @param pointOne starting point
|
||||||
|
* @param pointTwo end point
|
||||||
|
+ * @param pressureOne starting pressure
|
||||||
|
+ * @param pressureTwo end pressure
|
||||||
|
* @param strokeStyle appearance of the outline, one of:
|
||||||
|
* <ul>
|
||||||
|
* <li>None - will use Foreground Color, since line would be invisible otherwise
|
||||||
|
@@ -583,7 +585,11 @@ public Q_SLOTS:
|
||||||
|
* <li>BackgroundColor</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
- void paintLine(const QPointF pointOne, const QPointF pointTwo, const QString strokeStyle = PaintingResources::defaultStrokeStyle);
|
||||||
|
+ void paintLine(const QPointF pointOne,
|
||||||
|
+ const QPointF pointTwo,
|
||||||
|
+ double pressureOne = 1.0,
|
||||||
|
+ double pressureTwo = 1.0,
|
||||||
|
+ const QString strokeStyle = PaintingResources::defaultStrokeStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief paint a rectangle on the canvas. Uses current brush preset
|
||||||
|
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
index a01a6bce6f..986cc54169 100644
|
||||||
|
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
@@ -82,7 +82,7 @@ public Q_SLOTS:
|
||||||
|
int index() const;
|
||||||
|
QUuid uniqueId() const;
|
||||||
|
|
||||||
|
- void paintLine(const QPoint pointOne, const QPoint pointTwo, const QString strokeStyle = "ForegroundColor");
|
||||||
|
+ void paintLine(const QPoint pointOne, const QPoint pointTwo, double pressureOne = 1.0, double pressureTwo = 1.0, const QString strokeStyle = "ForegroundColor");
|
||||||
|
void paintRectangle(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
void paintPolygon(const QList<QPointF> points, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
||||||
|
void paintEllipse(const QRectF &rect, const QString strokeStyle = "ForegroundColor", const QString fillStyle = "None");
|
309
pkgs/krita/painting-api.patch
Normal file
309
pkgs/krita/painting-api.patch
Normal file
|
@ -0,0 +1,309 @@
|
||||||
|
diff --git a/libs/libkis/CMakeLists.txt b/libs/libkis/CMakeLists.txt
|
||||||
|
index a337451..66a5166 100644
|
||||||
|
--- a/libs/libkis/CMakeLists.txt
|
||||||
|
+++ b/libs/libkis/CMakeLists.txt
|
||||||
|
@@ -10,6 +10,7 @@ set(kritalibkis_LIB_SRCS
|
||||||
|
ManagedColor.cpp
|
||||||
|
Node.cpp
|
||||||
|
Notifier.cpp
|
||||||
|
+ PaintingResources.cpp
|
||||||
|
PresetChooser.cpp
|
||||||
|
Preset.cpp
|
||||||
|
Palette.cpp
|
||||||
|
diff --git a/libs/libkis/Document.h b/libs/libkis/Document.h
|
||||||
|
index 998a350..841c319 100644
|
||||||
|
--- a/libs/libkis/Document.h
|
||||||
|
+++ b/libs/libkis/Document.h
|
||||||
|
@@ -6,8 +6,6 @@
|
||||||
|
#ifndef LIBKIS_DOCUMENT_H
|
||||||
|
#define LIBKIS_DOCUMENT_H
|
||||||
|
|
||||||
|
-#include <QObject>
|
||||||
|
-
|
||||||
|
#include "kritalibkis_export.h"
|
||||||
|
#include "libkis.h"
|
||||||
|
|
||||||
|
diff --git a/libs/libkis/Node.cpp b/libs/libkis/Node.cpp
|
||||||
|
index 3fd7b5a..84f24d3 100644
|
||||||
|
--- a/libs/libkis/Node.cpp
|
||||||
|
+++ b/libs/libkis/Node.cpp
|
||||||
|
@@ -67,6 +67,17 @@
|
||||||
|
#include "LibKisUtils.h"
|
||||||
|
#include <kis_layer_utils.h>
|
||||||
|
|
||||||
|
+#include <KoCanvasResourceProvider.h>
|
||||||
|
+#include "strokes/KisFreehandStrokeInfo.h"
|
||||||
|
+#include "kis_resources_snapshot.h"
|
||||||
|
+#include "kis_canvas_resource_provider.h"
|
||||||
|
+#include "strokes/freehand_stroke.h"
|
||||||
|
+#include "kis_painting_information_builder.h"
|
||||||
|
+#include "KisAsynchronousStrokeUpdateHelper.h"
|
||||||
|
+#include "kis_stroke_strategy.h"
|
||||||
|
+#include "PaintingResources.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
struct Node::Private {
|
||||||
|
Private() {}
|
||||||
|
KisImageWSP image;
|
||||||
|
@@ -821,3 +832,50 @@ KisNodeSP Node::node() const
|
||||||
|
{
|
||||||
|
return d->node;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+void Node::paintLine(const QPointF pointOne, const QPointF pointTwo)
|
||||||
|
+{
|
||||||
|
+ KisPaintInformation pointOneInfo;
|
||||||
|
+ pointOneInfo.setPressure(1.0);
|
||||||
|
+ pointOneInfo.setPos(pointOne);
|
||||||
|
+
|
||||||
|
+ KisPaintInformation pointTwoInfo;
|
||||||
|
+ pointTwoInfo.setPressure(1.0);
|
||||||
|
+ pointTwoInfo.setPos(pointTwo);
|
||||||
|
+
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ helper.paintLine(pointOneInfo, pointTwoInfo);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void Node::paintRectangle(const QRectF &rect)
|
||||||
|
+{
|
||||||
|
+ // reference class where this stuff is being done. Maybe can use the "facade" like that does for setup?
|
||||||
|
+ // void KisFigurePaintingToolHelper::paintRect(const QRectF &rect)
|
||||||
|
+
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ helper.paintRect(rect);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void Node::paintPolygon(const QList<QPointF> listPoint)
|
||||||
|
+{
|
||||||
|
+ // strategy needs points in vPointF format
|
||||||
|
+ QVector<QPointF> points = points.fromList(listPoint);
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ helper.paintPolygon(points);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void Node::paintEllipse(const QRectF &rect)
|
||||||
|
+{
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ helper.paintEllipse(rect);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void Node::paintPath(const QPainterPath &path)
|
||||||
|
+{
|
||||||
|
+ KisFigurePaintingToolHelper helper = PaintingResources::createHelper(d->image);
|
||||||
|
+ helper.paintPainterPath(path);
|
||||||
|
+}
|
||||||
|
diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h
|
||||||
|
index 1a40372..10daba4 100644
|
||||||
|
--- a/libs/libkis/Node.h
|
||||||
|
+++ b/libs/libkis/Node.h
|
||||||
|
@@ -570,6 +570,36 @@ public Q_SLOTS:
|
||||||
|
*/
|
||||||
|
QUuid uniqueId() const;
|
||||||
|
|
||||||
|
+ /**
|
||||||
|
+ * @brief paint a line on the canvas. Uses current brush preset
|
||||||
|
+ * @param pointOne starting point
|
||||||
|
+ * @param pointTwo end point
|
||||||
|
+ */
|
||||||
|
+ void paintLine(const QPointF pointOne, const QPointF pointTwo);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @brief paint a rectangle on the canvas. Uses current brush preset
|
||||||
|
+ * @param rect QRect with x, y, width, and height
|
||||||
|
+ */
|
||||||
|
+ void paintRectangle(const QRectF &rect);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @brief paint a polygon on the canvas. Uses current brush preset
|
||||||
|
+ * @param list of Qpoints
|
||||||
|
+ */
|
||||||
|
+ void paintPolygon(const QList<QPointF> points);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @brief paint an ellipse on the canvas. Uses current brush preset
|
||||||
|
+ * @param rect QRect with x, y, width, and height
|
||||||
|
+ */
|
||||||
|
+ void paintEllipse(const QRectF &rect);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @brief paint a custom path on the canvas. Uses current brush preset
|
||||||
|
+ * @param path QPainterPath to determine path
|
||||||
|
+ */
|
||||||
|
+ void paintPath(const QPainterPath &path);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
diff --git a/libs/libkis/PaintingResources.cpp b/libs/libkis/PaintingResources.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..62abb26
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libs/libkis/PaintingResources.cpp
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2020 Scott Petrovic <scottpetrovic@gmail.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU Lesser 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 Lesser 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 "PaintingResources.h"
|
||||||
|
+
|
||||||
|
+#include <kis_types.h>
|
||||||
|
+
|
||||||
|
+#include "KisView.h"
|
||||||
|
+#include "kis_types.h"
|
||||||
|
+
|
||||||
|
+#include "kis_canvas_resource_provider.h"
|
||||||
|
+#include "kis_paintop_preset.h"
|
||||||
|
+
|
||||||
|
+#include "KisViewManager.h"
|
||||||
|
+#include "KisGlobalResourcesInterface.h"
|
||||||
|
+
|
||||||
|
+#include <KoResourcePaths.h>
|
||||||
|
+
|
||||||
|
+#include "Document.h"
|
||||||
|
+
|
||||||
|
+#include <KisPart.h>
|
||||||
|
+#include <KisMainWindow.h>
|
||||||
|
+
|
||||||
|
+#include <kis_types.h>
|
||||||
|
+#include <kis_annotation.h>
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#include "kis_animation_importer.h"
|
||||||
|
+#include <kis_canvas2.h>
|
||||||
|
+#include <KoUpdater.h>
|
||||||
|
+#include <QMessageBox>
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#include "strokes/KisFreehandStrokeInfo.h"
|
||||||
|
+#include "kis_resources_snapshot.h"
|
||||||
|
+#include "kis_canvas_resource_provider.h"
|
||||||
|
+#include "strokes/freehand_stroke.h"
|
||||||
|
+#include "kis_painting_information_builder.h"
|
||||||
|
+#include "KisAsynchronousStrokeUpdateHelper.h"
|
||||||
|
+#include "kis_stroke_strategy.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+KisFigurePaintingToolHelper PaintingResources::createHelper(KisImageWSP image)
|
||||||
|
+{
|
||||||
|
+ // need to grab the resource provider
|
||||||
|
+ KisView *activeView = KisPart::instance()->currentMainwindow()->activeView();
|
||||||
|
+ KoCanvasResourceProvider *resourceManager = activeView->viewManager()->canvasResourceProvider()->resourceManager();
|
||||||
|
+
|
||||||
|
+ // grab the image and current layer
|
||||||
|
+ KisNodeSP node = activeView->currentNode();
|
||||||
|
+
|
||||||
|
+ const KUndo2MagicString name = kundo2_noi18n("python_stroke");
|
||||||
|
+ KisFigurePaintingToolHelper helper(
|
||||||
|
+ name,
|
||||||
|
+ image,
|
||||||
|
+ node, resourceManager,
|
||||||
|
+ KisToolShapeUtils::StrokeStyle::StrokeStyleForeground,
|
||||||
|
+ KisToolShapeUtils::FillStyle::FillStyleNone
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
+ return helper;
|
||||||
|
+}
|
||||||
|
diff --git a/libs/libkis/PaintingResources.h b/libs/libkis/PaintingResources.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..19bb0d4
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libs/libkis/PaintingResources.h
|
||||||
|
@@ -0,0 +1,46 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2020 Scott Petrovic <scottpetrovic@gmail.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU Lesser 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 Lesser 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 LIBKIS_PAINTINGRESOURCES_H
|
||||||
|
+#define LIBKIS_PAINTINGRESOURCES_H
|
||||||
|
+
|
||||||
|
+#include <QObject>
|
||||||
|
+#include <QColor>
|
||||||
|
+#include <kis_types.h>
|
||||||
|
+
|
||||||
|
+#include "kritalibkis_export.h"
|
||||||
|
+#include "KoCanvasResourceProvider.h"
|
||||||
|
+#include "kis_stroke_strategy.h"
|
||||||
|
+
|
||||||
|
+#include <kis_figure_painting_tool_helper.h>
|
||||||
|
+
|
||||||
|
+#include "libkis.h"
|
||||||
|
+
|
||||||
|
+#include "View.h"
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * @brief The PaintingResources namespace
|
||||||
|
+ * Sets up information related to making painting strokes.
|
||||||
|
+ * Used primarily in the Document class
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+namespace PaintingResources
|
||||||
|
+{
|
||||||
|
+ KisFigurePaintingToolHelper createHelper(KisImageWSP image);
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif // LIBKIS_PAINTINGRESOURCES_H
|
||||||
|
diff --git a/libs/ui/tool/kis_resources_snapshot.cpp b/libs/ui/tool/kis_resources_snapshot.cpp
|
||||||
|
index dca6ba5..0c031e0 100644
|
||||||
|
--- a/libs/ui/tool/kis_resources_snapshot.cpp
|
||||||
|
+++ b/libs/ui/tool/kis_resources_snapshot.cpp
|
||||||
|
@@ -75,8 +75,11 @@ KisResourcesSnapshot::KisResourcesSnapshot(KisImageSP image, KisNodeSP currentNo
|
||||||
|
m_d->currentBgColor = resourceManager->resource(KoCanvasResource::BackgroundColor).value<KoColor>();
|
||||||
|
m_d->currentPattern = resourceManager->resource(KoCanvasResource::CurrentPattern).value<KoPatternSP>();
|
||||||
|
if (resourceManager->resource(KoCanvasResource::CurrentGradient).value<KoAbstractGradientSP>()) {
|
||||||
|
- m_d->currentGradient = resourceManager->resource(KoCanvasResource::CurrentGradient).value<KoAbstractGradientSP>()
|
||||||
|
- ->cloneAndBakeVariableColors(m_d->globalCanvasResourcesInterface);
|
||||||
|
+ m_d->currentGradient = resourceManager->resource(KoCanvasResource::CurrentGradient).value<KoAbstractGradientSP>();
|
||||||
|
+ if(m_d->currentGradient) {
|
||||||
|
+ m_d->currentGradient = resourceManager->resource(KoCanvasResource::CurrentGradient).value<KoAbstractGradientSP>()
|
||||||
|
+ ->cloneAndBakeVariableColors(m_d->globalCanvasResourcesInterface);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
index 3066bfb..cbcef0f 100644
|
||||||
|
--- a/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
+++ b/plugins/extensions/pykrita/sip/krita/Node.sip
|
||||||
|
@@ -69,6 +69,12 @@ public Q_SLOTS:
|
||||||
|
void setLayerStyleFromAsl(const QString &asl);
|
||||||
|
int index() const;
|
||||||
|
QUuid uniqueId() const;
|
||||||
|
+
|
||||||
|
+ void paintLine(const QPoint pointOne, const QPoint pointTwo);
|
||||||
|
+ void paintRectangle(const QRectF &rect);
|
||||||
|
+ void paintPolygon(const QList<QPointF> points);
|
||||||
|
+ void paintEllipse(const QRectF &rect);
|
||||||
|
+ void paintPath(const QPainterPath &path);
|
||||||
|
Q_SIGNALS:
|
||||||
|
private:
|
||||||
|
};
|
|
@ -78,6 +78,8 @@ in {
|
||||||
{ directory = /var/lib/certspotter; user = "certspotter"; group = "certspotter"; mode = "0755"; }
|
{ directory = /var/lib/certspotter; user = "certspotter"; group = "certspotter"; mode = "0755"; }
|
||||||
] ++ lib.optionals (config.services.coop-fd.enable or false) [
|
] ++ lib.optionals (config.services.coop-fd.enable or false) [
|
||||||
{ directory = /var/lib/private/coop-fd; mode = "0750"; defaultPerms.mode = "0700"; }
|
{ directory = /var/lib/private/coop-fd; mode = "0750"; defaultPerms.mode = "0700"; }
|
||||||
|
] ++ lib.optionals config.virtualisation.docker.enable [
|
||||||
|
{ directory = /var/lib/docker; user = "root"; group = "root"; mode = "0710"; }
|
||||||
] ++ lib.optionals config.services.dovecot2.enable [
|
] ++ lib.optionals config.services.dovecot2.enable [
|
||||||
{ directory = /var/lib/dhparams; user = "root"; group = "root"; mode = "0755"; }
|
{ directory = /var/lib/dhparams; user = "root"; group = "root"; mode = "0755"; }
|
||||||
{ directory = /var/lib/dovecot; user = "root"; group = "root"; mode = "0755"; }
|
{ directory = /var/lib/dovecot; user = "root"; group = "root"; mode = "0755"; }
|
||||||
|
|
Loading…
Reference in a new issue