Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
import type { LayerExportGuard } from './capabilities';
import type { CanvasStateContractV3 } from './contracts';
import type { LayerUnreadable } from './layerExportGuards';
import type { SpatialRunner } from './render/exactAdjustments';
import type { RasterSurface } from './render/raster';
import type { Rect } from './types';
/**
* Owned access to one layer's pixels. The source stays pinned (resident, untrimmed) until `release`, which is
* idempotent; `guard` tells whether the pixels still describe the live layer.
*/
export interface RasterReadLease {
readonly surface: RasterSurface;
/** Layer-local extent of `surface`. */
readonly rect: Rect;
readonly guard: LayerExportGuard;
release(): void;
}
export interface CaptureRasterSnapshotOptions {
signal?: AbortSignal;
includeDisabled?: boolean;
/** Document-space output region. Rotated/scaled layers and spatial stacks retain their full source context. */
region?: Rect;
}
export interface CanvasDetachedLayerSurface {
/** Whole source extent before optional region capture; authoritative for content bounds. */
readonly sourceRect?: Rect;
readonly rect: Rect;
readonly surface: RasterSurface;
}
export interface CanvasRasterSnapshot {
readonly canvas: CanvasStateContractV3;
readonly documentGeneration: number;
readonly emptyLayerIds: ReadonlySet<string>;
readonly layerSurfaces: ReadonlyMap<string, CanvasDetachedLayerSurface>;
release(): void;
}
/** {@link LayerUnreadable}: a required layer's pixels could not be read (its image is gone or does not decode). */
export type CaptureRasterSnapshotResult =
| { status: 'ok'; snapshot: CanvasRasterSnapshot }
| { status: 'stale' | 'aborted' | 'not-ready' | 'over-budget' }
| LayerUnreadable;
export interface CanvasCompositeExecutorDeps {
backend: {
createSurface(width: number, height: number): RasterSurface;
encodeSurface(surface: RasterSurface, type?: string): Promise<Blob>;
};
reserve?(
bytes: number
):
| { status: 'ok'; lease: { release(): void } }
| { status: 'over-budget'; requestedBytes: number; availableBytes: number };
uploadImage(blob: Blob): Promise<{ imageName: string; width: number; height: number }>;
/** Evaluates spatial adjustment runs exactly for the composites (`SpatialAdjustmentService.run`). */
runSpatial?: SpatialRunner;
}