Subversion Repositories Kolibri OS

Rev

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

  1. -- flip picture - Copyright 2010 Paulo Silva
  2. -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. See <http://www.gnu.org/licenses/>
  3. w,h=getpicturesize();
  4. ok,flipx,flipy=inputbox("flip picture","flip x",1,0,1,-1,"flip y",0,0,1,-1);
  5. if ok==true then
  6.   if flipx==1 then
  7.     for y=0,h-1,1 do
  8.       for x=0,w/2,1 do
  9.         c1=getpicturepixel(x,y);c2=getpicturepixel(w-x-1,y)
  10.         putpicturepixel(x,y,c2);putpicturepixel(w-x-1,y,c1)
  11.         end;end
  12.   else
  13.     for y=0,h/2,1 do
  14.       for x=0,w-1,1 do
  15.         c1=getpicturepixel(x,y);c2=getpicturepixel(x,h-y-1)
  16.         putpicturepixel(x,y,c2);putpicturepixel(x,h-y-1,c1)
  17.         end;end;end;end
  18.