UNPKG

molstar

Version:

A comprehensive macromolecular library.

66 lines (65 loc) 2.73 kB
/** * Copyright (c) 2019-2024 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> * @author Jesse Liang <jesse.liang@rcsb.org> * @author Sebastian Bittrich <sebastian.bittrich@rcsb.org> * @author Ke Ma <mark.ma@rcsb.org> * @author Adam Midlik <midlik@gmail.com> */ import { type BufferRet as JpegBufferRet } from 'jpeg-js'; import { type PNG } from 'pngjs'; import { Canvas3D, Canvas3DProps } from '../../mol-canvas3d/canvas3d'; import { ImagePass, ImageProps } from '../../mol-canvas3d/passes/image'; import { PostprocessingProps } from '../../mol-canvas3d/passes/postprocessing'; import { RuntimeContext } from '../../mol-task'; export interface ExternalModules { 'gl': typeof import('gl'); 'jpeg-js'?: typeof import('jpeg-js'); 'pngjs'?: typeof import('pngjs'); } export type HeadlessScreenshotHelperOptions = { webgl?: WebGLContextAttributes; canvas?: Partial<Canvas3DProps>; imagePass?: Partial<ImageProps>; }; export type RawImageData = { data: Uint8ClampedArray; width: number; height: number; }; /** To render Canvas3D when running in Node.js (without DOM) */ export declare class HeadlessScreenshotHelper { readonly externalModules: ExternalModules; readonly canvasSize: { width: number; height: number; }; readonly canvas3d: Canvas3D; readonly imagePass: ImagePass; constructor(externalModules: ExternalModules, canvasSize: { width: number; height: number; }, canvas3d?: Canvas3D, options?: HeadlessScreenshotHelperOptions); private getImageData; getImageRaw(runtime: RuntimeContext, imageSize?: { width: number; height: number; }, postprocessing?: Partial<PostprocessingProps>): Promise<RawImageData>; getImagePng(runtime: RuntimeContext, imageSize?: { width: number; height: number; }, postprocessing?: Partial<PostprocessingProps>): Promise<PNG>; getImageJpeg(runtime: RuntimeContext, imageSize?: { width: number; height: number; }, postprocessing?: Partial<PostprocessingProps>, jpegQuality?: number): Promise<JpegBufferRet>; saveImage(runtime: RuntimeContext, outPath: string, imageSize?: { width: number; height: number; }, postprocessing?: Partial<PostprocessingProps>, format?: 'png' | 'jpeg', jpegQuality?: number): Promise<void>; } export declare function defaultCanvas3DParams(): Partial<Canvas3DProps>; export declare function defaultWebGLAttributes(): WebGLContextAttributes; export declare function defaultImagePassParams(): Partial<ImageProps>; export declare const STYLIZED_POSTPROCESSING: Partial<PostprocessingProps>;