Last active
September 3, 2015 19:54
-
-
Save mr5z/8cc04329c6fc84759130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private float[] mSegmentCoords = { | |
103, 56, | |
96, 103, | |
93, 121, | |
86, 170, | |
78, 177, | |
24, 177, | |
17, 170, | |
24, 121, | |
26, 103, | |
34, 56, | |
44, 47, | |
95, 47, | |
35, 112, | |
85, 112, | |
111, 177, | |
101, 177 | |
}; | |
... | |
private void scaleMatrix(int screenWidth, int screenHeight) { | |
// Title bar height | |
int shift = 100; | |
int maxWidth = 800; | |
int maxHeight = 1280 - shift; | |
int height = screenHeight - ((shift * screenHeight) / maxHeight); | |
float xDpi = getResources().getDisplayMetrics().xdpi; | |
float yDpi = getResources().getDisplayMetrics().xdpi; | |
float density = getResources().getDisplayMetrics().density; | |
for(int i = 0;i < mSegmentOffsetX.length; ++i) { | |
mSegmentOffsetX[i] = (mSegmentOffsetX[i] * screenWidth * density) / maxWidth; | |
} | |
for(int i = 0;i < mSegmentCoords.length; i += 4) { | |
mSegmentCoords[i + 0] = (mSegmentCoords[i + 0] * screenWidth * density) / maxWidth; | |
mSegmentCoords[i + 1] = ((mSegmentCoords[i + 1] * height * density) / maxHeight); | |
mSegmentCoords[i + 2] = (mSegmentCoords[i + 2] * screenWidth * density) / maxWidth; | |
mSegmentCoords[i + 3] = ((mSegmentCoords[i + 3] * height * density) / maxHeight); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment