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 { StrokeSession } from './strokeSession';
import type { StrokeCommittedEvent, StrokeEdit } from './tool';
export const ADMIT_ALL: Pick<StrokeEdit, 'grow'> = { grow: () => true };
export const commitStroke = (session: StrokeSession): StrokeCommittedEvent | null => {
let committed: StrokeCommittedEvent | null = null;
session.commit((event) => {
committed = event;
return true;
});
return committed;
};
export const createRecordingStrokeEdit = (admitBytes = Infinity) => {
const record = { admitted: 0, cancelled: 0, commits: [] as StrokeCommittedEvent[] };
const edit: StrokeEdit = {
cancel: () => {
record.cancelled += 1;
},
commit: (event) => {
record.commits.push(event);
return true;
},
grow: (bytes) => {
if (record.admitted + bytes > admitBytes) {
return false;
}
record.admitted += bytes;
return true;
},
};
return { edit, record };
};