Skip to content

Commit e1e40ae

Browse files
committed
Add FlxGraphic.dump
1 parent 27a756b commit e1e40ae

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

flixel/graphics/FlxGraphic.hx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,22 @@ class FlxGraphic implements IFlxDestroyable
421421
if (newBitmap != null)
422422
bitmap = newBitmap;
423423
}
424-
424+
425+
/**
426+
* Frees the software image buffer for this graphic's `BitmapData`.
427+
* This can significantly reduce RAM usage at the cost of not being able to draw on the graphic.
428+
*
429+
* Note that this operation might not complete immediately;
430+
* it might take a bit for the garbage collector to collect the bitmap.
431+
*
432+
* @see `openfl.display.BitmapData.disposeImage()`
433+
*/
434+
public function dump():Void
435+
{
436+
if (bitmap != null)
437+
bitmap.disposeImage();
438+
}
439+
425440
@:deprecated("`undump` is deprecated, use `refresh`")
426441
public function undump():Void
427442
{

0 commit comments

Comments
 (0)