I'm using the oMsg() functions to send Cocoa messages and I found this code to determine the screen DPI. I'm on PB 5.0 for this, so I cant use CocoaMessage...
Two questions:
(1) Can somebody help me to translate this for PB:
This is where I stuck:NSScreen *screen = [NSScreen mainScreen];
NSDictionary *description = [screen deviceDescription];
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
CGSize displayPhysicalSize = CGDisplayScreenSize(
[[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
NSLog(@"DPI is %0.2f",
(displayPixelSize.width / displayPhysicalSize.width) * 25.4f);
Code: Select all
Define screen.i = oMsg(0, 0, "NSScreen mainScreen")
Debug screen.i
Define description.i = oMsg(0, screen.i, "deviceDescription")
Debug description.i
Define objDisplayPixelSize.i = oMsg(0, description.i, "objectForKey:$", @"NSDeviceSize")
Debug objDisplayPixelSize.i
; How to get sizeValue now???
Best,
Kukulkan