Package com.badlogic.gdx.graphics
Class PixmapIO
- java.lang.Object
-
- com.badlogic.gdx.graphics.PixmapIO
-
public class PixmapIO extends java.lang.ObjectWrites Pixmaps to various formats.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPixmapIO.PNGPNG encoder with compression.
-
Constructor Summary
Constructors Constructor Description PixmapIO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PixmapreadCIM(FileHandle file)Reads thePixmapfrom the given file, assuming the Pixmap was written with thewriteCIM(FileHandle, Pixmap)method.static voidwriteCIM(FileHandle file, Pixmap pixmap)Writes thePixmapto the given file using a custom compression scheme.static voidwritePNG(FileHandle file, Pixmap pixmap)Writes the pixmap as a PNG with compression.static voidwritePNG(FileHandle file, Pixmap pixmap, int compression, boolean flipY)Writes the pixmap as a PNG.
-
-
-
Method Detail
-
writeCIM
public static void writeCIM(FileHandle file, Pixmap pixmap)
Writes thePixmapto the given file using a custom compression scheme. First three integers define the width, height and format, remaining bytes are zlib compressed pixels. To be able to load the Pixmap to a Texture, use ".cim" as the file suffix. Throws a GdxRuntimeException in case the Pixmap couldn't be written to the file.- Parameters:
file- the file to write the Pixmap to
-
readCIM
public static Pixmap readCIM(FileHandle file)
Reads thePixmapfrom the given file, assuming the Pixmap was written with thewriteCIM(FileHandle, Pixmap)method. Throws a GdxRuntimeException in case the file couldn't be read.- Parameters:
file- the file to read the Pixmap from
-
writePNG
public static void writePNG(FileHandle file, Pixmap pixmap, int compression, boolean flipY)
Writes the pixmap as a PNG. SeePixmapIO.PNGto write out multiple PNGs with minimal allocation.- Parameters:
compression- sets the deflate compression level. Default isDeflater.DEFAULT_COMPRESSIONflipY- flips the Pixmap vertically if true
-
writePNG
public static void writePNG(FileHandle file, Pixmap pixmap)
Writes the pixmap as a PNG with compression. SeePixmapIO.PNGto configure the compression level, more efficiently flip the pixmap vertically, and to write out multiple PNGs with minimal allocation.
-
-