UNPKG

react-canvaskit

Version:

A React implementation of the Skia-CanvasKit drawing library.

30 lines (29 loc) 1.34 kB
import type { CanvasKit, Paint as SkPaint, Surface as SkSurface } from 'canvaskit-wasm'; import type { ReactElement } from 'react'; import type { CkCanvasProps } from './CkCanvas'; import { CkElement, CkElementContainer, CkElementCreator, CkElementProps, CkObjectTyping, Paint } from './SkiaElementTypes'; export interface CkSurfaceProps extends CkElementProps<SkSurface> { width: number; height: number; dx?: number; dy?: number; paint?: Paint; children?: ReactElement<CkCanvasProps> | ReactElement<CkCanvasProps>[]; } export declare class CkSurface implements CkElementContainer<'ck-surface'> { readonly canvasKit: CanvasKit; readonly props: CkObjectTyping['ck-surface']['props']; skObject?: CkObjectTyping['ck-surface']['type']; readonly skObjectType: CkObjectTyping['ck-surface']['name']; readonly type: 'ck-surface'; children: CkElementContainer<'ck-canvas'>[]; readonly defaultPaint: SkPaint; private renderPaint?; deleted: boolean; constructor(canvasKit: CanvasKit, props: CkObjectTyping['ck-surface']['props']); render(parent: CkElementContainer<any>): void; private drawSelf; delete(): void; } export declare const createCkSurface: CkElementCreator<'ck-surface'>; export declare function isCkSurface(ckElement: CkElement<any>): ckElement is CkSurface;