Skip to content

Commit 7f14082

Browse files
committed
add harmonic armature guide
1 parent 4f13a56 commit 7f14082

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

contrib/harmonic_armature_guide.lua

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
--[[
2+
harmonic artmature guide for darktable
3+
4+
copyright (c) 2021 Hubert Kowalski
5+
6+
darktable is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
darktable is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with darktable. If not, see <http://www.gnu.org/licenses/>.
18+
]]
19+
20+
--[[
21+
HARMONIC ARMATURE GUIDE
22+
Harmonic Armature (also known as 14 line armature)
23+
24+
INSTALLATION
25+
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
26+
* add the following line in the file $CONFIGDIR/luarc
27+
require "harmonic_armature_guide"
28+
29+
USAGE
30+
* when using guides, select "harmonic armature" as guide
31+
]]
32+
33+
local dt = require "darktable"
34+
local du = require "lib/dtutils"
35+
local gettext = dt.gettext
36+
37+
du.check_min_api_version("2.0.0", "harmonic_armature_guide")
38+
39+
-- Tell gettext where to find the .mo file translating messages for a particular domain
40+
gettext.bindtextdomain("harmonic_armature_guide",dt.configuration.config_dir.."/lua/locale/")
41+
42+
local function _(msgid)
43+
return gettext.dgettext("harmonic_armature_guide", msgid)
44+
end
45+
46+
dt.guides.register_guide("harmonic armature",
47+
-- draw
48+
function(cairo, x, y, width, height, zoom_scale)
49+
cairo:save()
50+
51+
cairo:translate(x, y)
52+
cairo:scale(width, height)
53+
54+
cairo:move_to(0,0)
55+
cairo:line_to(1, 0.5)
56+
cairo:line_to(0.5, 1)
57+
cairo:line_to(0,0)
58+
cairo:line_to(1, 1)
59+
cairo:line_to(0.5, 0)
60+
cairo:line_to(0, 0.5)
61+
cairo:line_to(1, 1)
62+
63+
cairo:move_to(1, 0)
64+
cairo:line_to(0, 0.5)
65+
cairo:line_to(0.5, 1)
66+
cairo:line_to(1, 0)
67+
cairo:line_to(0, 1)
68+
cairo:line_to(0.5, 0)
69+
cairo:line_to(1, 0.5)
70+
cairo:line_to(0, 1)
71+
72+
-- middle lines - not needed for harmonic armature
73+
-- cairo:move_to(0,0.5)
74+
-- cairo:line_to(1,0.5)
75+
-- cairo:move_to(0.5,0)
76+
-- cairo:line_to(0.5,1)
77+
78+
cairo:restore()
79+
end,
80+
-- gui
81+
function()
82+
return dt.new_widget("label"){label = _("harmonic armature"), halign = "start"}
83+
end
84+
)

0 commit comments

Comments
 (0)