Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. --BRUSH: Halfsize with smoothscaling
  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 <http://www.gnu.org/licenses/>
  11.  
  12. w, h = getbrushsize()
  13.  
  14. setbrushsize(math.floor(w/2),math.floor(h/2))
  15.  
  16. for x = 0, w - 1, 2 do
  17.  for y = 0, h - 1, 2 do
  18.    r1,g1,b1 = getcolor(getbrushbackuppixel(x,y));
  19.    r2,g2,b2 = getcolor(getbrushbackuppixel(x+1,y));
  20.    r3,g3,b3 = getcolor(getbrushbackuppixel(x,y+1));
  21.    r4,g4,b4 = getcolor(getbrushbackuppixel(x+1,y+1));
  22.  
  23.    r = (r1 + r2 + r3 + r4 ) / 4;
  24.    g = (g1 + g2 + g3 + g4 ) / 4;
  25.    b = (b1 + b2 + b3 + b4 ) / 4;
  26.      
  27.    c = matchcolor(r,g,b);
  28.  
  29.    putbrushpixel(x/2, y/2, c);
  30.  
  31.  end
  32. end
  33.  
  34.  
  35.