texturepacker-cli
Version:
NodeJS command-line interface for TexturePacker
77 lines (69 loc) • 2.2 kB
TypeScript
declare enum AlphaHandling {
ClearTransparentPixels = "ClearTransparentPixels",
KeepTransparentPixels = "KeepTransparentPixels",
PremultiplyAlpha = "PremultiplyAlpha",
ReduceBorderArtifacts = "ReduceBorderArtifacts"
}
declare enum Format {
Cocos2D = "cocos2d",
JSONHash = "json",
PixiJS = "pixijs4",
Spine = "spine",
XML = "xml"
}
type AlphaHandlingType = AlphaHandling | `${AlphaHandling}`;
type FormatType = Format | `${Format}`;
type TexturePackerOptions = {
/**
* Defines how color values of transparent pixels are processed.
*/
alphaHandling: AlphaHandlingType;
/**
* Sets the output filename for the Data file. This file contains metadata
* like sprite sizes and coordinates.
*/
data: string;
/**
* Prevents sprites from being rotated by 90 degrees for better texture packing.
*/
disableRotation: boolean;
/**
*
*/
fileList: string[];
/**
* Sets the data format or framework for a new project. This choice enables
* additional feature. It determines how sprite metadata is saved.
*/
format: FormatType;
/**
* Transparent margin which is left over after trimming.
*/
trimMargin: number;
/**
* Removes image file extensions like *.png* or *.tga* from sprite names.
*/
trimSpriteNames: boolean;
};
declare const DEFAULT_OPTIONS: TexturePackerOptions;
declare function pack(): string;
declare class TexturePacker {
private static readonly Command;
private readonly _options;
get command(): string;
get args(): string[];
get data(): string;
constructor(options?: Partial<TexturePackerOptions>);
setFileList(fileList: string[]): this;
setFormat(format: FormatType): this;
setData(data: string): this;
setTrimMargin(trimMargin: number): this;
setAlphaHandling(alphaHandling: AlphaHandlingType): this;
trimSpriteNames(): this;
disableRotation(): this;
toString(): string;
run(): Promise<void>;
runSync(): void;
}
declare function unpack(): string;
export { AlphaHandling, DEFAULT_OPTIONS, Format, TexturePacker, type TexturePackerOptions, pack, unpack };