merchi_product_editor
Version:
A React component for editing product images using Fabric.js
41 lines (40 loc) • 1.18 kB
TypeScript
import { fabric } from 'fabric';
import { SavedCanvasObject } from '../types';
interface ExtendedCanvas extends fabric.Canvas {
designBounds?: {
left: number;
top: number;
right: number;
bottom: number;
width: number;
height: number;
};
psdUrl?: string;
anythingABC?: string;
}
/**
* Extracts layers from a PSD file and renders them to a PNG
*
* @param psdUrl URL to the PSD file
* @returns Promise that resolves to a PNG data URL
*/
export declare const extractPsdBaseLayer: (psdUrl: string) => Promise<{
dataUrl: string;
designBounds?: {
left: number;
top: number;
right: number;
bottom: number;
};
}>;
/**
* Loads a PSD file onto a fabric.js canvas
*
* @param canvas fabric.js Canvas instance
* @param psdUrl URL to the PSD file
* @param width Canvas width
* @param height Canvas height
* @returns Promise that resolves when the image is added to the canvas
*/
export declare const loadPsdOntoCanvas: (canvas: ExtendedCanvas, psdUrl: string, variations: any[], savedObjects: SavedCanvasObject[], width: number, height: number) => Promise<void>;
export {};