@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
45 lines (44 loc) • 1.82 kB
TypeScript
export declare function parseHex(hex: string): {
r: number;
g: number;
b: number;
};
/**
* Cross-platform PNG encoder that works in both browser and NodeJS environments.
* Provides pre-encoded placeholder textures for reliable cross-platform use.
*/
export default class PngEncoder {
/**
* Create a simple solid-color texture.
*
* @param width Texture width
* @param height Texture height
* @param hexColor Hex color (e.g., "#FF0000")
* @returns PNG data as Uint8Array
*/
static createSolidColorPng(width: number, height: number, hexColor: string): Uint8Array | undefined;
/**
* Create a checkerboard pattern texture with two colors.
*
* @param width Texture width
* @param height Texture height
* @param primaryHex Primary color hex
* @param secondaryHex Secondary color hex
* @param cellSize Size of each checkerboard cell
* @returns PNG data as Uint8Array
*/
static createCheckerboardPng(width: number, height: number, primaryHex: string, secondaryHex: string, cellSize?: number): Uint8Array | undefined;
/**
* Async version of createCheckerboardPng that works in browser environments.
* Falls back to sync encoding first, then tries browser Canvas API.
*/
static createCheckerboardPngAsync(width: number, height: number, primaryHex: string, secondaryHex: string, cellSize?: number): Promise<Uint8Array | undefined>;
/**
* Get a pre-encoded placeholder texture.
* These work in all environments without requiring runtime PNG encoding.
*
* @param type Type of placeholder: "entity" (64x64), "block" (16x16), or "item" (16x16)
* @returns PNG data as Uint8Array
*/
static getPlaceholderTexture(type: "entity" | "block" | "item"): Uint8Array;
}