Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6581 leency 1
--BRUSH Distortion: FishEye
2
--by Richard Fhager
3
--http://hem.fyristorg.com/dawnbringer/
4
 
5
-- Copyright 2010 Richard Fhager
6
--
7
-- This program is free software; you can redistribute it and/or
8
-- modify it under the terms of the GNU General Public License
9
-- as published by the Free Software Foundation; version 2
10
-- of the License. See 
11
 
12
-- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project
13
--http://goto.glocalnet.net/richard_fhager/evalion/evalion.html
14
 
15
w, h = getbrushsize()
16
 
17
 
18
for y = 0, h - 1, 1 do
19
  for x = 0, w - 1, 1 do
20
 
21
         ox = x / w;
22
         oy = y / h;
23
         v = (math.cos((ox-0.5)*math.pi)*math.cos((oy-0.5)*math.pi))*0.85;
24
         ox = (1 + ox - (ox-0.5)*v) % 1;
25
         oy = (1 + oy - (oy-0.5)*v) % 1;
26
 
27
         c = getbrushbackuppixel(math.floor(ox*w),math.floor(oy*h));
28
         putbrushpixel(x, y, c);
29
  end
30
end
31