aboutsummaryrefslogtreecommitdiff
path: root/Plugins/merge_additive.cpp
blob: ee648ef3253d6ddeb9f7195e1d9ccdd39238ae02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// merge_additive - add color components of two images, until white
//

#include "plugin.h"
#include "pixels.h"

INFO("add color components of two images until white");

void perform_copy(_frame f1, _frame f2, _args a)
{
	pixels p1(f1), p2(f2);
	int r, g, b;

	while(!p1.eof() && !p2.eof())
	{
		r = (p1.red() + p2.red());
		g = (p1.green() + p2.green());
		b = (p1.blue() + p2.blue());

		r = r<256 ? r : 255;
		g = g<256 ? g : 255;
		b = b<256 ? b : 255;

		p2.putrgb(r, g, b);

		p1.next();
		p2.next();
	}
}