APIdia Launch Partner
Top Fields Constructors Methods
com.badlogic.gdx.tools.texturepacker

public Class ImageProcessor

extends Object
Class Inheritance
Imports
java.awt.Graphics2D, .Image, .RenderingHints, java.awt.image.BufferedImage, .WritableRaster, java.io.File, .IOException, java.math.BigInteger, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.Arrays, .HashMap, java.util.regex.Matcher, .Pattern, javax.imageio.ImageIO, com.badlogic.gdx.tools.texturepacker.TexturePacker.Alias, .TexturePacker.Resampling, .TexturePacker.Rect, .TexturePacker.Settings, com.badlogic.gdx.utils.Array

Field Summary

Modifier and TypeField and Description
private final HashMap<String, TexturePacker.Rect>
private static final BufferedImage
private static Pattern
private final Array<TexturePacker.Rect>
private TexturePacker.Resampling
private float
private final TexturePacker.Settings

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public TexturePacker.Rect
addImage(File file, String
Used to strip the root directory prefix from image file names, can be null.
rootPath
)

The image won't be kept in-memory during packing if Settings#limitMemory is true.

public TexturePacker.Rect
addImage(BufferedImage image, String name)

The image will be kept in-memory during packing.

public void
public Array<TexturePacker.Rect>
private int[]
getPads(BufferedImage image, String name, int[] splits)

Returns the pads, or null if the image had no pads or the pads match the splits.

public float
public TexturePacker.Settings
private static int
getSplitPoint(WritableRaster raster, String name, int startX, int startY, boolean startPoint, boolean xAxis)

Hunts for the start or end of a sequence of split pixels.

private int[]
getSplits(BufferedImage image, String name)

Returns the splits, or null if the image had no splits or the splits were only a single region.

private static String
private static void
hash(MessageDigest digest, int value)

protected TexturePacker.Rect
processImage(BufferedImage image, String name)

Returns a rect for the image describing the texture region to be packed, or null if the image should not be packed.

public void
public void
setScale(float scale)

private static String
splitError(int x, int y, int[] rgba, String name)

protected TexturePacker.Rect
stripWhitespace(String name, BufferedImage source)

Strips whitespace and returns the rect, or null if the image should be ignored.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

crcsback to summary
private final HashMap<String, TexturePacker.Rect> crcs
emptyImageback to summary
private static final BufferedImage emptyImage
indexPatternback to summary
private static Pattern indexPattern
rectsback to summary
private final Array<TexturePacker.Rect> rects
resamplingback to summary
private TexturePacker.Resampling resampling
scaleback to summary
private float scale
settingsback to summary
private final TexturePacker.Settings settings

Constructor Detail

ImageProcessorback to summary
public ImageProcessor(TexturePacker.Settings settings)

Method Detail

addImageback to summary
public TexturePacker.Rect addImage(File file, String rootPath)

The image won't be kept in-memory during packing if Settings#limitMemory is true.

Parameters
rootPath:String

Used to strip the root directory prefix from image file names, can be null.

addImageback to summary
public TexturePacker.Rect addImage(BufferedImage image, String name)

The image will be kept in-memory during packing.

See Also
addImage(File, String)
clearback to summary
public void clear()
getImagesback to summary
public Array<TexturePacker.Rect> getImages()
getPadsback to summary
private int[] getPads(BufferedImage image, String name, int[] splits)

Returns the pads, or null if the image had no pads or the pads match the splits. Pads are an int[4] that has left, right, top, bottom.

getScaleback to summary
public float getScale()
getSettingsback to summary
public TexturePacker.Settings getSettings()
getSplitPointback to summary
private static int getSplitPoint(WritableRaster raster, String name, int startX, int startY, boolean startPoint, boolean xAxis)

Hunts for the start or end of a sequence of split pixels. Begins searching at (startX, startY) then follows along the x or y axis (depending on value of xAxis) for the first non-transparent pixel if startPoint is true, or the first transparent pixel if startPoint is false. Returns 0 if none found, as 0 is considered an invalid split point being in the outer border which will be stripped.

getSplitsback to summary
private int[] getSplits(BufferedImage image, String name)

Returns the splits, or null if the image had no splits or the splits were only a single region. Splits are an int[4] that has left, right, top, bottom.

hashback to summary
private static String hash(BufferedImage image)
hashback to summary
private static void hash(MessageDigest digest, int value)
processImageback to summary
protected TexturePacker.Rect processImage(BufferedImage image, String name)

Returns a rect for the image describing the texture region to be packed, or null if the image should not be packed.

setResamplingback to summary
public void setResampling(TexturePacker.Resampling resampling)
setScaleback to summary
public void setScale(float scale)
splitErrorback to summary
private static String splitError(int x, int y, int[] rgba, String name)
stripWhitespaceback to summary
protected TexturePacker.Rect stripWhitespace(String name, BufferedImage source)

Strips whitespace and returns the rect, or null if the image should be ignored.