Skip to content

Commit

Permalink
break alpha out to a separate menu
Browse files Browse the repository at this point in the history
and bump the version
  • Loading branch information
jcupitt committed Mar 22, 2017
1 parent 5bcd166 commit f8cc65d
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 39 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
4 changes: 2 additions & 2 deletions doc/src/nipguide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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,
Expand Down
82 changes: 58 additions & 24 deletions share/nip2/start/Image.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
104 changes: 92 additions & 12 deletions test/workspaces/test_image.ws
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<root xmlns="http://www.vips.ecs.soton.ac.uk/nip/8.5.0">
<Workspace window_x="50" window_y="80" window_width="1258" window_height="799" view="WORKSPACE_MODE_REGULAR" scale="1" offset="0" locked="false" lpane_position="400" lpane_open="false" rpane_position="100" rpane_open="false" local_defs="// private definitions for this workspace&#10;" name="test_image" caption="Default empty workspace" filename="$HOME/GIT/nip2/test/workspaces/test_image.ws">
<Workspace window_x="36" window_y="64" window_width="1258" window_height="1134" view="WORKSPACE_MODE_REGULAR" scale="1" offset="0" locked="false" lpane_position="400" lpane_open="false" rpane_position="100" rpane_open="false" local_defs="// private definitions for this workspace&#10;" name="test_image" caption="Default empty workspace" filename="$HOME/GIT/nip2/test/workspaces/test_image.ws">
<Column x="0" y="0" open="true" selected="false" sform="false" next="17" name="B" caption="Colour / Colourspace">
<Subcolumn vislevel="3">
<Row popup="false" name="B1">
Expand All @@ -12,7 +12,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="455" y="0" open="true" selected="false" sform="false" next="10" name="AB" caption="Image / New">
<Column x="517" y="0" open="true" selected="false" sform="false" next="10" name="AB" caption="Image / New">
<Subcolumn vislevel="3">
<Row popup="false" name="AB1">
<Rhs vislevel="3" flags="7">
Expand Down Expand Up @@ -154,7 +154,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="1152" y="0" open="true" selected="false" sform="false" next="49" name="BB" caption="Image / Format">
<Column x="1301" y="0" open="true" selected="false" sform="false" next="49" name="BB" caption="Image / Format">
<Subcolumn vislevel="3">
<Row popup="false" name="BB1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -240,7 +240,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="4875" y="0" open="true" selected="true" sform="false" next="11" name="CB" caption="Image / Join">
<Column x="5933" y="0" open="true" selected="false" sform="false" next="11" name="CB" caption="Image / Join">
<Subcolumn vislevel="3">
<Row popup="false" name="CB1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -496,7 +496,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="5505" y="0" open="true" selected="false" sform="false" next="5" name="DB" caption="Image / Tile">
<Column x="6636" y="0" open="true" selected="false" sform="false" next="5" name="DB" caption="Image / Tile">
<Subcolumn vislevel="3">
<Row popup="false" name="DB1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -615,7 +615,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="2136" y="0" open="true" selected="false" sform="false" next="6" name="EB" caption="Image / Levels">
<Column x="2391" y="0" open="true" selected="false" sform="false" next="6" name="EB" caption="Image / Levels">
<Subcolumn vislevel="3">
<Row popup="false" name="EB1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -789,7 +789,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="2834" y="0" open="true" selected="false" sform="false" next="20" name="FB" caption="Image / Transform">
<Column x="3191" y="0" open="true" selected="false" sform="false" next="20" name="FB" caption="Image / Transform">
<Subcolumn vislevel="3">
<Row popup="false" name="FB1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -1176,7 +1176,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="6240" y="0" open="true" selected="false" sform="false" next="18" name="GB" caption="Image / Patterns">
<Column x="7490" y="0" open="true" selected="false" sform="false" next="18" name="GB" caption="Image / Patterns">
<Subcolumn vislevel="3">
<Row popup="false" name="GB1">
<Rhs vislevel="3" flags="7">
Expand Down Expand Up @@ -1299,7 +1299,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="6770" y="0" open="true" selected="false" sform="false" next="8" name="HB" caption="Image / Test">
<Column x="8081" y="0" open="true" selected="false" sform="false" next="8" name="HB" caption="Image / Test">
<Subcolumn vislevel="3">
<Row popup="false" name="HB1">
<Rhs vislevel="3" flags="7">
Expand Down Expand Up @@ -1352,7 +1352,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="3586" y="0" open="true" selected="false" sform="false" next="23" name="A" caption="Image / Band">
<Column x="4021" y="0" open="true" selected="false" sform="false" next="23" name="A" caption="Image / Band">
<Subcolumn vislevel="3">
<Row popup="false" name="A1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -1587,7 +1587,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="1561" y="0" open="true" selected="false" sform="false" next="9" name="C" caption="Image / Header">
<Column x="1771" y="0" open="true" selected="false" sform="false" next="9" name="C" caption="Image / Header">
<Subcolumn vislevel="3">
<Row popup="false" name="C1">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -1711,7 +1711,7 @@
</Row>
</Subcolumn>
</Column>
<Column x="4123" y="0" open="true" selected="false" sform="false" next="20" name="D" caption="Image / Select">
<Column x="5075" y="0" open="true" selected="false" sform="false" next="20" name="D" caption="Image / Select">
<Subcolumn vislevel="3">
<Row popup="false" name="D17">
<Rhs vislevel="0" flags="4">
Expand Down Expand Up @@ -1931,5 +1931,85 @@
</Row>
</Subcolumn>
</Column>
<Column x="4635" y="0" open="true" selected="true" sform="false" next="14" name="F" caption="Image / Alpha">
<Subcolumn vislevel="3">
<Row popup="false" name="F1">
<Rhs vislevel="0" flags="4">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="B1"/>
</Rhs>
</Row>
<Row popup="false" name="F2">
<Rhs vislevel="3" flags="7">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="1"/>
<iText formula="Image_alpha_item.Add_item.action F1"/>
</Rhs>
</Row>
<Row popup="false" name="F3">
<Rhs vislevel="3" flags="7">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="1"/>
<iText formula="Image_alpha_item.Flatten_item.action F2"/>
</Rhs>
</Row>
<Row popup="false" name="F4">
<Rhs vislevel="2" flags="4">
<iText formula="if min (F3 == F1) == 255 then &quot;ok!&quot; else error &quot;erp&quot;"/>
</Rhs>
</Row>
<Row popup="false" name="F5">
<Rhs vislevel="2" flags="5">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="Image_alpha_item.Extract_item.action F2"/>
</Rhs>
</Row>
<Row popup="false" name="F6">
<Rhs vislevel="1" flags="4">
<iText formula="if min (F5 == 255) == 255 then &quot;ok!&quot; else error &quot;erp!&quot;"/>
</Rhs>
</Row>
<Row popup="false" name="F7">
<Rhs vislevel="2" flags="5">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="Image_alpha_item.Drop_item.action F2"/>
</Rhs>
</Row>
<Row popup="false" name="F8">
<Rhs vislevel="1" flags="4">
<iText formula="if min (F7 == F1) == 255 then &quot;ok!&quot; else error &quot;erp&quot;"/>
</Rhs>
</Row>
<Row popup="false" name="F9">
<Rhs vislevel="2" flags="5">
<iImage window_x="72" window_y="72" window_width="570" window_height="727" image_left="272" image_top="326" image_mag="1" show_status="true" show_paintbox="false" show_convert="false" show_rulers="false" scale="1" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="Image_alpha_item.Premultiply_item.action F2"/>
</Rhs>
</Row>
<Row popup="false" name="F11">
<Rhs vislevel="2" flags="5">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="Image_alpha_item.Unpremultiply_item.action F9"/>
</Rhs>
</Row>
<Row popup="false" name="F12">
<Rhs vislevel="2" flags="5">
<iImage image_left="0" image_top="0" image_mag="0" show_status="false" show_paintbox="false" show_convert="false" show_rulers="false" scale="0" offset="0" falsecolour="false" type="true"/>
<Subcolumn vislevel="0"/>
<iText formula="Image_alpha_item.Drop_item.action F11"/>
</Rhs>
</Row>
<Row popup="false" name="F13">
<Rhs vislevel="1" flags="4">
<iText formula="if min (F12 == F1) == 255 then &quot;ok!&quot; else error &quot;erp&quot;"/>
</Rhs>
</Row>
</Subcolumn>
</Column>
</Workspace>
</root>

0 comments on commit f8cc65d

Please sign in to comment.