Subversion Repositories Kolibri OS

Rev

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

  1. --BRUSH Remap: Grayscale (average)
  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. for x = 0, w - 1, 1 do
  15.  for y = 0, h - 1, 1 do
  16.    
  17.    r, g, b = getcolor(getbrushpixel(x,y))
  18.  
  19.    a = (r+g+b)/3
  20.  
  21.    putbrushpixel(x, y, matchcolor(a,a,a));
  22.  
  23.  end
  24. end
  25.