Capturing the screen image through code

As the title explains, I’m wondering if it’s possible to capture the screen image with code. For example image = getScreenImage(x,y,width,height). I know I can use setContext() and just draw normally, but I would like to use multiple contexts without worrying about getting the screen data.

@Zoyt at the moment it’s not possible without using setContext(). It seems like a useful feature, and I’d like to put it in. It will be slower than the setContext() method though.

If you were thinking I would put it in a loop, that’s bot my plan. But this would be a nice feature. Thanks!