fun clip_restore()

in platf-android/src/androidInstrumentedTest/kotlin/org/jetbrains/letsPlot/android/canvas/ContextClipTest.kt [121:147]


    fun clip_restore() {
        val (canvas, ctx) = createCanvas()

        ctx.fillStyle = "rgba(0, 0, 0, 0.5)"
        ctx.save()

        // NW clip rect
        ctx.beginPath()
        nwRect(ctx)
        ctx.closePath()
        ctx.clip()

        // Draws NW sector of the circle
        ctx.beginPath()
        ctx.arc(50, 50, 50, 0, 2 * PI)
        ctx.fill()

        // disables clipping
        ctx.restore()

        // Draw whole circle - NW sector should be darker because alpha and double fill
        ctx.beginPath()
        ctx.arc(50, 50, 50, 0, 2 * PI)
        ctx.fill()

        imageComparer.assertImageEquals("clip_restore.bmp", canvas.img)
    }