blob: 3172513a44932dcb9d080c1bae24baad27a99018 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//
// subtract - subtract red/green/blue color from image
//
// 0.32
// using arguments-class
//
// 0.20
// - from c to c++
// - pixelformat-aware
#include <stdlib.h>
#include <string.h>
#include "plugin.h"
#include "pixels.h"
void perform_effect(_frame f, _args a)
{
arguments ar(a.s);
if(ar.count()!=3)
{
printf("usage: subtract <red> <green> <blue>\n");
return;
}
byte r, g, b;
r = atoi(ar[0]);
g = atoi(ar[1]);
b = atoi(ar[2]);
pixels p(f);
byte tr, tg, tb;
while(!p.eof())
{
tr = p.red();
tg = p.green();
tb = p.blue();
p.putrgb(
tr>r ? tr-r : 0,
tg>g ? tg-g : 0,
tb>b ? tb-b : 0
);
p.next();
}
}
|