From 7f140828bbc87ed573d3329fb42d8e5218af8c52 Mon Sep 17 00:00:00 2001 From: Hubert Kowalski Date: Sat, 14 Aug 2021 13:01:00 +0200 Subject: [PATCH 1/2] add harmonic armature guide --- contrib/harmonic_armature_guide.lua | 84 +++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 contrib/harmonic_armature_guide.lua diff --git a/contrib/harmonic_armature_guide.lua b/contrib/harmonic_armature_guide.lua new file mode 100644 index 0000000..7376e00 --- /dev/null +++ b/contrib/harmonic_armature_guide.lua @@ -0,0 +1,84 @@ +--[[ + harmonic artmature guide for darktable + + copyright (c) 2021 Hubert Kowalski + + darktable 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. + + darktable 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 darktable. If not, see . +]] + +--[[ +HARMONIC ARMATURE GUIDE +Harmonic Armature (also known as 14 line armature) + +INSTALLATION +* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory +* add the following line in the file $CONFIGDIR/luarc + require "harmonic_armature_guide" + +USAGE +* when using guides, select "harmonic armature" as guide +]] + +local dt = require "darktable" +local du = require "lib/dtutils" +local gettext = dt.gettext + +du.check_min_api_version("2.0.0", "harmonic_armature_guide") + +-- Tell gettext where to find the .mo file translating messages for a particular domain +gettext.bindtextdomain("harmonic_armature_guide",dt.configuration.config_dir.."/lua/locale/") + +local function _(msgid) + return gettext.dgettext("harmonic_armature_guide", msgid) +end + +dt.guides.register_guide("harmonic armature", +-- draw +function(cairo, x, y, width, height, zoom_scale) + cairo:save() + + cairo:translate(x, y) + cairo:scale(width, height) + + cairo:move_to(0,0) + cairo:line_to(1, 0.5) + cairo:line_to(0.5, 1) + cairo:line_to(0,0) + cairo:line_to(1, 1) + cairo:line_to(0.5, 0) + cairo:line_to(0, 0.5) + cairo:line_to(1, 1) + + cairo:move_to(1, 0) + cairo:line_to(0, 0.5) + cairo:line_to(0.5, 1) + cairo:line_to(1, 0) + cairo:line_to(0, 1) + cairo:line_to(0.5, 0) + cairo:line_to(1, 0.5) + cairo:line_to(0, 1) + + -- middle lines - not needed for harmonic armature + -- cairo:move_to(0,0.5) + -- cairo:line_to(1,0.5) + -- cairo:move_to(0.5,0) + -- cairo:line_to(0.5,1) + + cairo:restore() +end, +-- gui +function() + return dt.new_widget("label"){label = _("harmonic armature"), halign = "start"} +end +) \ No newline at end of file From d14215105599c804e34a0a62512fd4e081078ffd Mon Sep 17 00:00:00 2001 From: Hubert Kowalski Date: Sun, 15 Aug 2021 22:43:13 +0200 Subject: [PATCH 2/2] fix lines and contrib require --- contrib/harmonic_armature_guide.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/contrib/harmonic_armature_guide.lua b/contrib/harmonic_armature_guide.lua index 7376e00..e5c23f2 100644 --- a/contrib/harmonic_armature_guide.lua +++ b/contrib/harmonic_armature_guide.lua @@ -22,9 +22,9 @@ HARMONIC ARMATURE GUIDE Harmonic Armature (also known as 14 line armature) INSTALLATION -* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory +* copy this file in $CONFIGDIR/lua/contrib where CONFIGDIR is your darktable configuration directory * add the following line in the file $CONFIGDIR/luarc - require "harmonic_armature_guide" + require "contrib/harmonic_armature_guide" USAGE * when using guides, select "harmonic armature" as guide @@ -69,12 +69,6 @@ function(cairo, x, y, width, height, zoom_scale) cairo:line_to(1, 0.5) cairo:line_to(0, 1) - -- middle lines - not needed for harmonic armature - -- cairo:move_to(0,0.5) - -- cairo:line_to(1,0.5) - -- cairo:move_to(0.5,0) - -- cairo:line_to(0.5,1) - cairo:restore() end, -- gui