Getting the content of an NSView in an NSImage in OSX15 sequoia

as all the nice system services that were CGWindowListCreateImage, lockFocus are now deprecated, and drastic restictions are imposed to CALayer/renderInContext:, i just cant figure out how to design a single generic obj C method to capture the content of an NSView , whatever this view is ( subclassed or not, layer backed of not ). As simple as that. this was the method, which now no longer works : //============================================================================= +(NSImage*) viewImageShot:(NSView*)view :(BOOL)bFlip //============================================================================= // capture an NSImage of the given view content // pass window.contentView to capture the whole window,cropping the title bar { CGFloat wantedLayer = view.wantsLayer; BOOL wasHidden= view.hidden; view.hidden= NO; view.wantsLayer= YES; NSImage *requiredImage = [[NSImage alloc] initWithSize:view.bounds.size]; [requiredImage lockFocus]; CGContextRef context= [[NSGraphicsContext currentContext] CGContext]; if(bFlip) FlipContext(context, view.bounds.size.height); [view.layer renderInContext:context]; [requiredImage unlockFocus]; view.wantsLayer = wantedLayer; view.hidden = wasHidden; return requiredImage; }

Is there here some hope to get some help or direction to acheive this goal ? thanks to those whow will answer.

Answered by DTS Engineer in 838190022

It's true these routines are deprecated, but you are still able to use them. What kinds of problems are you having with using these routines as they are? Let's talk about that.

If this deprecation will result in missing functionality that your app depends on, please file an enhancement request using the Feedback Assistant. This doesn't guarantee Apple will provide the requested features, but it's a good way of getting your ideas in front of the folks who make decisions about that sort of thing. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

It's true these routines are deprecated, but you are still able to use them. What kinds of problems are you having with using these routines as they are? Let's talk about that.

If this deprecation will result in missing functionality that your app depends on, please file an enhancement request using the Feedback Assistant. This doesn't guarantee Apple will provide the requested features, but it's a good way of getting your ideas in front of the folks who make decisions about that sort of thing. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Getting the content of an NSView in an NSImage in OSX15 sequoia
 
 
Q