Skip to content

Commit

Permalink
fix up and done
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Oct 6, 2017
1 parent 35aa27b commit ae1aaca
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 162 deletions.
1 change: 1 addition & 0 deletions 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
Expand Down
161 changes: 0 additions & 161 deletions 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.
Expand Down
59 changes: 58 additions & 1 deletion share/nip2/start/Image.def
Expand Up @@ -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
Expand Down
102 changes: 102 additions & 0 deletions share/nip2/start/_types.def
Expand Up @@ -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;
}

0 comments on commit ae1aaca

Please sign in to comment.