libgdx API

com.badlogic.gdx.graphics
Class PixmapIO

java.lang.Object
  extended by com.badlogic.gdx.graphics.PixmapIO

public class PixmapIO
extends java.lang.Object

Class with static methods to read and write Pixmaps to a custom zlib based format. First three integers define the width, height and format, remaining bytes are zlib compressed pixels.

Author:
mzechner, Nathan Sweet

Constructor Summary
PixmapIO()
           
 
Method Summary
static Pixmap readCIM(FileHandle file)
          Reads the Pixmap from the given file, assuming the Pixmap was written with the writeCIM(FileHandle, Pixmap) method.
static void writeCIM(FileHandle file, Pixmap pixmap)
          Writes the Pixmap to the given file using a custom compression scheme.
static void writePNG(FileHandle file, Pixmap pixmap)
          Writes the pixmap as a PNG.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixmapIO

public PixmapIO()
Method Detail

writeCIM

public static void writeCIM(FileHandle file,
                            Pixmap pixmap)
Writes the Pixmap to the given file using a custom compression scheme. 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 the Pixmap from the given file, assuming the Pixmap was written with the writeCIM(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)
Writes the pixmap as a PNG. Note this method uses quite a bit of working memory. writeCIM(FileHandle, Pixmap) is faster if the file does not need to be read outside of libgdx.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)