From f8cc65db7be91d6eae8e21034affbe86fc641749 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 22 Mar 2017 13:49:58 +0000 Subject: [PATCH] break alpha out to a separate menu and bump the version --- ChangeLog | 4 ++ configure.ac | 2 +- doc/src/nipguide.tex | 4 +- share/nip2/start/Image.def | 82 +++++++++++++++++++-------- test/workspaces/test_image.ws | 104 ++++++++++++++++++++++++++++++---- 5 files changed, 157 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a8aa2e0..756d4cfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +started 8.5.1 22/1/17 +- fix a crash bug +- make separate Image / Alpha menu, add Add, Extract, Drop + started 8.5 24/1/17 - add max_slope to lhist - gaussnoise goes via vips8 now diff --git a/configure.ac b/configure.ac index df07160a..40657a14 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl m4_define([nip_major_version], [8]) m4_define([nip_minor_version], [5]) -m4_define([nip_micro_version], [0]) +m4_define([nip_micro_version], [1]) m4_define([nip_version], [nip_major_version.nip_minor_version.nip_micro_version]) diff --git a/doc/src/nipguide.tex b/doc/src/nipguide.tex index 5a2f4560..17abcb2e 100644 --- a/doc/src/nipguide.tex +++ b/doc/src/nipguide.tex @@ -17,7 +17,7 @@ \fancyhead[LE,RO]{\leftmark} % left-even, right-odd \fancyhead[RE,LO]{\nip{} Manual} % right-even, left-odd \fancyfoot[LE,RO]{\thepage} % left-even, right-odd -\fancyfoot[RE,LO]{September 2016} +\fancyfoot[RE,LO]{March 2017} \begin{document} @@ -28,7 +28,7 @@ \begin{center} \huge \nip{} Manual\\[0.2em] -\large Version 8.4\\ +\large Version 8.5\\ \vspace{0.5in} \large John Cupitt, diff --git a/share/nip2/start/Image.def b/share/nip2/start/Image.def index 5bc36937..59cec551 100644 --- a/share/nip2/start/Image.def +++ b/share/nip2/start/Image.def @@ -1060,30 +1060,6 @@ Image_band_item = class Bandwise_item = Image_join_item.Bandwise_item; - sep1 = Menuseparator; - - Flatten_item = class Menuaction "_Flatten" "flatten alpha out of image" { - action x = class - _result { - _vislevel = 3; - - bg = Expression "Background" 0; - - _result = map_unary (flattenimage bg) x; - } - } - - Premultiply_item = class Menuaction "_Premultiply" "premultiply alpha" { - action x = premultiply x; - } - - Unpremultiply_item = class - Menuaction "_Unpremultiply" "unpremultiply alpha" { - action x = unpremultiply x; - } - - Blend_alpha_item = Filter_blend_item.Blend_alpha_item; - sep1a = Menuseparator; Bandand_item = class @@ -1147,6 +1123,64 @@ Image_band_item = class } } +Image_alpha_item = class + Menupullright "_Alpha" "manipulate image alpha" { + + Add_item = class Menuaction "_Add" "add alpha" { + action x = class + _result { + _vislevel = 3; + + opacity = Expression "Opacity (255 == solid)" 255; + + _result = x ++ to_real opacity; + } + } + + Flatten_item = class Menuaction "_Flatten" "flatten alpha out of image" { + action x = class + _result { + _vislevel = 3; + + bg = Expression "Background" 0; + + _result = map_unary (flattenimage bg) x; + } + } + + Extract_item = class Menuaction "_Extract" "extract alpha" { + action x + = map_unary exb x + { + exb x = extract_bands (x.bands - 1) 1 x; + } + } + + Drop_item = class Menuaction "_Drop" "drop alpha" { + action x + = map_unary exb x + { + exb x = extract_bands 0 (x.bands - 1) x; + } + } + + sep1 = Menuseparator; + + Premultiply_item = class Menuaction "_Premultiply" "premultiply alpha" { + action x = premultiply x; + } + + Unpremultiply_item = class + Menuaction "_Unpremultiply" "unpremultiply alpha" { + action x = unpremultiply x; + } + + sep2 = Menuseparator; + + Blend_alpha_item = Filter_blend_item.Blend_alpha_item; + +} + Image_crop_item = class Menuaction "_Crop" "extract a rectangular area from an image" { action x diff --git a/test/workspaces/test_image.ws b/test/workspaces/test_image.ws index b8dba7cd..98868d2d 100644 --- a/test/workspaces/test_image.ws +++ b/test/workspaces/test_image.ws @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -496,7 +496,7 @@ - + @@ -615,7 +615,7 @@ - + @@ -789,7 +789,7 @@ - + @@ -1176,7 +1176,7 @@ - + @@ -1299,7 +1299,7 @@ - + @@ -1352,7 +1352,7 @@ - + @@ -1587,7 +1587,7 @@ - + @@ -1711,7 +1711,7 @@ - + @@ -1931,5 +1931,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +