|
@@ -104,16 +104,6 @@ public class ViewShot implements UIBlock {
|
104
|
104
|
}
|
105
|
105
|
}
|
106
|
106
|
|
107
|
|
- public static Bitmap loadBitmapFromView(View v)
|
108
|
|
- {
|
109
|
|
- Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
|
110
|
|
-
|
111
|
|
- Canvas c = new Canvas(b);
|
112
|
|
- v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
|
113
|
|
- v.draw(c);
|
114
|
|
- return b;
|
115
|
|
- }
|
116
|
|
-
|
117
|
107
|
/**
|
118
|
108
|
* Screenshot a view and return the captured bitmap.
|
119
|
109
|
* @param view the view to capture
|
|
@@ -125,12 +115,6 @@ public class ViewShot implements UIBlock {
|
125
|
115
|
if (w <= 0 || h <= 0) {
|
126
|
116
|
throw new RuntimeException("Impossible to snapshot the view: view is invalid");
|
127
|
117
|
}
|
128
|
|
- /*
|
129
|
|
- if (!view.isDrawingCacheEnabled())
|
130
|
|
- view.setDrawingCacheEnabled(true);
|
131
|
|
-
|
132
|
|
- Bitmap bitmap = view.getDrawingCache();
|
133
|
|
- */
|
134
|
118
|
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
135
|
119
|
Canvas c = new Canvas(bitmap);
|
136
|
120
|
view.layout(0, 0, view.getLayoutParams().width, view.getLayoutParams().height);
|
|
@@ -143,6 +127,5 @@ public class ViewShot implements UIBlock {
|
143
|
127
|
throw new RuntimeException("Impossible to snapshot the view");
|
144
|
128
|
}
|
145
|
129
|
bitmap.compress(format, (int)(100.0 * quality), os);
|
146
|
|
- //view.setDrawingCacheEnabled(false);
|
147
|
130
|
}
|
148
|
131
|
}
|