-
Notifications
You must be signed in to change notification settings - Fork 0
/
RoundedFrame.pbk
62 lines (52 loc) · 1.7 KB
/
RoundedFrame.pbk
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
<languageVersion : 1.0;>
kernel SimpleFrame
< namespace : "SimpleFrame";
vendor : "Paperlesss Post";
version : 1;
>
{
input image4 src;
output pixel4 dst;
parameter float size
<
minValue:float(0.0);
maxValue:float(500.0);
defaultValue:float(15.0);
>;
parameter float2 imageSize
<
minValue:float2(0.0,0.0);
maxValue:float2(10000.0,10000.0);
defaultValue:float2(600.0, 600.0);
>;
parameter float4 color
<
minValue:float4(0.0,0.0,0.0,0.0);
maxValue:float4(1.0,1.0,1.0,1.0);
defaultValue:float4(1.0,1.0,1.0,1.0);
>;
parameter float radius
<
minValue:float(0.0);
maxValue:float(500.0);
defaultValue:float(15.0);
>;
void
evaluatePixel()
{
float2 pos = outCoord();
dst = sampleNearest(src,pos);
float2 c1 = float2(imageSize.x - (size + radius), size + radius);
float2 c2 = float2(size + radius, size + radius);
float2 c3 = float2(size + radius, imageSize.y - (size + radius));
float2 c4 = float2(imageSize.x - (size + radius), imageSize.y - (size + radius));
if(pos.x < size || pos.x > imageSize.x - size || pos.y < size || pos.y > imageSize.y - size ||
(distance(pos, c1) > radius && pos.x > c1.x && pos.y < c1.y) ||
(distance(pos, c2) > radius && pos.x < c2.x && pos.y < c2.y) ||
(distance(pos, c3) > radius && pos.x < c3.x && pos.y > c3.y) ||
(distance(pos, c4) > radius && pos.x > c4.x && pos.y > c4.y))
{
dst = color;
}
}
}