UNPKG

@nativescript-community/ui-htmlcanvasapi

Version:

An HTML Canvas API implementation on top of android and iOS native APIs

30 lines (29 loc) 1.46 kB
import { Canvas, CanvasView } from '@nativescript-community/ui-canvas'; import { Property } from '@nativescript/core'; import { CanvasRenderingContext2D } from '../contexts/CanvasRenderingContext2D'; import { ImageBitmapRenderingContext } from '../contexts/ImageBitmapRenderingContext'; import { HTMLCanvasElement } from '../elements/HTMLCanvasElement'; import type { OffscreenCanvas } from '../elements/OffscreenCanvas'; import { SCREEN_SCALE } from '../helpers'; declare const isOffscreenBufferEnabledProperty: Property<HTMLCanvasView, boolean>; declare class HTMLCanvasView extends CanvasView { private readonly _canvasElement; private _currentCanvas; private _offscreenContext; private _offscreenPaint; private _isDrawing; isOffscreenBufferEnabled: boolean; constructor(); get canvasElement(): HTMLCanvasElement; get nativeContext(): Canvas; disposeNativeView(): void; getContext(contextId: '2d', contextAttributes?: any): CanvasRenderingContext2D | null; getContext(contextId: 'bitmaprenderer', contextAttributes?: any): ImageBitmapRenderingContext | null; transferControlToOffscreen(): OffscreenCanvas; toDataURL(type?: string, encoderOptions?: number): string; isDrawing(): boolean; onDraw(canvas: Canvas): void; _resizeOffscreenBuffer(width: number, height: number): void; _disposeOffscreenBuffer(): void; } export { HTMLCanvasView, isOffscreenBufferEnabledProperty, SCREEN_SCALE };