diff --git a/__test__/draw.spec.ts b/__test__/draw.spec.ts index 8f153638..a4f9adeb 100644 --- a/__test__/draw.spec.ts +++ b/__test__/draw.spec.ts @@ -796,6 +796,18 @@ test('setTransform', async (t) => { await snapshotImage(t) }) +test('setTransform matrix', async (t) => { + const { ctx } = t.context + const mat = new DOMMatrix() + .rotate(30) + .skewX(30) + .scale(1, Math.sqrt(3) / 2) + ctx.setTransform(mat) + ctx.fillStyle = 'red' + ctx.fillRect(100, 100, 100, 100) + await snapshotImage(t) +}) + test('stroke', async (t) => { const { ctx } = t.context // First sub-path diff --git a/__test__/snapshots/setTransform matrix.png b/__test__/snapshots/setTransform matrix.png new file mode 100644 index 00000000..d8b69c70 Binary files /dev/null and b/__test__/snapshots/setTransform matrix.png differ diff --git a/src/ctx.rs b/src/ctx.rs index ab45a075..3234772b 100644 --- a/src/ctx.rs +++ b/src/ctx.rs @@ -1919,10 +1919,10 @@ impl From for Transform { fn from(value: TransformObject) -> Self { Self::new( value.a as f32, - value.b as f32, value.c as f32, - value.d as f32, value.e as f32, + value.b as f32, + value.d as f32, value.f as f32, ) }