Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while({xS-=ysin;yS+=ycos;++j<down;}) { // Y-Loop
- // Find the START of the x loop
- amount1 = Std.int( if(xcos<0&&xS>wClip) {(wClip-xS)/xcos+1;} else if(xcos>0&&xS<0) {-xS/xcos+1;} );
- amount2 = Std.int( if(xsin<0&&yS>hClip) {(hClip-yS)/xsin+1;} else if(xsin>0&&yS<0) {-yS/xsin+1;} );
- amount1 = ((amount1<amount2)?amount2:amount1);
- // Find the END of the x loop
- amount3 = Std.int( if(xcos>0&&xS<wClip) {(wClip-xS)/xcos+1;} else if(xcos<0&&xS>0) {-xS/xcos+1;} );
- amount4 = Std.int( if(xsin>0&&yS<hClip) {(hClip-yS)/xsin+1;} else if(xsin<0&&yS>0) {-yS/xsin+1;} );
- amount3 = ((amount3>amount4)?amount4:amount3);
- // If START is later than END then obviously we shouldn't draw this row (this is a skip-y solution)
- if(amount1>amount3) {continue;} //SKIP
- // Set the starting position (this is a jump-x solution)
- i=left+amount1;
- xSR=xS+xcos*amount1-xcos;
- ySR=yS+xsin*amount1-xsin;
- // Set the ending position (this is a jump-x solution)
- right=left+amount3+1;
- // Start the loop
- while({xSR+=xcos;ySR+=xsin;++i<right;}) { // X-Loop
- color=getPixel(Std.int(xSR)+xClip,Std.int(ySR)+yClip); // Get the color at a transformed position
- if(color!=0xFF00FF) {_context.target.drawPixel(color,_x+i,_y+j);} // Set the color at an untransformed position
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement