high-resolution

Detecting HiDPI Windows Phone 8 Devices

你。 提交于 2019-11-29 02:56:34
问题 How do I detect HiDPI devices running Windows Phone 8? The phone I'm testing is the Nokia Lumia 920, which has a 4.5-inch 1280 × 768 screen (i.e. > 300 dpi). IE supports min-resolution in CSS but not min-device-pixel-ratio . Using this device pixel density test, the Lumia reports 96 dpi . This is far lower than the actual screen resolution, and would be considered a regular non-HiDPI device. Since IE doesn't (yet) support window.devicePixelRatio in JavaScript, I can't find a way to accurately

Microsecond accurate (or better) process timing in Linux

安稳与你 提交于 2019-11-28 20:45:51
I need a very accurate way to time parts of my program. I could use the regular high-resolution clock for this, but that will return wallclock time, which is not what I need: I needthe time spent running only my process. I distinctly remember seeing a Linux kernel patch that would allow me to time my processes to nanosecond accuracy, except I forgot to bookmark it and I forgot the name of the patch as well :(. I remember how it works though: On every context switch, it will read out the value of a high-resolution clock, and add the delta of the last two values to the process time of the

How use CGImageCreateWithImageInRect for iPhone 4 (HD)?

拈花ヽ惹草 提交于 2019-11-28 19:30:43
I use the following code to getting images from the sprite. And it works fine everywhere except the iPhone 4 (HD version). - (UIImage *)croppedImage:(CGRect)rect { CGImageRef image = CGImageCreateWithImageInRect([self CGImage], rect); UIImage *result = [UIImage imageWithCGImage:image]; CGImageRelease(image); return result; } The iPhone 4 automatically load HD version of the image (sprite@2x.png) instead sprite.png. The original image has a scale 2, but the resulting image has a scale 1 and wrong size. How to handle this behavior taking into account the different scales for iPhone 3G[s] and the

How do I prepare images for all the Android resolutions?

馋奶兔 提交于 2019-11-28 16:47:51
问题 In iOS preparing graphics is simple. There are either a normal image (height x width) or a retina image which is @2x (2 times height x 2 times width). However, since I'm new to Android, I see a ton of drawable-* folders in Eclipse where the * can be "hdpi" or "ldpi" or "mdpi" or "xhdpi" or "xxhdpi". Can someone very clearly and simply list for me what I must do to satisfy each of the display possibilities so my images will look right in each instance? I'm envisioning an answer will be a

Microsecond accurate (or better) process timing in Linux

我们两清 提交于 2019-11-27 12:27:19
问题 I need a very accurate way to time parts of my program. I could use the regular high-resolution clock for this, but that will return wallclock time, which is not what I need: I needthe time spent running only my process. I distinctly remember seeing a Linux kernel patch that would allow me to time my processes to nanosecond accuracy, except I forgot to bookmark it and I forgot the name of the patch as well :(. I remember how it works though: On every context switch, it will read out the value

How use CGImageCreateWithImageInRect for iPhone 4 (HD)?

試著忘記壹切 提交于 2019-11-27 12:19:03
问题 I use the following code to getting images from the sprite. And it works fine everywhere except the iPhone 4 (HD version). - (UIImage *)croppedImage:(CGRect)rect { CGImageRef image = CGImageCreateWithImageInRect([self CGImage], rect); UIImage *result = [UIImage imageWithCGImage:image]; CGImageRelease(image); return result; } The iPhone 4 automatically load HD version of the image (sprite@2x.png) instead sprite.png. The original image has a scale 2, but the resulting image has a scale 1 and

High resolution timer in C#

亡梦爱人 提交于 2019-11-26 04:54:23
问题 Is there a high resolution timer that raises an event each time the timer elapses, just like the System.Timer class? I need a high resolution timer to Elapse every ms. I keep running into posts that explain that the Stopwatch can measure high resolutions, but I don\'t want to measure time, I want to create an interval of 1 ms. Is there something in .NET or am I going to write my own high res timer? 回答1: There is nothing built into the .NET framework that I am aware of. Windows has a mechanism

How to create a high resolution timer in Linux to measure program performance?

故事扮演 提交于 2019-11-26 03:38:29
问题 I\'m trying to compare GPU to CPU performance. For the NVIDIA GPU I\'ve been using the cudaEvent_t types to get a very precise timing. For the CPU I\'ve been using the following code: // Timers clock_t start, stop; float elapsedTime = 0; // Capture the start time start = clock(); // Do something here ....... // Capture the stop time stop = clock(); // Retrieve time elapsed in milliseconds elapsedTime = (float)(stop - start) / (float)CLOCKS_PER_SEC * 1000.0f; Apparently, that piece of code is