I'm using the following API.
_displayStream = CGDisplayStreamCreateWithDispatchQueue(
_selectedDisplayId, _selectedDisplaySize.width, _selectedDisplaySize.height,'BGRA', nil, _screenCaptureQueue,
^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef)
when the callback returns, I get the co-ordinates of the updated rects. How do I directly extract those rects as CGImage directly from the IOSurface object which is the full screenshot. Without converting the IOSurface itself to CGImage.