Lines Matching refs:bitmap
22 import android.graphics.Bitmap;
51 private Bitmap mBitmap;
59 public Thumbnail(Uri uri, Bitmap bitmap, int orientation) {
61 mBitmap = rotateImage(bitmap, orientation);
62 if (mBitmap == null) throw new IllegalArgumentException("null bitmap");
69 public Bitmap getBitmap() {
81 private static Bitmap rotateImage(Bitmap bitmap, int orientation) {
85 m.setRotate(orientation, bitmap.getWidth() * 0.5f,
86 bitmap.getHeight() * 0.5f);
89 Bitmap rotated = Bitmap.createBitmap(bitmap, 0, 0,
90 bitmap.getWidth(), bitmap.getHeight(), m, true);
91 // If the rotated bitmap is the original bitmap, then it
93 if (rotated != bitmap) bitmap.recycle();
99 return bitmap;
102 // Stores the bitmap to the specified file.
113 mBitmap.compress(Bitmap.CompressFormat.JPEG, 90, d);
116 Log.e(TAG, "Fail to store bitmap. path=" + file.getPath(), e);
129 Bitmap bitmap = null;
139 bitmap = BitmapFactory.decodeStream(d);
142 Log.i(TAG, "Fail to load bitmap. " + e);
150 Thumbnail thumbnail = createThumbnail(uri, bitmap, 0);
160 Bitmap bitmap = null;
165 bitmap = Images.Thumbnails.getThumbnail(resolver, image.id,
169 bitmap = Video.Thumbnails.getThumbnail(resolver, video.id,
176 return createThumbnail(lastMedia.uri, bitmap, lastMedia.orientation);
252 Bitmap bitmap = BitmapFactory.decodeByteArray(jpeg, 0, jpeg.length, options);
253 return createThumbnail(uri, bitmap, orientation);
256 public static Bitmap createVideoThumbnail(FileDescriptor fd, int targetWidth) {
260 public static Bitmap createVideoThumbnail(String filePath, int targetWidth) {
264 private static Bitmap createVideoThumbnail(String filePath, FileDescriptor fd, int targetWidth) {
265 Bitmap bitmap = null;
273 bitmap = retriever.getFrameAtTime(-1);
285 if (bitmap == null) return null;
287 // Scale down the bitmap if it is bigger than we need.
288 int width = bitmap.getWidth();
289 int height = bitmap.getHeight();
294 bitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
296 return bitmap;
299 private static Thumbnail createThumbnail(Uri uri, Bitmap bitmap, int orientation) {
300 if (bitmap == null) {
301 Log.e(TAG, "Failed to create thumbnail from null bitmap");
305 return new Thumbnail(uri, bitmap, orientation);