Skip to content

Commit b82ffc2

Browse files
authored
Merge pull request darktable-org#359 from johnny-bit/dt3139_moar_guidez
add new script harmonic armature guide
2 parents 91b7852 + d142151 commit b82ffc2

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

contrib/harmonic_armature_guide.lua

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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/contrib where CONFIGDIR is your darktable configuration directory
26+
* add the following line in the file $CONFIGDIR/luarc
27+
require "contrib/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+
cairo:restore()
73+
end,
74+
-- gui
75+
function()
76+
return dt.new_widget("label"){label = _("harmonic armature"), halign = "start"}
77+
end
78+
)

0 commit comments

Comments
 (0)