UNPKG

kiutils

Version:

🎑 (Library) an Javascript library that provide various utilities, including Image manipulation tools, Discord-related utilities, and a logger.

67 lines • 2.19 kB
/// <reference types="node" /> import { CanvasData } from "../typings/interfaces"; /** * @typedef {object} CanvasData * @property {number} width - The width of the canvas * @property {number} height - The height of the canvas * @property {object} background - Background settings * @property {string} background.color - The background color * @property {string} background.image - Image URL or path * @property {string} fontColor - The font color of the canvas */ export declare class Canvas { data: CanvasData; /** * The Canvas constructor * @constructor * @param {CanvasData} options - The canvas data * @example * const { Canvas } = require("kiutils") * const canvas = new Canvas({ * width: 500, * height: 500, * background: { * image: "color", * color: "#23272A" * }, * fontColor: "#ffffff" * }) * * canvas.render() */ constructor(options?: Partial<CanvasData>); /** * Updates the canvas data * @param {Partial<CanvasData>} options - The canvas data to update * @returns {Canvas} The canvas instance for chaining */ update(options: Partial<CanvasData>): Canvas; /** * Prints the canvas data * @param {Partial<CanvasData>} options - The canvas data * @returns {void} */ print(options?: Partial<CanvasData>): void; /** * Renders the canvas * @returns {Promise<Buffer>} The rendered canvas as buffer */ render(): Promise<Buffer>; /** * Renders the canvas with text * @param {string} text - The text to render * @param {object} options - Text options * @param {string} options.font - Font settings (e.g., "20px Arial") * @param {number} options.x - X position * @param {number} options.y - Y position * @param {string} options.align - Text alignment * @returns {Promise<Buffer>} The rendered canvas as buffer */ renderWithText(text: string, options?: { font?: string; x?: number; y?: number; align?: CanvasTextAlign; }): Promise<Buffer>; } //# sourceMappingURL=canvas.d.ts.map