Dear list, Talking about displays and their native ppi:s we've mentioned ANEs a couple of time. I've tried to research this, because I believe there are real use-cases if we could get it to work – layout elements based on the users context, not his/hers device.
I'm a FLEX developer and feel that an ANE is a bit over my head. I may be able to figure something out in java, but everything I've been able to research about it points at C. And that is a no go for me at the moment. Are there any C gurus on the list? :) If anyone, more capable than me, would be willing to explore this with me I've tried to collect some material. 1. http://en.wikipedia.org/wiki/Extended_display_identification_data 2. http://www.insanelymac.com/forum/index.php?showtopic=208410 3. http://cgit.freedesktop.org/xorg/app/edid-decode/ 4. https://github.com/claar/php-edid-decode 5. http://www.madrau.com/indexSRX4.html First. There seems to be a spec regulating information exchanged between pc:s and monitors called EDID. [1] Desktop computers stores EDID information in their registry, but in a binary format that needs to be parsed. I can find the EDID data on my mac, following the guidelines given at [2]. I don't have access to a windows machine to search for it on that OS. There is an active C project for parsing the EDID data at [3]. Not sure about licensing. There is a php port at [4] if that would help us. Not sure about licensing. On mac you can get parsed EDID-data using an application like SwitchResX. [5] And looking at the output the program can generate from my system it seems really promising. I can read that my screens physical size is 286 mm x 179 mm, and a pixel size 1280 x 800 px. This is all I need to calculate my screens correct ppi (113 px/inch). I'm enclosing the full print out below. It could serve as the foundation for the ActionScript ANE interface. I'm thinking something like a "NativeScreen" class, collecting properties like: gamma:Number timing:Number widthCm:uint heightCm:uint widthInch:uint heightInch:uint widthPixel heightPixel ppi:uint ... I'm sure there are some pain's down this road, but maybe there is a path ahed. Does this make anyone itch? Sorry for the mac-twisted research. I don't have access to windows at the moment. Yours /Erik Printout from SwitchResX: DDC block report generated by SwitchResX version 4.2.7 for display Color LCD ----------------------------------------------------- ------------------- RAW DATA ------------------------ ----------------------------------------------------- 0 1 2 3 4 5 6 7 8 9 A B C D E F ----------------------------------------------------- 0 | 00 FF FF FF FF FF FF 00 06 10 BD 9C 00 00 00 00 1 | 03 13 01 03 80 1D 12 78 0A 00 00 00 00 00 00 00 2 | 00 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01 3 | 01 01 01 01 01 01 52 1C 00 8F 50 20 2E 30 30 20 4 | 36 00 1E B3 10 00 00 18 00 00 00 01 00 06 10 20 5 | 00 00 00 00 00 00 00 00 0A 20 00 00 00 FE 00 4C 6 | 50 31 33 33 57 58 33 2D 54 4C 41 31 00 00 00 FE 7 | 00 43 6F 6C 6F 72 20 4C 43 44 0A 20 20 20 00 41 ----------------------------------------------------- < 00FFFFFF FFFFFF00 0610BD9C 00000000 03130103 801D1278 0A000000 00000000 00505400 00000101 01010101 01010101 01010101 0101521C 008F5020 2E303020 36001EB3 10000018 00000001 00061020 00000000 00000000 0A200000 00FE004C 50313333 5758332D 544C4131 000000FE 00436F6C 6F72204C 43440A20 20200041 > ----------------------------------------------------- { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x06, 0x10, 0xBD, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x03, 0x13, 0x01, 0x03, 0x80, 0x1D, 0x12, 0x78, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x54, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x52, 0x1C, 0x00, 0x8F, 0x50, 0x20, 0x2E, 0x30, 0x30, 0x20, 0x36, 0x00, 0x1E, 0xB3, 0x10, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x20, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x4C, 0x50, 0x31, 0x33, 0x33, 0x57, 0x58, 0x33, 0x2D, 0x54, 0x4C, 0x41, 0x31, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x43, 0x6F, 0x6C, 0x6F, 0x72, 0x20, 0x4C, 0x43, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x00, 0x41, } ----------------------------------------------------- Valid EDID block: checksum passed ----------------------------------------------------- ------------------- MAIN EDID BLOCK ----------------- ----------------------------------------------------- EDID Version........1.3 Manufacturer........APP Product Code........48540 (BD9C) (9CBD) Serial Number.......00000000 Manufactured........Week 3 of year 2009 Max H Size..........29 cm Max V Size..........18 cm Gamma...............2,20 Display Supported Features: --------------------------- Display type: ------------- RGB 4:4:4 & YCrCb 4:4:4 Color Encoding Formats Display is non continuous frequency Default color space is not sRGB standard Preferred timing mode includes Native Pixel Format Input signal & sync: -------------------- Digital Input Color Bit Depth is undefined Digital Interface is not defined Color info: ----------- Red x = 0,000 Green x = 0,000 Blue x = 0,000 White x = 0,312 Red y = 0,000 Green y = 0,000 Blue y = 0,000 White y = 0,328 Established Timings: -------------------- Manufacturer Reserved Timings: ------------------------------ Standard Timing Identification: ------------------------------- Monitor Description blocks: --------------------------- Descriptor #0 - Timing definition: Mode = 1280 x 800 @ 60,223Hz Pixel Clock............. 72,50 MHz Non-Interlaced Horizontal Vertical Active.................. 1280 pixels 800 lines Front Porch............. 48 pixels 3 lines Sync Width.............. 32 pixels 6 lines Back Porch.............. 63 pixels 37 lines Blanking................ 143 pixels 46 lines Total................... 1423 pixels 846 lines Scan Rate............... 50,949 kHz 60,223 Hz Image Size.............. 286 mm 179 mm Border.................. 0 pixels 0 lines Sync: Digital separate with * Negative vertical polarity * Negative horizontal polarity Descriptor #1 - Manufacturer specific data (not interpreted here) Descriptor #2 - ASCII data: LP133WX3-TLA1 Descriptor #3 - ASCII data: Color LCD