toPixmap

fun TextureRegion.toPixmap(): Pixmap

Turn a TextureRegion into a Pixmap.

Originally a function defined in the Fonts Object and used only in Fonts.kt. Turned into an extension method to 1. Clean up the syntax and 2. Use it to expose internal, packed images to scripts in class ScriptingScope.

.dispose() must be called on the returned Pixmap when it is no longer needed, or else it will leave a memory leak behind.

Return

New Pixmap with all the size and pixel data from this TextureRegion copied into it.

Sources

jvm source
Link copied to clipboard