UNPKG

1.23 kBPlain TextView Raw
1import { ViewProps } from 'react-native';
2
3import WebGL2RenderingContext from './WebGL2RenderingContext'
4
5export type SurfaceCreateEvent = {
6 nativeEvent: {
7 exglCtxId: number;
8 };
9};
10
11export type SnapshotOptions = {
12 flip?: boolean;
13 framebuffer?: WebGLFramebuffer;
14 rect?: {
15 x: number;
16 y: number;
17 width: number;
18 height: number;
19 };
20 format?: 'jpeg' | 'png';
21 compress?: number;
22};
23
24export type GLSnapshot = {
25 uri: string | Blob | null;
26 localUri: string;
27 width: number;
28 height: number;
29};
30
31export interface ExpoWebGLRenderingContext extends WebGL2RenderingContext {
32 __exglCtxId: number;
33 endFrameEXP(): void;
34}
35
36/**
37 *
38 * A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES
39 * context is created. Its drawing buffer is presented as the contents of
40 * the View every frame.
41 */
42export interface BaseGLViewProps extends ViewProps {
43 /**
44 * Called when the OpenGL context is created, with the context object as a parameter. The context
45 * object has an API mirroring WebGL's WebGLRenderingContext.
46 */
47 onContextCreate(gl: ExpoWebGLRenderingContext): void;
48
49 /**
50 * [iOS only] Number of samples for Apple's built-in multisampling.
51 */
52 msaaSamples?: number;
53}