import { Framebuffer } from './framebuffer'; import { DefaultFramebuffer } from './defaultframebuffer'; /** * Utility for capturing images directly from any framebuffer. This enables taking a screenshot bigger than the used * canvas. Supports capturing of only part of the framebuffer. The resulting image can be transformed to a data URL. * The data URL can then be used to embed the image inline in documents or to download it. * * ``` * controller.postFrameEvent$.pipe(rxjs.operators.first()).subscribe(() => { * const img = gloperate.FrameCapture.capture(renderer._defaultFBO); * const data = gloperate.FrameCapture.createDataURL(img, 'image/png'); * console.log(data); * }) * ``` */ export declare class FrameCapture { /** * Creates a data URL for the given image. The data will be encoded according to type. The type defaults to png, * if no type is given. Quality can be only set for types using lossy compression. The default quality is 0.92. * @param imageData - Image to create the data URL for. * @param type - Optional format used for encoding. * @param quality - Optional quality used for lossy compression. */ static createDataURL(imageData: ImageData, type?: string, quality?: number): string; /** * Captures the gl.BACK buffer of the default framebuffer and writes it into the given framebuffer. Sets the color * buffer source for the default framebuffer to gl.BACK. * @param rect - Part of the framebuffer to capture. * @param buffer - Buffer to write the data into. */ protected static captureDefaultFramebuffer(framebuffer: Framebuffer, rect: FrameCapture.Rect, buffer: Uint8Array): void; /** * Captures the given attachment of the given framebuffer. Sets the color buffer source to the given attachment. * @param framebuffer - Framebuffer to capture. * @param attachment - Attachment to capture. * @param rect - Part of the framebuffer to capture. * @param buffer - Buffer to write the data into. */ protected static captureFramebuffer(framebuffer: Framebuffer, attachment: GLenum, rect: FrameCapture.Rect, buffer: Uint8Array): void; /** * Flips the given image data vertically. * @param imageData - Image data to flip. */ static flipImageDataVertically(imageData: ImageData): void; /** * Captures (part of) the given attachment of a framebuffer. The format of the underlying texture has to be gl.RGBA * and the type has to be either gl.UNSIGNED_BYTE, gl.HALF_FLOAT or gl.FLOAT. * @param framebuffer - Framebuffer to capture. * @param attachment - Optional attachment to capture from. Is ignored for the default framebuffer. * @param rect - Optional part of the framebuffer to capture. * @returns - The captured image. */ static capture(framebuffer: Framebuffer | DefaultFramebuffer, attachment?: GLenum, rect?: FrameCapture.Rect): ImageData; } export declare namespace FrameCapture { interface Rect { x: number; y: number; width: number; height: number; } }