aboutsummaryrefslogtreecommitdiff
path: root/Plugins/colortv.c
blob: 1885d1fd096412ccdb978912f2cb26e82098e819 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "plugin.h"

void perform_effect(struct frame f, struct args a)
{
	int x, y;
	pixel16 *p16;
	pixel32 *p32;
	pixel16 c1, c2, c3;

	switch(f.pixelformat)
	{
		case 16:
			for(y=0; y<f.height; y++)
			{
				p16=scanline16(f, y);
				for(x=1; x<f.width; x++)
				{
					p16[x]=(p16[x]+p16[x-1])/2;
				}
			}
			break;
		case 32:
			for(y=0; y<f.height; y++)
			{
				p32=scanline32(f, y);
				for(x=1; x<f.width; x++)
				{
					p32[x]=(p32[x]+p32[x-1])/2;
				}
			}
			break;
	}
}

void perform_copy(struct frame f1, struct frame f2, struct args a)
{
	int x, y, w, h;
	pixel16 *p1_16, *p2_16, c1, c2, c3;
	pixel32 *p1_32, *p2_32;

	w = f1.width<f2.width ? f1.width : f2.width;
	h = f1.height<f2.height ? f1.height : f2.height;

	switch(f1.pixelformat)
	{
		case 16:
			for(y=0; y<h; y++)
			{
				p1_16 = scanline16(f1, y);
				p2_16 = scanline16(f2, y);
				for(x=1; x<w; x++)
				{
					p2_16[x]=(p1_16[x]+p2_16[x])/2;
				}
			}
			break;
		case 32:
			for(y=0; y<h; y++)
			{
				p1_32 = scanline32(f1, y);
				p2_32 = scanline32(f2, y);
				for(x=1; x<w; x++)
				{
					p2_32[x]=(p1_32[x]+p2_32[x])/2;
				}
			}
			break;
	}
}