aboutsummaryrefslogtreecommitdiff
path: root/Plugins/2colors.cpp
blob: e594c2bb915e04f5f1b786e93f0b7a30529dad78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>
#include "plugin.h"
#include "pixels.h"

// 2colors: make the image consist of black and white pixels only.
// 	    I haven't tested this yet and it most likely WILL NOT WORK!!!

void perform_effect(_frame f, _args a)
{
	pixels p(f);
	int i=127, o; // intensity

	if(a.s) i=atoi(a.s);

	while(!p.eof())
	{
		o = (p.red() + p.green() + p.blue()) / 3;
		if(i<o) p.putrgb(0, 0, 0); else p.putrgb(255, 255, 255);
		p.next();
	}
}

INFO("go black and white")