Skip to main content

Interface: ScreenshotProjection

The screenshot's view-projection matrix and pixel dimensions. The matrix maps homogeneous world coordinates to clip space. Divide by w to get normalized coordinates, then scale into the image with the origin at the top left. Coordinates refer to the original render if a custom image postprocessor changes the image.

Example​

const shot = await window.mimeeqApp.utils.takeScreenshot({
size: { width: 1600, height: 800 },
camera: { position: [0, 10, 0.001], target: [0, 0, 0] },
projection: 'orthographic',
fit: true,
returnProjection: true,
});
if (shot) {
const { viewProjection: m, width, height } = shot.projection;
const toPixel = (x: number, y: number, z: number) => {
const w = m[3] * x + m[7] * y + m[11] * z + m[15];
const nx = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
const ny = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
return { x: (nx + 1) * width / 2, y: (1 - ny) * height / 2 };
};
// For a PDF overlay, scale these pixel coordinates with the placed image.
const anchor = toPixel(1, 0, 1);
}

Properties​

height​

height: number

Original rendered image height in pixels.

Example​

const shot = await window.mimeeqApp.utils.takeScreenshot({ returnProjection: true });
console.log(shot?.projection.height);

viewProjection​

viewProjection: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

Sixteen matrix elements in column-major order.

Example​

const shot = await window.mimeeqApp.utils.takeScreenshot({ returnProjection: true });
console.log(shot?.projection.viewProjection);

width​

width: number

Original rendered image width in pixels.

Example​

const shot = await window.mimeeqApp.utils.takeScreenshot({ returnProjection: true });
console.log(shot?.projection.width);