Advertisement
matrefeytontias

HaxePunk HWImage class

Oct 1st, 2016
2,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.51 KB | None | 0 0
  1. // Forces the image to hold its BitmapData status
  2.  
  3. import com.haxepunk.HXP;
  4. import com.haxepunk.RenderMode;
  5. import com.haxepunk.Graphic.ImageType;
  6. import com.haxepunk.graphics.Image;
  7. import com.haxepunk.ds.Either;
  8.  
  9. import openfl.display.BitmapData;
  10. import openfl.geom.Rectangle;
  11.  
  12. class HWImage
  13. {
  14.     @:access(com.haxepunk.ImageType)
  15.     static public function c(bd:BitmapData, ?clipRect:Rectangle) : Image
  16.     {
  17.         return new Image(HXP.renderMode == RenderMode.HARDWARE ? new ImageType(Left(bd)) : bd, clipRect);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement