Guest User

Untitled

a guest
Feb 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       _context.yScale = _context.xScale;
  2.       var xscale:Float = (1.0 / _context.xScale);
  3.       var yscale:Float = (1.0 / _context.yScale);
  4.  
  5.       var xoffset:Int = Std.int((wClip)/2);
  6.       var yoffset:Int = Std.int((hClip)/2);
  7.      
  8.       var xcos:Float = Math.cos(-_context.rotation) * xscale;
  9.       var xsin:Float = Math.sin(-_context.rotation) * xscale;
  10.       var ycos:Float = Math.cos(-_context.rotation) * yscale;
  11.       var ysin:Float = Math.sin(-_context.rotation) * yscale;
  12.      
  13.       var biggest:Int = (wClip>hClip)?wClip:hClip;
  14.       var left:Int = Std.int((-Std.int(((biggest+1)/2)*_context.xScale))*1.5)+xoffset;
  15.       var right:Int = Std.int((Std.int(((biggest-1)/2)*_context.xScale)+1)*1.5)+xoffset;
  16.       var up:Int = Std.int((-Std.int(((biggest+1)/2)*_context.yScale))*1.5)+xoffset;
  17.       var down:Int = Std.int((Std.int(((biggest-1)/2)*_context.yScale)+1)*1.5)+xoffset;
  18.  
  19.       var xS:Float = (left-xoffset)*xcos-(up-yoffset)*ysin+xoffset;
  20.       var yS:Float = (left-xoffset)*xsin+(up-yoffset)*ycos+yoffset;
  21.       var i:Int = left;
  22.       var j:Int = up;
  23.  
  24.       while(j<down) {
  25.         var xSR:Float = xS;
  26.         var ySR:Float = yS;
  27.         if(xcos<0&&xSR>wClip) {var amount:Int = Math.floor((wClip-xSR)/xcos);i+=amount;xSR+=xcos*amount;ySR+=xsin*amount;}
  28.         if(xsin<0&&ySR>hClip) {var amount:Int = Math.ceil((hClip-ySR)/xsin);i+=amount;xSR+=xcos*amount;ySR+=xsin*amount;}
  29.         if(xcos>0&&xSR<-1) {var amount:Int = Math.ceil((-1-xSR)/xcos);i+=amount;xSR+=xcos*amount;ySR+=xsin*amount;}
  30.         if(xsin>0&&ySR<-1) {var amount:Int = Math.round((-1-ySR)/xsin);i+=amount;xSR+=xcos*amount;ySR+=xsin*amount;}
  31.         while(i<right) {
  32.           var xSRr:Int = Math.round(xSR);
  33.           var ySRr:Int = Math.round(ySR);
  34.           if(xcos>0&&xSRr>wClip-1||xsin>0&&ySRr>hClip-1||xcos<0&&xSRr<0||xsin<0&&ySRr<0) {xSR+=xcos*(right-i);ySR+=xsin*(right-i);break;}
  35.           if(xSRr>-1&&xSRr<wClip&&ySRr>-1&&ySRr<hClip) {
  36.             var color:Int=getPixel(xSRr+xClip,ySRr+yClip);
  37.             if(!transparency||color!=0xFF00FF) {_context.target.drawPixel(color,_x+i,_y+j);}
  38.           }
  39.           xSR+=xcos;
  40.           ySR+=xsin;
  41.           i++;
  42.         }
  43.         xS-=ysin;
  44.         yS+=ycos;
  45.         i=left;
  46.         j++;
  47.       }
Add Comment
Please, Sign In to add comment