Skip to content

Commit 4b1503d

Browse files
committed
start updating menus for 8.7
1 parent 1b1b27f commit 4b1503d

File tree

3 files changed

+105
-39
lines changed

3 files changed

+105
-39
lines changed

share/nip2/start/Filter.def

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,41 @@ Filter_conv_item = class
2020
action x = map_unary (conv filter_sharp) x;
2121
}
2222

23+
Usharp_item = class
24+
Menuaction "_Unsharp Mask" "cored sharpen of L only in LAB image" {
25+
action x = class
26+
_result {
27+
_vislevel = 3;
28+
29+
size = Option "Radius" [
30+
"3 pixels",
31+
"5 pixels",
32+
"7 pixels",
33+
"9 pixels",
34+
"11 pixels",
35+
"51 pixels"
36+
] 0;
37+
38+
st = Scale "Smoothness threshold" 0 5 2;
39+
bm = Scale "Brighten by at most" 1 50 10;
40+
dm = Scale "Darken by at most" 1 50 20;
41+
fs = Scale "Sharpen flat areas by" 0 5 0.5;
42+
js = Scale "Sharpen jaggy areas by" 0 5 1;
43+
44+
_result
45+
= map_unary process x
46+
{
47+
process in
48+
= Image in'''
49+
{
50+
in' = colour_transform_to Image_type.LABS in.value;
51+
in'' = sharpen [3, 5, 7, 9, 11, 51]?size st bm dm fs js in';
52+
in''' = colour_transform_to (get_type in) in'';
53+
}
54+
}
55+
}
56+
}
57+
2358
Emboss_item = class
2459
Menuaction "_Emboss" "1 pixel displace emboss" {
2560
action x = map_unary (conv filter_emboss) x;
@@ -32,16 +67,7 @@ Filter_conv_item = class
3267

3368
Sobel_item = class
3469
Menuaction "So_bel" "3x3 Sobel edge detect" {
35-
action x
36-
= map_unary sobel x
37-
{
38-
sobel im
39-
= abs (a - 128) + abs (b - 128)
40-
{
41-
a = conv filter_sobel im;
42-
b = conv (rot270 filter_sobel) im;
43-
}
44-
}
70+
action x = map_unary sobel x;
4571
}
4672

4773
/* 3x3 line detect of image
@@ -62,37 +88,20 @@ Kirk
6288
}
6389
}
6490

65-
Usharp_item = class
66-
Menuaction "_Unsharp Mask" "cored sharpen of L only in LAB image" {
67-
action x = class
91+
Canny_item = class
92+
Menuaction "Canny" "Canny edge detector" {
93+
action x = class
6894
_result {
6995
_vislevel = 3;
70-
71-
size = Option "Radius" [
72-
"3 pixels",
73-
"5 pixels",
74-
"7 pixels",
75-
"9 pixels",
76-
"11 pixels",
77-
"51 pixels"
78-
] 0;
79-
80-
st = Scale "Smoothness threshold" 0 5 2;
81-
bm = Scale "Brighten by at most" 1 50 10;
82-
dm = Scale "Darken by at most" 1 50 20;
83-
fs = Scale "Sharpen flat areas by" 0 5 0.5;
84-
js = Scale "Sharpen jaggy areas by" 0 5 1;
85-
86-
_result
96+
97+
sigma = Scale "Sigma" 0.1 10 2;
98+
prec = Option "Precision" ["Int", "Float", "Approximate"] 1;
99+
100+
_result
87101
= map_unary process x
88102
{
89103
process in
90-
= Image in'''
91-
{
92-
in' = colour_transform_to Image_type.LABS in.value;
93-
in'' = sharpen [3, 5, 7, 9, 11, 51]?size st bm dm fs js in';
94-
in''' = colour_transform_to (get_type in) in'';
95-
}
104+
= canny sigma prec.value in;
96105
}
97106
}
98107
}

share/nip2/start/Image.def

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,16 +1902,38 @@ Pattern_images_item = class
19021902

19031903
text = String "Text to paint" "<i>Hello</i> world!";
19041904
font = Fontname "Use font" Workspaces.Preferences.PAINTBOX_FONT;
1905-
wrap = Expression "Wrap text at" 500;
1905+
fontfile = Pathname "Font file" "";
1906+
width = Expression "Text width" 500;
1907+
height = Expression "Text height" 0;
19061908
align = Option "Alignment" [
19071909
"Left",
19081910
"Centre",
19091911
"Right"
19101912
] 0;
19111913
dpi = Expression "DPI" 300;
1914+
spacing = Expression "Line spacing" 1.1;
1915+
1916+
_result
1917+
= Image out
1918+
{
1919+
[out] = vips_call "text" [text.value]
1920+
(base_options ++ fontfile_options);
1921+
1922+
base_options = [
1923+
$font => font.value,
1924+
$width => to_real width,
1925+
$height => to_real height,
1926+
$align => align.value,
1927+
$dpi => to_real dpi,
1928+
$spacing => to_real spacing
1929+
];
1930+
1931+
fontfile_options
1932+
= [$fontfile => fontfile.value],
1933+
fontfile.value != ""
1934+
= [];
1935+
}
19121936

1913-
_result = Image (im_text text.value font.value
1914-
(to_real wrap) align.value (to_real dpi));
19151937
}
19161938
}
19171939

share/nip2/start/_stdenv.def

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,3 +2617,38 @@ hist_entropy x
26172617
];
26182618
}
26192619
}
2620+
2621+
canny sigma precision x
2622+
= oo_unary_function canny_op x, is_class x
2623+
= canny_im (to_real sigma) (to_int precision) x, is_image x
2624+
= error (_ "bad arguments to " ++ "canny")
2625+
{
2626+
canny_op = Operator "canny"
2627+
(canny sigma precision) Operator_type.COMPOUND_REWRAP false;
2628+
2629+
canny_im sigma precision x
2630+
= out
2631+
{
2632+
[out] = vips_call "canny" [x] [
2633+
$sigma => sigma,
2634+
$precision => precision
2635+
];
2636+
}
2637+
2638+
}
2639+
2640+
sobel x
2641+
= oo_unary_function sobel_op x, is_class x
2642+
= sobel_im x, is_image x
2643+
= error (_ "bad arguments to " ++ "sobel")
2644+
{
2645+
sobel_op = Operator "sobel"
2646+
sobel Operator_type.COMPOUND_REWRAP false;
2647+
2648+
sobel_im x
2649+
= out
2650+
{
2651+
[out] = vips_call "sobel" [x] [
2652+
];
2653+
}
2654+
}

0 commit comments

Comments
 (0)