/* global HTMLCanvasElement, ResizeObserver, MediaQueryList */
import React, {
useRef,
useEffect,
useCallback,
useImperativeHandle,
useLayoutEffect,
} from "react";
import type { LayoutChangeEvent } from "react-native";
import type { GrDirectContext, WebGLContextHandle } from "canvaskit-wasm";
import type { SkRect, SkPicture, SkImage } from "../skia/types";
import { JsiSkSurface } from "../skia/web/JsiSkSurface";
import { Platform } from "../Platform";
import type { ISkiaViewApiWeb } from "../specs/NativeSkiaModule.web";
import type { SkiaPictureViewNativeProps } from "./types";
import { SkiaViewNativeId } from "./SkiaViewNativeId";
const dp2Pixel = (pd: number, rect?: SkRect) => {
if (!rect) {
return undefined;
}
return {
x: rect.x * pd,
y: rect.y * pd,
width: rect.width * pd,
height: rect.height * pd,
};
};
interface Renderer {
onResize(): void;
draw(picture: SkPicture): void;
makeImageSnapshot(picture: SkPicture, rect?: SkRect): SkImage | null;
dispose(): void;
}
// A