1import { Component, ComponentClass } from 'react'; 2import { ViewProps } from 'react-native'; 3 4// @docsMissing 5export type SurfaceCreateEvent = { 6 nativeEvent: { 7 exglCtxId: number; 8 }; 9}; 10 11// @needsAudit 12export type SnapshotOptions = { 13 /** 14 * Whether to flip the snapshot vertically. 15 * @default false 16 */ 17 flip?: boolean; 18 /** 19 * Specify the framebuffer that we will be reading from. 20 * Defaults to underlying framebuffer that is presented in the view or the current framebuffer if context is headless. 21 */ 22 framebuffer?: WebGLFramebuffer; 23 /** 24 * Rect to crop the snapshot. It's passed directly to `glReadPixels`. 25 */ 26 rect?: { 27 x: number; 28 y: number; 29 width: number; 30 height: number; 31 }; 32 /** 33 * Specifies what type of compression should be used and what is the result file extension. 34 * PNG compression is lossless but slower, JPEG is faster but the image has visible artifacts. 35 * > **Note:** When using WebP format, the iOS version will print a warning, and generate a `'png'` file instead. 36 * > It is recommendable to use platform dependant code in this case. You can refer to the [documentation on platform specific code](/versions/latest/react-native/platform-specific-code). 37 * @default 'jpeg' 38 */ 39 format?: 'jpeg' | 'png' | 'webp'; 40 /** 41 * A value in range `0` to `1.0` specifying compression level of the result image. 42 * `1.0` means no compression and `0` the highest compression. 43 * @default 1.0 44 */ 45 compress?: number; 46}; 47 48// @needsAudit 49export type GLSnapshot = { 50 /** 51 * URI to the snapshot. 52 */ 53 uri: string | Blob | null; 54 /** 55 * Synonym for `uri`. Makes snapshot object compatible with `texImage2D`. 56 */ 57 localUri: string; 58 /** 59 * Width of the snapshot. 60 */ 61 width: number; 62 /** 63 * Height of the snapshot. 64 */ 65 height: number; 66}; 67 68// @docsMissing 69export interface ExpoWebGLRenderingContext extends WebGL2RenderingContext { 70 contextId: number; 71 endFrameEXP(): void; 72 flushEXP(): void; 73 __expoSetLogging(option: GLLoggingOption): void; 74} 75 76// @docsMissing 77export type ComponentOrHandle = null | number | Component<any, any> | ComponentClass<any>; 78 79// @needsAudit 80export type GLViewProps = { 81 /** 82 * A function that will be called when the OpenGL ES context is created. 83 * The function is passed a single argument `gl` that extends a [WebGLRenderingContext](https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14) interface. 84 */ 85 onContextCreate(gl: ExpoWebGLRenderingContext): void; 86 /** 87 * `GLView` can enable iOS's built-in [multisampling](https://www.khronos.org/registry/OpenGL/extensions/APPLE/APPLE_framebuffer_multisample.txt). 88 * This prop specifies the number of samples to use. Setting this to `0` turns off multisampling. 89 * @platform ios 90 * @default 4 91 */ 92 msaaSamples: number; 93 /** 94 * Enables support for interacting with a `gl` object from code running on the Reanimated worklet thread. 95 * @default false 96 */ 97 enableExperimentalWorkletSupport: boolean; 98 /** 99 * @hidden 100 * A ref callback for the native GLView 101 */ 102 nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | null); 103} & ViewProps; 104 105// @needsAudit 106export enum GLLoggingOption { 107 /** 108 * Disables logging entirely. 109 */ 110 DISABLED = 0, 111 /** 112 * Logs method calls, their parameters and results. 113 */ 114 METHOD_CALLS = 1, 115 /** 116 * Calls `gl.getError()` after each other method call and prints an error if any is returned. 117 * This option has a significant impact on the performance as this method is blocking. 118 */ 119 GET_ERRORS = 2, 120 /** 121 * Resolves parameters of type `number` to their constant names. 122 */ 123 RESOLVE_CONSTANTS = 4, 124 /** 125 * When this option is enabled, long strings will be truncated. 126 * It's useful if your shaders are really big and logging them significantly reduces performance. 127 */ 128 TRUNCATE_STRINGS = 8, 129 /** 130 * Enables all other options. It implies `GET_ERRORS` so be aware of the slowdown. 131 */ 132 ALL = METHOD_CALLS | GET_ERRORS | RESOLVE_CONSTANTS | TRUNCATE_STRINGS, 133} 134