2022-12-13 14:11:39 +01:00
|
|
|
function Node_create_Blend(_x, _y, _group = -1, _param = "") {
|
2022-12-13 09:20:36 +01:00
|
|
|
var node = new Node_Blend(_x, _y, _group);
|
2022-01-26 06:57:34 +01:00
|
|
|
|
|
|
|
switch(_param) {
|
|
|
|
case "normal" : node.inputs[| 2].setValue(BLEND_MODE.normal) break;
|
|
|
|
case "add" : node.inputs[| 2].setValue(BLEND_MODE.add); break;
|
|
|
|
case "subtract" : node.inputs[| 2].setValue(BLEND_MODE.subtract); break;
|
|
|
|
case "multiply" : node.inputs[| 2].setValue(BLEND_MODE.multiply); break;
|
|
|
|
case "screen" : node.inputs[| 2].setValue(BLEND_MODE.screen); break;
|
|
|
|
case "maxx" : node.inputs[| 2].setValue(BLEND_MODE.maxx); break;
|
|
|
|
case "minn" : node.inputs[| 2].setValue(BLEND_MODE.minn); break;
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2022-12-13 09:20:36 +01:00
|
|
|
function Node_Blend(_x, _y, _group = -1) : Node_Processor(_x, _y, _group) constructor {
|
2022-01-13 05:24:03 +01:00
|
|
|
name = "Blend";
|
|
|
|
|
|
|
|
inputs[| 0] = nodeValue(0, "Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE);
|
|
|
|
inputs[| 1] = nodeValue(1, "Foreground", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, DEF_SURFACE);
|
|
|
|
|
|
|
|
inputs[| 2] = nodeValue(2, "Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.enum_scroll, BLEND_TYPES );
|
2022-01-13 05:24:03 +01:00
|
|
|
|
|
|
|
inputs[| 3] = nodeValue(3, "Opacity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
|
|
|
.setDisplay(VALUE_DISPLAY.slider, [ 0, 1, 0.01]);
|
|
|
|
|
|
|
|
inputs[| 4] = nodeValue(4, "Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
|
|
|
|
|
|
|
inputs[| 5] = nodeValue(5, "Tiling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
2022-01-19 03:05:13 +01:00
|
|
|
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Stretch", "Tile" ]);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
outputs[| 0] = nodeValue(0, "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, PIXEL_SURFACE);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-01-18 05:31:19 +01:00
|
|
|
static process_data = function(_outSurf, _data, _output_index) {
|
2022-01-13 05:24:03 +01:00
|
|
|
var _fore = _data[1];
|
|
|
|
var _type = _data[2];
|
|
|
|
var _opacity = _data[3];
|
|
|
|
var _mask = _data[4];
|
|
|
|
var _tile = _data[5];
|
|
|
|
|
|
|
|
surface_set_target(_outSurf);
|
|
|
|
draw_clear_alpha(0, 0);
|
|
|
|
|
|
|
|
draw_surface_blend(_data[0], _fore, _type, _opacity, _mask, _tile);
|
|
|
|
surface_reset_target();
|
|
|
|
|
|
|
|
return _outSurf;
|
|
|
|
}
|
|
|
|
}
|