diff --git a/ChangeLog b/ChangeLog index 4292cb35..efb7090a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ started 8.6.0 16/8/17 - add scRGB support - improve radiance support +- add composite to alpha menu started 8.5.1 22/1/17 - fix a crash bug diff --git a/share/nip2/start/Filter.def b/share/nip2/start/Filter.def index daf8c0b3..a8ac20c0 100644 --- a/share/nip2/start/Filter.def +++ b/share/nip2/start/Filter.def @@ -1,164 +1,3 @@ -Blend_type = class { - CLEAR = 0; - SOURCE = 1; - OVER = 2; - IN = 3; - OUT = 4; - ATOP = 5; - DEST = 6; - DEST_OVER = 7; - DEST_IN = 8; - DEST_OUT = 9; - DEST_ATOP = 10; - XOR = 11; - ADD = 12; - SATURATE = 13; - MULTIPLY = 14; - SCREEN = 15; - OVERLAY = 16; - DARKEN = 17; - LIGHTEN = 18; - COLOUR_DODGE = 19; - COLOUR_BURN = 20; - HARD_LIGHT = 21; - SOFT_LIGHT = 22; - DIFFERENCE = 23; - EXCLUSION = 24; - - /* Table to map blend numbers to descriptive strings - */ - descriptions = [ - _ "Clear", - _ "Source", - _ "Over", - _ "In", - _ "Out", - _ "Atop", - _ "Dest", - _ "Dest over", - _ "Dest in", - _ "Dest out", - _ "Dest atop", - _ "Xor", - _ "Add", - _ "Saturate", - _ "Multiply", - _ "Screen", - _ "Overlay", - _ "Darken", - _ "Lighten", - _ "Colour dodge", - _ "Colour burn", - _ "Hard light", - _ "Soft light", - _ "Difference", - _ "Exclusion" - ]; - - /* And to vips enum nicknames. - */ - types = Enum [ - $clear => "clear", - $source => "source", - $over => "over", - $in => "in", - $out => "out", - $atop => "atop", - $dest => "dest", - $dest_over => "dest_over", - $dest_in => "dest_in", - $dest_out => "dest_out", - $dest_atop => "dest_atop", - $xor => "xor", - $add => "add", - $saturate => "saturate", - $multiply => "multiply", - $screen => "screen", - $overlay => "overlay", - $darken => "darken", - $lighten => "lighten", - $colour_dodge => "colour_dodge", - $colour_burn => "colour_burn", - $hard_light => "hard_light", - $soft_light => "soft_light", - $difference => "difference", - $exclusion => "exclusion" - ]; -} - -Blend type = class { - value = Blend_type.types?type; -} - -Blend_over = Blend Blend_type.OVER; - -Blend_picker default = class - Blend blend.value { - _vislevel = 2; - - blend = Option "Blend" Blend_type.descriptions default; -} - -Composite2_item = class - Menuaction "_Composite two" "composite a pair of images" { - action x y = class - _result { - _vislevel = 3; - - blend = Option_enum (_ "Blend mode") modes "over" - { - modes = Blend_type.types; - } - compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" - { - spaces = Image_type.image_colour_spaces; - } - premultiplied = Toggle (_ "Premultiplied") false; - - _result - = Image output - { - [output] = vips_call "composite" - [[y.value, x.value], blend.value] - [$compositing_space => compositing_space.value_thing, - $premultiplied => premultiplied.value - ]; - } - } -} - -Composite3_item = class - Menuaction "_Composite three" "composite three images" { - action x y z = class - _result { - _vislevel = 3; - - blend1 = Option_enum (_ "Blend mode") modes "over" - { - modes = Blend_type.types; - } - blend2 = Option_enum (_ "Blend mode") modes "over" - { - modes = Blend_type.types; - } - compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" - { - spaces = Image_type.image_colour_spaces; - } - premultiplied = Toggle (_ "Premultiplied") false; - - _result - = Image output - { - [output] = vips_call "composite" - [[z.value, y.value, x.value], [blend1.value, blend2.value]] - [$compositing_space => compositing_space.value_thing, - $premultiplied => premultiplied.value - ]; - } - } -} - Filter_conv_item = class Menupullright "_Convolution" "various spatial convolution filters" { /* Some useful masks. diff --git a/share/nip2/start/Image.def b/share/nip2/start/Image.def index 59cec551..a010d989 100644 --- a/share/nip2/start/Image.def +++ b/share/nip2/start/Image.def @@ -1177,8 +1177,65 @@ Image_alpha_item = class sep2 = Menuseparator; - Blend_alpha_item = Filter_blend_item.Blend_alpha_item; + Composite2_item = class + Menuaction "_Composite two" "composite a pair of images" { + action x y = class + _result { + _vislevel = 3; + + blend = Option_enum (_ "Blend mode") modes "over" + { + modes = Blend_type.types; + } + compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" + { + spaces = Image_type.image_colour_spaces; + } + premultiplied = Toggle (_ "Premultiplied") false; + _result + = Image output + { + [output] = vips_call "composite" + [[y.value, x.value], blend.value] + [$compositing_space => compositing_space.value_thing, + $premultiplied => premultiplied.value + ]; + } + } + } + + Composite3_item = class + Menuaction "_Composite three" "composite three images" { + action x y z = class + _result { + _vislevel = 3; + + blend1 = Option_enum (_ "Blend mode") modes "over" + { + modes = Blend_type.types; + } + blend2 = Option_enum (_ "Blend mode") modes "over" + { + modes = Blend_type.types; + } + compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" + { + spaces = Image_type.image_colour_spaces; + } + premultiplied = Toggle (_ "Premultiplied") false; + + _result + = Image output + { + [output] = vips_call "composite" + [[z.value, y.value, x.value], [blend1.value, blend2.value]] + [$compositing_space => compositing_space.value_thing, + $premultiplied => premultiplied.value + ]; + } + } + } } Image_crop_item = class diff --git a/share/nip2/start/_types.def b/share/nip2/start/_types.def index a37575a2..7f589551 100644 --- a/share/nip2/start/_types.def +++ b/share/nip2/start/_types.def @@ -1287,3 +1287,105 @@ NULL = class op.op_name == "not_equal"] ] ++ super.oo_binary_table op x; } + +Blend_type = class { + CLEAR = 0; + SOURCE = 1; + OVER = 2; + IN = 3; + OUT = 4; + ATOP = 5; + DEST = 6; + DEST_OVER = 7; + DEST_IN = 8; + DEST_OUT = 9; + DEST_ATOP = 10; + XOR = 11; + ADD = 12; + SATURATE = 13; + MULTIPLY = 14; + SCREEN = 15; + OVERLAY = 16; + DARKEN = 17; + LIGHTEN = 18; + COLOUR_DODGE = 19; + COLOUR_BURN = 20; + HARD_LIGHT = 21; + SOFT_LIGHT = 22; + DIFFERENCE = 23; + EXCLUSION = 24; + + /* Table to map blend numbers to descriptive strings + */ + descriptions = [ + _ "Clear", + _ "Source", + _ "Over", + _ "In", + _ "Out", + _ "Atop", + _ "Dest", + _ "Dest over", + _ "Dest in", + _ "Dest out", + _ "Dest atop", + _ "Xor", + _ "Add", + _ "Saturate", + _ "Multiply", + _ "Screen", + _ "Overlay", + _ "Darken", + _ "Lighten", + _ "Colour dodge", + _ "Colour burn", + _ "Hard light", + _ "Soft light", + _ "Difference", + _ "Exclusion" + ]; + + /* And to vips enum nicknames. + */ + types = Enum [ + $clear => "clear", + $source => "source", + $over => "over", + $in => "in", + $out => "out", + $atop => "atop", + $dest => "dest", + $dest_over => "dest_over", + $dest_in => "dest_in", + $dest_out => "dest_out", + $dest_atop => "dest_atop", + $xor => "xor", + $add => "add", + $saturate => "saturate", + $multiply => "multiply", + $screen => "screen", + $overlay => "overlay", + $darken => "darken", + $lighten => "lighten", + $colour_dodge => "colour_dodge", + $colour_burn => "colour_burn", + $hard_light => "hard_light", + $soft_light => "soft_light", + $difference => "difference", + $exclusion => "exclusion" + ]; +} + +Blend type = class { + value = Blend_type.types?type; +} + +Blend_over = Blend Blend_type.OVER; + +Blend_picker default = class + Blend blend.value { + _vislevel = 2; + + blend = Option "Blend" Blend_type.descriptions default; +} +