import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-native-nitro-modules'; export type ThorShapeType = 'rect' | 'circle' | 'line' | 'polygon'; /** Rendering backend: 'cpu' (software) or 'gpu' (ThorVG GL — Android). */ export type ThorBackend = 'cpu' | 'gpu'; /** * A single shape in a Canvas scene. Coordinates are in points (the native side * scales to device pixels). Colors are hex strings ('#rrggbb' / '#aarrggbb'). * Omit `fill` for a shape with no fill (e.g. a borders-only rectangle). */ export interface ThorShape { type: ThorShapeType; fill?: string; stroke?: string; strokeWidth?: number; x?: number; y?: number; width?: number; height?: number; rx?: number; ry?: number; cx?: number; cy?: number; radius?: number; x1?: number; y1?: number; x2?: number; y2?: number; points?: number[]; closed?: boolean; } export interface ThorViewProps extends HybridViewProps { /** The scene to render, drawn in order (later shapes paint on top). */ shapes: ThorShape[]; /** Rendering backend; defaults to 'cpu'. 'gpu' uses ThorVG's GL engine (Android). */ backend?: ThorBackend; } export interface ThorViewMethods extends HybridViewMethods { /** * Imperatively replace the scene and rasterize it immediately, on the calling * thread. Unlike the `shapes` prop (which is committed through Fabric on the JS * thread), this can be called from a worklet — e.g. a reanimated * `useFrameCallback` or a VisionCamera frame processor — to drive the canvas * entirely off the JS thread. Get the view's HybridObject via `hybridRef`. */ drawShapes(shapes: ThorShape[]): void; } export type ThorView = HybridView;