import { TexturePackerImage } from 'free-tex-packer-core'; import { ITree } from '../../Bulldog'; import { Processor } from '../../Processor'; import { Process } from '../Process'; import { IResolutionOptions } from './MipImage'; /** Options exposed by "free-texture-packer" */ export interface FreeTexturePackerOptions { textureName?: string; width?: number; height?: number; fixedSize?: boolean; padding?: number; extrude?: number; allowRotation?: boolean; detectIdentical?: boolean; allowTrim?: boolean; trimMode?: string; removeFileExtension?: boolean; prependFolderName?: boolean; textureFormat?: string; base64Export?: boolean; scale?: number; tinify?: boolean; tinifyKey?: string; filter?: string; packer?: string; packerMethod?: string; exporter?: string; } /** Options to change how the spritesheet is generated and saved */ export interface IBaseTexturePackerOptions extends FreeTexturePackerOptions { /** * Directory to save spritesheet */ outputDir: string; /** * Directory to find images to start spritesheet */ inputDir: string; /** * Original scale of the images. Used to help determine the jsons meta.scale property */ originalScale: number; /** * Used to inject a prefix into the file name. eg _mip */ prefix?: string; } /** Options for the plugin */ export declare type TexturePackerOptions = IResolutionOptions & { /** Options to change how the spritesheet is generated and saved */ texturePacker?: Partial; }; /** * This class will create a spritesheet and resize it based on the resolutions provided * The highest resolution image will be assumed to be the original image. * * ```ts * new TexturePacker({ * prefixTemplate:'@%%x', * resolutions:{ high: 2, default: 1, low: 0.5 }, * }) * ``` * an image: * * `mySprite{tps}` * * becomes ===\> * * mySprite\@2x.json \<-- 100% of original image size * mySprite.json \<--- 50% of original image size * \`mySprite\@0.5.json \<--- 25% of original image size * * Pixi automatically can figure out the resolution based on this prefix. * The resolutionNames are assigned as the transformId which will be used for the manifest generation. * Example of manifest below: * * ``` json * "image": { * "mySprite": { * "tags": { * "tps": true * }, * "high": "mySprite@2x.json", * "default": "mySprite.json", * "low": "mySprite@0.5x.json" * } * } * ``` */ export declare class TexturePacker extends Process { /** * A prefix template for denoting the resolution of the images. * @defaultValue '\@%xx' */ prefixTemplate: string; /** * An object containing the resolutions that the images will be resized to. * @defaultValue \{ high: 2, default: 1, low: 0.5 \} */ resolutionHash: { [x: string]: number; }; /** * If the fixed tag is applied then only this resolution will be generated. * @defaultValue = \{ default: 1 \} */ resolutionFixedHash: { [x: string]: number; }; /** * The largest resolution to be created. */ biggestResolution: number; /** * the maximum size a sprite sheet can be before its split out * default is 4096 */ maximumTextureSize: number; /** * @param options - Options used to customise the TexturePacker plugin */ constructor(options?: TexturePackerOptions); /** * @override */ test(tree: ITree): boolean; /** * Converts the images into a spritesheet and saves the output * @param imagesToPack - Array of images to pack * @param options - * * @returns a list of file paths that where saved */ texturePackPromise(imagesToPack: TexturePackerImage[], options: IBaseTexturePackerOptions): Promise; /** * Finds all files that match the specified glob pattern. * @param path - a glob pattern to be checked * @returns Array of files that matched the glob pattern */ globPromise(path: string): Promise; /** * Creates a spritesheet based on the path from the tree. * @override */ transform(tree: ITree, processor: Processor): Promise; } //# sourceMappingURL=TexturePacker.d.ts.map