NSImage's drawingHandler and retina screens -


I understand that to use the following snippet to create images and to assign the contents of the layer of the view , The render block is executed automatically, then when the backing properties of the view were changed, i.e. the window was moved to or from the retina display.

  [Size with NSI image image: Size is flipped: No drawing handler: ^ BOOL (NSRKR) {CGContextRef const context = NSGraphicsContext.currentContext.graphicsPort; .... back yes; }];   

Inside this rendering block, I am trying for another NSIMage center standing. I want to focus it on focusing on the high resolution display, but non-retina does not want to fade on the screen. So I would like to know what is the way to know whether the image is being presented with content scalefactor.

It should really be straightforward, but I did not find even after the internet efforts and hours of searching to find out if the image is being provided for retina screen or not.

From:

CGContextRef

The preferred way of obtaining scaling information for the CGContext object is to call the conversion function:

  deviceRect = CGContextConvertRectToDeviceSpace (reference, userArt);   

Then you can divide userRect.size.height by deviceRect.size.height . It works for implicitly scaled window references and clearly small bitmap references.

I do not really think you should count on the scale, though. I think converting the device space from your user space to your Drawing handler and an arbitrary root ( NSZeroPoint ), in a rescript created in both the rect parameters With the size and size of the image you are trying to center, adjust the origin of the latter mathematically to adjust it in the device space in the past. Using the result to integrate the result Then, convert it back to the user space. Drag the image into resultant texture.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -