Back to project page misty.
The source code is released under:
MIT License
If you think the Android project misty listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.misty.graphics; //from www . j av a 2 s.c om public class ScreenResolution { public int horizontal = 0; public int vertical = 0; public ScreenResolution(int horizontal, int vertical) { this.horizontal = horizontal; this.vertical = vertical; } public static ScreenResolution fromHorizontal(int horizontal) { return new ScreenResolution(horizontal, 0); } public static ScreenResolution fromVertical(int vertical) { return new ScreenResolution(0, vertical); } public void normalize(int width, int height) { float ratio = (float)width / (float)height; if (this.horizontal == 0) { this.horizontal = (int)(this.vertical * ratio); } else if (this.vertical == 0) { this.vertical = (int)(this.horizontal / ratio); } } }