ReadonlyengineWhich rasteriser drew the pages: 'gpu' or 'cpu'.
ReadonlygpuWhether the GPU was asked for.
ReadonlypageHow many pages were painted.
ReadonlyscaleThe device-pixel multiplier the pages were drawn at.
Encodes the painted pages and returns the bytes.
A Node Buffer, which is what the addon hands back: it builds the result
with Neon's JsBuffer::from_slice (crates/meo-canvas-node/src/lib.rs:485).
A caller supplying their own native surface for a test may return any
Buffer; a plain Uint8Array would be a different value from the one this
package ships.
Encodes the painted pages on a worker and resolves with the bytes.
The same bytes NativeCanvas.encode returns — the addon defines the two as one path rather than two, so they cannot drift — produced without occupying the event loop for the encode.
Rejects rather than throwing once the work has left the calling thread:
a format the addon does not know is a synchronous TypeError, because
there is still a call to throw from, while a failure inside the encode
settles the promise.
Frees the Skia surface. Calling it twice is not an error.
Encodes the painted pages straight into a file, blocking.
Not NativeCanvas.encode followed by a write, and the difference is the whole reason it exists: a format that gathers every page streams into the file, where encoding first has to hold the entire document in memory to hand it back. A long animation is bounded by disk here and by RAM there.
The format is passed rather than inferred from the path. The extension is resolved on this side, because the error for an unrecognised one names the file; inferring it again on the far side would be one question with two places to answer it.
Encodes the painted pages straight into a file, on a worker.
NativeCanvas.write with the encode moved off the event loop, the way NativeCanvas.encodeAsync moves it for a buffer.
The retained surface, as the addon hands it over.
Declared here rather than imported so this file compiles without the native module, and so the shape the addon has to satisfy is written down in one place.
Two encodes rather than one, and the difference is which thread does the work. NativeCanvas.encode runs on the event loop; NativeCanvas.encodeAsync takes the half of an export that needs the canvas, hands the rest to a worker, and resolves when that worker finishes. Both are required: a surface offering only the synchronous one would make Canvas.toBuffer a promise that was already settled, which is what this pair exists to stop being true.