const fs = require('fs')
const path = require('path')
const { createCanvas, Image } = require('bindings')('canvas');

const canvas1 = createCanvas(150, 150);
const ctx1 = canvas1.getContext('2d');

const canvas2 = createCanvas(150, 150);
const ctx2 = canvas2.getContext('2d');

ctx2.fillStyle = '#ffec30' 
ctx1.fillStyle="#00ff32"
ctx2.fillRect(0, 0, 150, 150);
ctx1.fillRect(0,0,150,150);
ctx2.fillRect(20,20,20,20);
ctx1.fillRect(20,20,20,20);

canvas1.createPNG("canvas1")
canvas2.createPNG("canvas2")
@@ -278,57 +278,783 @@
 %0Actx
-2.fillStyle = '#ffec30' %0Actx1.fillStyle=%22#00ff32%22
+1.fillRect(0, 0, 150, 150) // Draw a rectangle with default settings%0Actx1.save() // Save the default state%0A%0Actx2.fillRect(0, 0, 150, 150) // Draw a rectangle with default settings%0Actx2.save() // Save the default state%0A%0Actx1.fillStyle = '#09F' // Make changes to the settings%0Actx1.fillRect(15, 15, 120, 120) // Draw a rectangle with new settings%0A%0Actx2.fillStyle = '#09F' // Make changes to the settings%0Actx2.fillRect(15, 15, 120, 120) // Draw a rectangle with new settings%0A%0Actx1.save() // Save the current state%0Actx1.fillStyle = '#FFF' // Make changes to the settings%0Actx1.globalAlpha = 0.5%0Actx1.fillRect(30, 30, 90, 90) // Draw a rectangle with new settings%0A%0Actx2.save() // Save the current state%0Actx2.fillStyle = '#FFF' // Make changes to the settings%0Actx2.globalAlpha = 0.5
 %0Actx
@@ -1068,57 +1068,338 @@
 ect(
+3
 0, 
+3
 0, 
-150, 150);%0Actx1.fillRect(0,0,150,150);
+90, 90) // Draw a rectangle with new settings%0A%0Actx1.restore() // Restore previous state%0Actx1.fillRect(45, 45, 60, 60) // Draw a rectangle with restored settings%0A%0Actx2.restore() // Restore previous state%0Actx2.fillRect(45, 45, 60, 60) // Draw a rectangle with restored settings%0A%0Actx1.restore() // Restore original state
 %0Actx
-2
+1
 .fil
@@ -1408,26 +1408,113 @@
 ect(
-20,20,20,20);
+60, 60, 30, 30) // Draw a rectangle with restored settings%0A%0Actx2.restore() // Restore original state
 %0Actx
-1
+2
 .fil
@@ -1523,21 +1523,67 @@
 ect(
-20,20,20,20);
+60, 60, 30, 30) // Draw a rectangle with restored settings%0A
 %0A%0Aca

完成两个canvas/context相互切换