com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings Java Examples

The following examples show how to use com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PackModel.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
private static int computeSettingsStateHash(Settings s) {
    int result = Objects.hash(s.pot, s.multipleOfFour, s.paddingX, s.paddingY, s.edgePadding, s.duplicatePadding,
            s.rotation, s.minWidth, s.minHeight, s.maxWidth, s.maxHeight,
            s.square, s.stripWhitespaceX, s.stripWhitespaceY, s.alphaThreshold,
            s.filterMin, s.filterMag, s.wrapX, s.wrapY, s.format, s.alias, s.ignoreBlankImages,
            s.fast, s.debug, s.silent, s.combineSubdirectories, s.ignore, s.flattenPaths,
            s.premultiplyAlpha, s.useIndexes, s.bleed, s.bleedIterations, s.limitMemory,
            s.grid, s.atlasExtension);
    result = 31 * result + Arrays.hashCode(s.scale);
    result = 31 * result + Arrays.hashCode(s.scaleSuffix);
    result = 31 * result + Arrays.hashCode(s.scaleResampling);
    return result;
}
 
Example #2
Source File: TexturePackerApp.java    From ninja-rabbit with GNU General Public License v2.0 5 votes vote down vote up
public static void main(final String[] args) {
	Settings settings = new Settings();
	settings.edgePadding = true;
	settings.paddingX = 2;
	settings.paddingY = 2;
	settings.pot = false;
	settings.maxHeight = 2048;
	settings.maxWidth = 2048;
	TexturePacker.process(settings, "C:\\Users\\Nicolás\\Desktop\\tiles",
			"C:\\Users\\Nicolás\\Desktop\\tiles.pack",
			"tiles.pack");
}
 
Example #3
Source File: OrderedGridPacker.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public OrderedGridPacker(Settings settings) {
	this.settings = settings;
}
 
Example #4
Source File: MaxRectsPacker.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public MaxRectsPacker (Settings settings) {
	this.settings = settings;
	if (settings.minWidth > settings.maxWidth) throw new RuntimeException("Page min width cannot be higher than max width.");
	if (settings.minHeight > settings.maxHeight)
		throw new RuntimeException("Page min height cannot be higher than max height.");
}
 
Example #5
Source File: GridPacker.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public GridPacker (Settings settings) {
	this.settings = settings;
}
 
Example #6
Source File: ImageProcessor.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public ImageProcessor(Settings settings) {
	this.settings = settings;
}
 
Example #7
Source File: PackModel.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public Settings getSettings() {
    return settings;
}
 
Example #8
Source File: PackModel.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
public void setSettings(Settings settings) {
    this.settings.set(settings);
}
 
Example #9
Source File: ImageUtils.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
public static void createAtlas(String inDir, String outdir, String name, float scale, int maxWidth, int maxHeight,
		TextureFilter filterMin, TextureFilter filterMag, String outputFormat, boolean stripWhiteSpace)
		throws IOException {
	Settings settings = new Settings();

	settings.pot = false;
	settings.paddingX = 2;
	settings.paddingY = 2;
	settings.duplicatePadding = false;
	settings.edgePadding = true;
	settings.rotation = false;
	settings.minWidth = 16;
	settings.minWidth = 16;
	settings.stripWhitespaceX = stripWhiteSpace;
	settings.stripWhitespaceY = stripWhiteSpace;
	settings.alphaThreshold = 0;

	settings.filterMin = filterMin;
	settings.filterMag = filterMag;
	settings.wrapX = Texture.TextureWrap.ClampToEdge;
	settings.wrapY = Texture.TextureWrap.ClampToEdge;
	settings.format = Format.RGBA8888;
	settings.alias = true;
	settings.outputFormat = outputFormat;
	settings.jpegQuality = 0.9f;
	settings.ignoreBlankImages = true;
	settings.fast = false;
	settings.debug = false;

	settings.maxWidth = maxWidth;
	settings.maxHeight = maxHeight;

	EditorLogger.debug("ATLAS MAXWIDTH: " + settings.maxWidth);

	File inTmpDir = new File(inDir);

	// Resize images to create atlas for different resolutions
	if (scale != 1.0f) {
		inTmpDir = DesktopUtils.createTempDirectory();

		ImageUtils.scaleDirFiles(new File(inDir), inTmpDir, scale);
	}

	TexturePacker.process(settings, inTmpDir.getAbsolutePath(), outdir,
			name.endsWith(".atlas") ? name : name + ".atlas");

	if (scale != 1.0f) {
		DesktopUtils.removeDir(inTmpDir.getAbsolutePath());
	}
}