Inline -- David Duncan @ My iPhone
> On Dec 22, 2016, at 4:49 PM, Alex Zavatone <z...@mac.com> wrote: > > In that case, would it make sense when the app will enter background, to take > a snapshot of the main window, then put that image layer over your main > window so that you can guarantee that the image you desire is what the OS > will take a snapshot of? In this case the desired image is whatever was last displayed if I understand Andreas correctly. So the real question is what prevents that from displaying. > > I like this approach because it is very easy to QA. You can output the image > to a known file and you can see exactly what image should be captured by the > OS. > > Then when the app will enter foreground, set the hidden of that layer to YES > and void the contents. > > Even if you don't use this approach, it may be helpful in seeing why the OS > is taking a lovely black image instead of the one you desire. You could even > create a new window that holds this image and which is only displayed when > the app is about to enter the background and is dismissed when i comes back. > > Andreas, I am suspecting that the custom CGImage code might be causing this > by getting in the way of what the OS expects. What format does the OS > require before taking the screenshot? Unlikely. If you can see it onscreen, the OS can capture it. It has more privileges than you do :). The technique Andreas is using is basically the same one UIImageView uses so it should be petty robust. > Maybe making sure that the OS can access your custom view's image content in > the format it expects is what would fix this. (I'm expecting you're on iOS), > can you make a UIimage from your window's top level view that is a > viewController and put it in a UIImageView using imageWithCGImage? If you > can, is it black? The CGImage is the underlying Quartz image data, not an > image to itself. Also, what about the context, is it in the middle of > drawing? Is there a way to access the CGImageRef of what you're drawing? > > CGImageRef cgImage = CGBitmapContextCreateImage(context); > > Apologies if I'm rambling. I'm tragically low on coffee. > > Cheers, > - Alex Zavatone > >> On Dec 22, 2016, at 2:58 PM, David Duncan wrote: >> >> Do you do anything special when going into the background? The snapshot is >> taken shortly after your application is placed in the background, so if your >> view hierarchy changes that is what will actually be snapshotted. >> >>> On Dec 22, 2016, at 4:05 AM, Andreas Falkenhahn <andr...@falkenhahn.com> >>> wrote: >>> >>> When opening the recent apps list by pressing the home button twice >>> my app only shows a black screen instead of an image of the app's >>> look the last time it was closed. How can I fix this? >>> >>> My app's view hierarchy is Window => ViewController.View => ContentView. >>> The graphics are drawn by a platform-independent renderer into a >>> pixel buffer which is then converted into CGImage which is then >>> set as the content view's layer for every new frame like this: >>> >>> contentView.layer.contents = (id) myImage; >>> >>> This works fine but in the recent apps list my app is always just >>> shown as a black screen which is rather ugly. How can I fix this >>> please? >>> >>> -- >>> Best regards, >>> Andreas Falkenhahn mailto:andr...@falkenhahn.com >>> >>> _______________________________________________ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com >>> >>> This email sent to david.dun...@apple.com >> >> -- >> David Duncan >> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com >> >> This email sent to z...@mac.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com