NSWindowGraphicContext?

I was wondering what is NSWindowGraphicContext and how can I access it? It seems hidden. In any case, when I follow the className code, it turns out to be NSWindowGraphicContext.

NSGraphicsContext *graphiccontext = [NSGraphicsContext currentContext];
const char* className             = class_getName([graphiccontext class]);

Same thing with CGContextRef.

Documentation says

"The window graphics context is the graphics context that you can use to draw in the window. Note that since Quartz 2D is a graphics engine and not a windowing system, you use one of the application frameworks to get the graphics context for the window."

But it does not give a title for the title or details for creating, how is this done for the context of the bitmap and the context of the PDF? I would like to know more about them.

I assume that Apple does not want to disclose this data to the user. But I need to know more.

+3
source share
1 answer

This is a private subclass used by Apple that you should not be aware of. Therefore, there is no public documentation or headings. It will be automatically created for your windows. You can get it either by accessing the current context (as in your question), or like this:

[NSGraphicsContext graphicsContextWithWindow:theWindow];

If you want to know more about the class, you can run class-dump in AppKit to get the title. Using the information from the header, you can create new contexts, but it will probably be difficult to configure them correctly, and it is better to ask the system for one.

+3
source

All Articles