|
1 | | -Blend_type = class { |
2 | | - CLEAR = 0; |
3 | | - SOURCE = 1; |
4 | | - OVER = 2; |
5 | | - IN = 3; |
6 | | - OUT = 4; |
7 | | - ATOP = 5; |
8 | | - DEST = 6; |
9 | | - DEST_OVER = 7; |
10 | | - DEST_IN = 8; |
11 | | - DEST_OUT = 9; |
12 | | - DEST_ATOP = 10; |
13 | | - XOR = 11; |
14 | | - ADD = 12; |
15 | | - SATURATE = 13; |
16 | | - MULTIPLY = 14; |
17 | | - SCREEN = 15; |
18 | | - OVERLAY = 16; |
19 | | - DARKEN = 17; |
20 | | - LIGHTEN = 18; |
21 | | - COLOUR_DODGE = 19; |
22 | | - COLOUR_BURN = 20; |
23 | | - HARD_LIGHT = 21; |
24 | | - SOFT_LIGHT = 22; |
25 | | - DIFFERENCE = 23; |
26 | | - EXCLUSION = 24; |
27 | | - |
28 | | - /* Table to map blend numbers to descriptive strings |
29 | | - */ |
30 | | - descriptions = [ |
31 | | - _ "Clear", |
32 | | - _ "Source", |
33 | | - _ "Over", |
34 | | - _ "In", |
35 | | - _ "Out", |
36 | | - _ "Atop", |
37 | | - _ "Dest", |
38 | | - _ "Dest over", |
39 | | - _ "Dest in", |
40 | | - _ "Dest out", |
41 | | - _ "Dest atop", |
42 | | - _ "Xor", |
43 | | - _ "Add", |
44 | | - _ "Saturate", |
45 | | - _ "Multiply", |
46 | | - _ "Screen", |
47 | | - _ "Overlay", |
48 | | - _ "Darken", |
49 | | - _ "Lighten", |
50 | | - _ "Colour dodge", |
51 | | - _ "Colour burn", |
52 | | - _ "Hard light", |
53 | | - _ "Soft light", |
54 | | - _ "Difference", |
55 | | - _ "Exclusion" |
56 | | - ]; |
57 | | - |
58 | | - /* And to vips enum nicknames. |
59 | | - */ |
60 | | - types = Enum [ |
61 | | - $clear => "clear", |
62 | | - $source => "source", |
63 | | - $over => "over", |
64 | | - $in => "in", |
65 | | - $out => "out", |
66 | | - $atop => "atop", |
67 | | - $dest => "dest", |
68 | | - $dest_over => "dest_over", |
69 | | - $dest_in => "dest_in", |
70 | | - $dest_out => "dest_out", |
71 | | - $dest_atop => "dest_atop", |
72 | | - $xor => "xor", |
73 | | - $add => "add", |
74 | | - $saturate => "saturate", |
75 | | - $multiply => "multiply", |
76 | | - $screen => "screen", |
77 | | - $overlay => "overlay", |
78 | | - $darken => "darken", |
79 | | - $lighten => "lighten", |
80 | | - $colour_dodge => "colour_dodge", |
81 | | - $colour_burn => "colour_burn", |
82 | | - $hard_light => "hard_light", |
83 | | - $soft_light => "soft_light", |
84 | | - $difference => "difference", |
85 | | - $exclusion => "exclusion" |
86 | | - ]; |
87 | | -} |
88 | | - |
89 | | -Blend type = class { |
90 | | - value = Blend_type.types?type; |
91 | | -} |
92 | | - |
93 | | -Blend_over = Blend Blend_type.OVER; |
94 | | - |
95 | | -Blend_picker default = class |
96 | | - Blend blend.value { |
97 | | - _vislevel = 2; |
98 | | - |
99 | | - blend = Option "Blend" Blend_type.descriptions default; |
100 | | -} |
101 | | - |
102 | | -Composite2_item = class |
103 | | - Menuaction "_Composite two" "composite a pair of images" { |
104 | | - action x y = class |
105 | | - _result { |
106 | | - _vislevel = 3; |
107 | | - |
108 | | - blend = Option_enum (_ "Blend mode") modes "over" |
109 | | - { |
110 | | - modes = Blend_type.types; |
111 | | - } |
112 | | - compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" |
113 | | - { |
114 | | - spaces = Image_type.image_colour_spaces; |
115 | | - } |
116 | | - premultiplied = Toggle (_ "Premultiplied") false; |
117 | | - |
118 | | - _result |
119 | | - = Image output |
120 | | - { |
121 | | - [output] = vips_call "composite" |
122 | | - [[y.value, x.value], blend.value] |
123 | | - [$compositing_space => compositing_space.value_thing, |
124 | | - $premultiplied => premultiplied.value |
125 | | - ]; |
126 | | - } |
127 | | - } |
128 | | -} |
129 | | - |
130 | | -Composite3_item = class |
131 | | - Menuaction "_Composite three" "composite three images" { |
132 | | - action x y z = class |
133 | | - _result { |
134 | | - _vislevel = 3; |
135 | | - |
136 | | - blend1 = Option_enum (_ "Blend mode") modes "over" |
137 | | - { |
138 | | - modes = Blend_type.types; |
139 | | - } |
140 | | - blend2 = Option_enum (_ "Blend mode") modes "over" |
141 | | - { |
142 | | - modes = Blend_type.types; |
143 | | - } |
144 | | - compositing_space = Option_enum (_ "Compositing space") spaces "sRGB" |
145 | | - { |
146 | | - spaces = Image_type.image_colour_spaces; |
147 | | - } |
148 | | - premultiplied = Toggle (_ "Premultiplied") false; |
149 | | - |
150 | | - _result |
151 | | - = Image output |
152 | | - { |
153 | | - [output] = vips_call "composite" |
154 | | - [[z.value, y.value, x.value], [blend1.value, blend2.value]] |
155 | | - [$compositing_space => compositing_space.value_thing, |
156 | | - $premultiplied => premultiplied.value |
157 | | - ]; |
158 | | - } |
159 | | - } |
160 | | -} |
161 | | - |
162 | 1 | Filter_conv_item = class |
163 | 2 | Menupullright "_Convolution" "various spatial convolution filters" { |
164 | 3 | /* Some useful masks. |
|
0 commit comments