0
J'ai besoin d'une capture de fenêtre mobile. Parce que la fenêtre se déplace que je veux capturer dans le thread principal:l'envoi de CGImageRef en tant que paramètre de sortie
void MacRenderer::captureImageImpl(const CGRect& captureRect, const CGWindowID windowId, CGImageRef* img)
{
*img = CGWindowListCreateImage(captureRect, kCGWindowListOptionIncludingWindow, windowId, kCGWindowImageBoundsIgnoreFraming); //EXC_BAD_ACCESS
}
void MacRenderer::captureWindow(CGWindowID windowId, unsigned char** bgraData, int* width, int* height, int* bytesPerRow, NSRect captureRect)
{
CGImageRef* windowImage;
dispatch_sync(dispatch_get_main_queue(), ^{
captureImageImpl(captureCGRect, windowId, windowImage);
});
//Use windowImage ...
}
Je reçois EXC_BAD_ACCESS
sur l'adresse de img
. Pourquoi et quelle est la solution? Merci!