Skip to content

Commit 4000af3

Browse files
committed
menu hacking
1 parent 2ea1abe commit 4000af3

File tree

3 files changed

+156
-127
lines changed

3 files changed

+156
-127
lines changed

TODO

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
- scale and convolution matrix seem to have the same change detection issues
2-
we've had before
3-
4-
unable to reproduce?
5-
61
- load ws, change, ^Q, select "save" in popup, error
72

3+
need to expand variables like $HOME
4+
85
- "reset" in display bar resets the position of scale/offset widgets, but does
96
not reset the menu items (eg. tick on falsecolour)
107

@@ -16,13 +13,31 @@
1613
likewise, load ws with locked tab, rightclick menu on locked tab does not
1714
have tick selected
1815

16+
- change "Merge into ..."
17+
18+
split to "Merge from file ..." and "Merge column >" with a
19+
pullright listing all columns
20+
21+
Same for merge in tab menu, except "Merge tab >"
22+
23+
Just does save/load for you
24+
1925
# menu redesign
2026

2127
- implement Menuseparator?
2228

29+
we've implemented #separator
30+
31+
- add something to find unresolved symbols
32+
33+
- get rid of im_copy_set etc.
34+
35+
add copy_set to stdenv, and that uses vips_call9
36+
37+
- rename Image_type as Image_interpretation
38+
2339
- add
2440

25-
crop = extract_area;
2641
minpair
2742
maxpair
2843
clamp
@@ -40,11 +55,11 @@
4055

4156
do we need to define a Matrix_base member in Matrix_gaussian_item.action?
4257

43-
- add "smooth" option to union/intersection/difference
58+
- add "smooth" option to union/intersection/difference?
4459

4560
see https://iquilezles.org/articles/distfunctions/
4661

47-
translate, rotate etc?
62+
translate, rotate etc? need xyz for that
4863

4964
- Grey ramp, checkerboard, grid CIELAB slice -> Test Images
5065

share/nip4/start/Image.def

Lines changed: 119 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Image_new_item = class Menupullright "_New" "make new things" {
22
Image_black_item = class Menuaction "_Image" "make a new image" {
33
format_names = [
4-
"8-bit unsigned int - UCHAR", // 0
5-
"8-bit signed int - CHAR", // 1
6-
"16-bit unsigned int - USHORT", // 2
7-
"16-bit signed int - SHORT", // 3
8-
"32-bit unsigned int - UINT", // 4
9-
"32-bit signed int - INT", // 5
10-
"32-bit float - FLOAT", // 6
11-
"64-bit complex - COMPLEX", // 7
12-
"64-bit float - DOUBLE", // 8
13-
"128-bit complex - DPCOMPLEX" // 9
4+
"8-bit unsigned int - UCHAR", // 0
5+
"8-bit signed int - CHAR", // 1
6+
"16-bit unsigned int - USHORT", // 2
7+
"16-bit signed int - SHORT", // 3
8+
"32-bit unsigned int - UINT", // 4
9+
"32-bit signed int - INT", // 5
10+
"32-bit float - FLOAT", // 6
11+
"64-bit complex - COMPLEX", // 7
12+
"64-bit float - DOUBLE", // 8
13+
"128-bit complex - DPCOMPLEX" // 9
1414
];
1515

1616
action = class
@@ -227,92 +227,6 @@ Image_new_item = class Menupullright "_New" "make new things" {
227227

228228
}
229229

230-
Grey_item = class
231-
Menuaction "Grey _Ramp" "make a smooth grey ramp" {
232-
action = class
233-
_result {
234-
_vislevel = 3;
235-
236-
nwidth = Expression "Image width (pixels)" 64;
237-
nheight = Expression "Image height (pixels)" 64;
238-
orientation = Option "Orientation" [
239-
"Horizontal",
240-
"Vertical"
241-
] 0;
242-
foption = Option "Format" ["8 bit", "float"] 0;
243-
244-
_result
245-
= Image im
246-
{
247-
gen
248-
= im_grey, foption == 0
249-
= im_fgrey;
250-
w = to_real nwidth;
251-
h = to_real nheight;
252-
im
253-
= gen w h, orientation == 0
254-
= rot90 (gen h w);
255-
}
256-
}
257-
}
258-
259-
Checkerboard_item = class
260-
Menuaction "_Checkerboard" "make a checkerboard image" {
261-
action = class
262-
_result {
263-
_vislevel = 3;
264-
265-
nwidth = Expression "Image width (pixels)" 64;
266-
nheight = Expression "Image height (pixels)" 64;
267-
hpsize = Expression "Horizontal patch size" 8;
268-
vpsize = Expression "Vertical patch size" 8;
269-
hpoffset = Expression "Horizontal patch offset" 0;
270-
vpoffset = Expression "Vertical patch offset" 0;
271-
272-
_result
273-
= Image (xstripes ^ ystripes)
274-
{
275-
pixels = make_xy nwidth nheight;
276-
xpixels = pixels?0 + to_real hpoffset;
277-
ypixels = pixels?1 + to_real vpoffset;
278-
279-
make_stripe pix swidth = pix % (swidth * 2) >= swidth;
280-
281-
xstripes = make_stripe xpixels (to_real hpsize);
282-
ystripes = make_stripe ypixels (to_real vpsize);
283-
}
284-
}
285-
}
286-
287-
Grid_item = class
288-
Menuaction "Gri_d" "make a grid" {
289-
action = class
290-
_result {
291-
_vislevel = 3;
292-
293-
nwidth = Expression "Image width (pixels)" 64;
294-
nheight = Expression "Image height (pixels)" 64;
295-
hspace = Expression "Horizontal line spacing" 8;
296-
vspace = Expression "Vertical line spacing" 8;
297-
thick = Expression "Line thickness" 1;
298-
hoff = Expression "Horizontal grid offset" 4;
299-
voff = Expression "Vertical grid offset" 4;
300-
301-
_result
302-
= Image (xstripes | ystripes)
303-
{
304-
pixels = make_xy nwidth nheight;
305-
xpixels = pixels?0 + to_real hoff;
306-
ypixels = pixels?1 + to_real voff;
307-
308-
make_stripe pix swidth = pix % swidth < to_real thick;
309-
310-
xstripes = make_stripe xpixels (to_real hspace);
311-
ystripes = make_stripe ypixels (to_real vspace);
312-
}
313-
}
314-
}
315-
316230
Text_item = class
317231
Menuaction "_Text" "make a bitmap of some text" {
318232
action = class
@@ -358,19 +272,6 @@ Image_new_item = class Menupullright "_New" "make new things" {
358272
}
359273
}
360274

361-
New_CIELAB_slice_item = class
362-
Menuaction "CIELAB _Slice" "make a slice through CIELAB space" {
363-
action = class
364-
_result {
365-
_vislevel = 3;
366-
367-
nsize = Expression "Image size (pixels)" 64;
368-
L = Scale "L value" 0 100 50;
369-
370-
_result = Image (lab_slice (to_real nsize) L.value);
371-
}
372-
}
373-
374275
sense_option = Option "Sense" [
375276
"Pass",
376277
"Reject"
@@ -648,6 +549,105 @@ Image_new_item = class Menupullright "_New" "make new things" {
648549
}
649550
}
650551

552+
Grey_item = class
553+
Menuaction "Grey _Ramp" "make a smooth grey ramp" {
554+
action = class
555+
_result {
556+
_vislevel = 3;
557+
558+
nwidth = Expression "Image width (pixels)" 64;
559+
nheight = Expression "Image height (pixels)" 64;
560+
orientation = Option "Orientation" [
561+
"Horizontal",
562+
"Vertical"
563+
] 0;
564+
foption = Option "Format" ["8 bit", "float"] 0;
565+
566+
_result
567+
= Image im
568+
{
569+
gen
570+
= im_grey, foption == 0
571+
= im_fgrey;
572+
w = to_real nwidth;
573+
h = to_real nheight;
574+
im
575+
= gen w h, orientation == 0
576+
= rot90 (gen h w);
577+
}
578+
}
579+
}
580+
581+
Checkerboard_item = class
582+
Menuaction "_Checkerboard" "make a checkerboard image" {
583+
action = class
584+
_result {
585+
_vislevel = 3;
586+
587+
nwidth = Expression "Image width (pixels)" 64;
588+
nheight = Expression "Image height (pixels)" 64;
589+
hpsize = Expression "Horizontal patch size" 8;
590+
vpsize = Expression "Vertical patch size" 8;
591+
hpoffset = Expression "Horizontal patch offset" 0;
592+
vpoffset = Expression "Vertical patch offset" 0;
593+
594+
_result
595+
= Image (xstripes ^ ystripes)
596+
{
597+
pixels = make_xy nwidth nheight;
598+
xpixels = pixels?0 + to_real hpoffset;
599+
ypixels = pixels?1 + to_real vpoffset;
600+
601+
make_stripe pix swidth = pix % (swidth * 2) >= swidth;
602+
603+
xstripes = make_stripe xpixels (to_real hpsize);
604+
ystripes = make_stripe ypixels (to_real vpsize);
605+
}
606+
}
607+
}
608+
609+
Grid_item = class
610+
Menuaction "Gri_d" "make a grid" {
611+
action = class
612+
_result {
613+
_vislevel = 3;
614+
615+
nwidth = Expression "Image width (pixels)" 64;
616+
nheight = Expression "Image height (pixels)" 64;
617+
hspace = Expression "Horizontal line spacing" 8;
618+
vspace = Expression "Vertical line spacing" 8;
619+
thick = Expression "Line thickness" 1;
620+
hoff = Expression "Horizontal grid offset" 4;
621+
voff = Expression "Vertical grid offset" 4;
622+
623+
_result
624+
= Image (xstripes | ystripes)
625+
{
626+
pixels = make_xy nwidth nheight;
627+
xpixels = pixels?0 + to_real hoff;
628+
ypixels = pixels?1 + to_real voff;
629+
630+
make_stripe pix swidth = pix % swidth < to_real thick;
631+
632+
xstripes = make_stripe xpixels (to_real hspace);
633+
ystripes = make_stripe ypixels (to_real vspace);
634+
}
635+
}
636+
}
637+
638+
New_CIELAB_slice_item = class
639+
Menuaction "CIELAB _Slice" "make a slice through CIELAB space" {
640+
action = class
641+
_result {
642+
_vislevel = 3;
643+
644+
nsize = Expression "Image size (pixels)" 64;
645+
L = Scale "L value" 0 100 50;
646+
647+
_result = Image (lab_slice (to_real nsize) L.value);
648+
}
649+
}
650+
651651
CRT_test_chart_item = class
652652
Menuaction "CRT _Phosphor Chart"
653653
"make an image for measuring phosphor colours" {
@@ -799,7 +799,7 @@ Image_new_item = class Menupullright "_New" "make new things" {
799799
action image = scope.VGuide image 0.5;
800800
}
801801

802-
sep1 = Menuseparator;
802+
sep1 = Menuseparator;
803803

804804
Move_item = class
805805
Menuaction "From Region"
@@ -835,7 +835,7 @@ Image_convert_to_image_item = class
835835
}
836836

837837
Image_number_format_item = class
838-
Menupullright "_Format" "convert numeric format" {
838+
Menupullright "Numeric Format" "convert numeric format" {
839839

840840
U8_item = class
841841
Menuaction "_8 bit unsigned" "convert to unsigned 8 bit [0, 255]" {
@@ -1011,7 +1011,7 @@ Image_header_item = class
10111011
action x = get_field "coding" x;
10121012
}
10131013

1014-
sep1 = Menuseparator;
1014+
sep1 = Menuseparator;
10151015

10161016
Custom_item = class
10171017
Menuaction "C_ustom" "get any header field" {
@@ -1103,8 +1103,8 @@ Image_header_item = class
11031103
nxoff = Expression "Xoffset" (get_prop has_xoffset get_xoffset 0 x);
11041104
nyoff = Expression "Yoffset" (get_prop has_yoffset get_yoffset 0 x);
11051105

1106-
type_option
1107-
= Option_enum "Image type" Image_type.type_names
1106+
interpretation
1107+
= Option_enum "Interpretation" Image_type.type_names
11081108
(Image_type.type_names.get_name type)
11091109
{
11101110
type
@@ -1116,7 +1116,7 @@ Image_header_item = class
11161116
= map_unary process x
11171117
{
11181118
process image
1119-
= Image (im_copy_set image.value type_option.value_thing
1119+
= Image (im_copy_set image.value interpretation.value_thing
11201120
(to_real nxres) (to_real nyres)
11211121
(to_real nxoff) (to_real nyoff));
11221122
}
@@ -1237,7 +1237,7 @@ Image_transform_item = class
12371237
Menupullright "Ro_tate" "rotate image" {
12381238
Fixed_item = class
12391239
Menupullright "_Fixed" "clockwise rotation by fixed angles" {
1240-
rotate_widget default x = class
1240+
rotate_widget default x = class
12411241
_result {
12421242
_vislevel = 3;
12431243

@@ -1430,13 +1430,13 @@ Image_transform_item = class
14301430
) 4;
14311431
custom_width = Expression "Custom width" 1000;
14321432
custom_height = Expression "Custom height" 1000;
1433-
size = Option "Page size" [
1433+
size = Option "Page size" [
14341434
"Full page", "Half page", "Quarter page"
14351435
] 0;
14361436
kernel = Kernel_picker Kernel_type.LINEAR;
14371437

1438-
_result
1439-
= map_unary process x
1438+
_result
1439+
= map_unary process x
14401440
{
14411441
xdiv = [1, 2, 2]?size;
14421442
ydiv = [1, 1, 2]?size;

0 commit comments

Comments
 (0)