@alegendstale/holly-components
Version:
Reusable UI components created using lit
49 lines • 1.72 kB
TypeScript
import { PropertyValues } from 'lit';
import quantize from 'quantize';
import { CanvasBase } from './canvas-base.js';
export declare class CanvasImage extends CanvasBase {
static styles: import("lit").CSSResult[];
image?: HTMLImageElement;
imageURL: string;
smoothing: boolean;
private loading;
width: number;
height: number;
protected firstUpdated(_changedProperties: PropertyValues): void;
render(): import("lit-html").TemplateResult<1>;
/**
* Updates & loads the canvas image.
* Attempts to preserve aspect ratio based on width.
* @param width The canvas width
* @param height The canvas height
*/
updateImage(imageURL: string, width: number, height: number): void;
/**
* Gets the most frequent colors in an image
* @param numColors Number of colors to return
* @param quality Artificially reduce number of pixels (higher = less accurate but faster)
* @returns Most frequent colors
*/
getPalette(numColors?: number, quality?: number): Promise<quantize.RgbPixel[] | null>;
/**
* Creates an array of pixels from the image
* Inspired by colorthief
* @param quality Artificially reduce number of pixels (higher = less accurate but faster)
* @returns
*/
createPixelArray(quality: number): Promise<quantize.RgbPixel[] | null>;
/**
* Gets the image data from the canvas
*/
getImageData(x?: number, y?: number): Promise<ImageData>;
/**
* Waits for loading variable to equal true
*/
private waitForLoading;
}
declare global {
interface HTMLElementTagNameMap {
'canvas-image': CanvasImage;
}
}
//# sourceMappingURL=canvas-image.d.ts.map