Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 1st, 2012  |  syntax: None  |  size: 1.57 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         public function flipto(h:Bool, v:Bool, map:PixMap, x:Int, y:Int):Void
  2.         {
  3.                 if (h&&v)
  4.                 {
  5.                         var q:Vector<UInt> = getVector(this.rect);
  6.                         q.reverse();
  7.                         var tMap:PixMap = new PixMap(width, height, transparent, fillColor);
  8.                         tMap.setVector(tMap.rect, q);
  9.                         map.copyPixels(tMap, tMap.rect, new Point(x, y));
  10.                 }
  11.                 else if (h)
  12.                 {      
  13.                         var i:Int = 0;
  14.                         var r:Rectangle = new Rectangle(0, 0, 1, height);
  15.                         point.x = width;
  16.                         point.y = y;
  17.                         while (i < width)
  18.                         {
  19.                                 r.x = i;
  20.                                 point.x = x + width - i - 1;
  21.                                 map.copyPixels(this, r, point);
  22.                                 i++;
  23.                         }
  24.                 }
  25.                 else if (v)
  26.                 {
  27.                         var i:Int = 0;
  28.                         var r:Rectangle = new Rectangle(0, 0, width, 1);
  29.                         point.x = x;
  30.                         point.y = height;
  31.                         while (i < height)
  32.                         {
  33.                                 r.y = i;
  34.                                 point.y = y + height - i - 1;
  35.                                 map.copyPixels(this, r, point);
  36.                                 i++;
  37.                         }
  38.                 }
  39.         }
  40.  
  41.  
  42.  
  43. //--------May or may not be broken. Haven't used in ages. I THINK it works.
  44.  
  45.         public function rot90(cw:Bool, map:PixMap, x:Int, y:Int):Void
  46.         {
  47.                 if (cw)
  48.                 {
  49.                         var i:Int = 0;
  50.                         var r1:Rectangle = new Rectangle(0, 0, width, 1);
  51.                         var r2:Rectangle = new Rectangle(x + width, y, 1, width);
  52.                         while (i < height)
  53.                         {
  54.                                 r1.y++;
  55.                                 r2.x--;
  56.                                 var v:Vector<UInt> = getVector(r1);
  57.                                 map.setVector(r2, v);
  58.                                 i++;
  59.                         }
  60.                 }
  61.                 else
  62.                 {
  63.                         var i:Int = 0;
  64.                         var r1:Rectangle = new Rectangle(0, 0, 1, height);
  65.                         var r2:Rectangle = new Rectangle(x, y + height, height, 1);
  66.                         while (i < width)
  67.                         {
  68.                                 r1.x++;
  69.                                 r2.y--;
  70.                                 var v:Vector<UInt> = getVector(r1);
  71.                                 map.setVector(r2, v);
  72.                                 i++;
  73.                         }
  74.                 }
  75.         }