sclass ScreenCamStream { volatile Rect area = screenBounds(0); DoneFlag ended = new(true); volatile BufferedImage lastFrame; new AtomicLong frameCount; public bool step() { if (ended.isDone()) false; catchError(ended, lambda0 shootImpl); true; } BufferedImage get() { ret lastFrame; } long frameCount() { ret frameCount!; } void shootImpl { lastFrame = shootScreen2(area); inc(frameCount); } void useScreen(int iScreen) { area = screenBounds_safe(iScreen); } void end { ended.raise(); } }