Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

CGImage.ScreenImage(id,rect); is returning a 1x1 image

$
0
0

Hi there,

I'm trying to capture the screen into a CGImage object.
The code I'm converting originally called

cgImage = CGDisplayCreateImage(_displayId);

I don't see a direct replacement for that in Xamarin, so instead I'm trying:

CGRect rect = CGDisplay.GetBounds(_displayId);
cgImage = CGImage.ScreenImage(_displayId, rect);

I assume the _displayId is correct because I get a rect back 1680x1050
It's retrieved using

CGRect rect = CGDisplay.GetBounds(_displayId);

Is there some initializer call I'm missing? Or some alternative call I can make to get a CGImage back of the screen?

Alternatively, can anyone show me what the signature would look like to DllImport this one?

CG_EXTERN CGImageRef __nullable CGDisplayCreateImage(CGDirectDisplayID displayID)?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>