ImageUtils.java
3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package net.hockeyapp.android.utils;
import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.net.Uri;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class ImageUtils
{
public static final int ORIENTATION_LANDSCAPE = 1;
public static final int ORIENTATION_PORTRAIT = 0;
private static int a(BitmapFactory.Options paramOptions, int paramInt1, int paramInt2)
{
int k = paramOptions.outHeight;
int m = paramOptions.outWidth;
int j = 1;
int i = 1;
if ((k > paramInt2) || (m > paramInt1))
{
k /= 2;
m /= 2;
for (;;)
{
j = i;
if (k / i <= paramInt2) {
break;
}
j = i;
if (m / i <= paramInt1) {
break;
}
i *= 2;
}
}
return j;
}
public static Bitmap decodeSampledBitmap(Context paramContext, Uri paramUri, int paramInt1, int paramInt2)
throws IOException
{
BitmapFactory.Options localOptions = new BitmapFactory.Options();
localOptions.inJustDecodeBounds = true;
BitmapFactory.decodeStream(paramContext.getContentResolver().openInputStream(paramUri), null, localOptions);
localOptions.inSampleSize = a(localOptions, paramInt1, paramInt2);
localOptions.inJustDecodeBounds = false;
return BitmapFactory.decodeStream(paramContext.getContentResolver().openInputStream(paramUri), null, localOptions);
}
public static Bitmap decodeSampledBitmap(File paramFile, int paramInt1, int paramInt2)
throws IOException
{
BitmapFactory.Options localOptions = new BitmapFactory.Options();
localOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(paramFile.getAbsolutePath(), localOptions);
localOptions.inSampleSize = a(localOptions, paramInt1, paramInt2);
localOptions.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(paramFile.getAbsolutePath(), localOptions);
}
public static int determineOrientation(Context paramContext, Uri paramUri)
throws IOException
{
Context localContext = null;
try
{
paramContext = paramContext.getContentResolver().openInputStream(paramUri);
localContext = paramContext;
int i = determineOrientation(paramContext);
return i;
}
finally
{
if (localContext != null) {
localContext.close();
}
}
}
public static int determineOrientation(File paramFile)
throws IOException
{
FileInputStream localFileInputStream;
try
{
localFileInputStream = new FileInputStream(paramFile);
int i;
if (localFileInputStream == null) {
break label31;
}
}
finally
{
try
{
i = determineOrientation(localFileInputStream);
localFileInputStream.close();
return i;
}
finally {}
paramFile = finally;
localFileInputStream = null;
}
localFileInputStream.close();
label31:
throw paramFile;
}
public static int determineOrientation(InputStream paramInputStream)
{
int i = 1;
BitmapFactory.Options localOptions = new BitmapFactory.Options();
localOptions.inJustDecodeBounds = true;
BitmapFactory.decodeStream(paramInputStream, null, localOptions);
if ((localOptions.outWidth == -1) || (localOptions.outHeight == -1)) {
i = 0;
}
while (localOptions.outWidth / localOptions.outHeight > 1.0F) {
return i;
}
return 0;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/net/hockeyapp/android/utils/ImageUtils.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/