exportMatrix property
Matrix4
get
exportMatrix
The source-pixel → output-pixel affine paintExportOf bakes (with
flipDecoration == 0): move the crop origin to the output origin,
then apply the centered imageTransform (pan / scale / rotateZ /
flipX). The output canvas is exportSize. A pure 2D affine — no
perspective, since the card-flip decoration is only a live-edit
animation. The video export path hands this same matrix to the
native encoder (and the live cropped-video preview paints with it),
so the exported frames match the on-screen crop exactly.
Implementation
math.Matrix4 get exportMatrix {
final cx = imageSize.width / 2;
final cy = imageSize.height / 2;
return math.Matrix4.identity()
..translateByVector3(math.Vector3(cx - crop.left, cy - crop.top, 0))
..multiply(imageTransform.matrix)
..translateByVector3(math.Vector3(-cx, -cy, 0));
}