Clear NSImage's specified rect

Hi, I want to clear specified rect of NSImage.

I make a small program to draw mouse cursor, there is need to erase mouse cursor on NSImage.

https://www.youtube.com/watch?v=WcwToHIKukQ

Drawing mouse cursor is easy.

But it is hard to erase mouse cursor from NSImage.

How do I do it ?

Model: MacBook Pro 2012
AppleScript: 2.7
Browser: Safari 13.0.1
Operating System: macOS 10.14

We solved this.

http://piyocast.com/as/archives/9266