Re: [問題]Camera Preview 上加 ImageView
※ 引述《sheep922420 ()》之銘言:
: 如題
: 小弟目前在一個 FrameLayout 上
: 加了一個 surfaceView
: 並利用 Camera 在 surfaceView 全螢幕預覽
: 並且要在預覽畫面加上一個可任意移動的圖片(ImageView) 而且可以縮放
: 問題1 : 目前已經在畫面加好 ImageView 了
: 可是 ImageView 只能在預覽畫面上 "一小塊正方形區域" 做移動縮放
: 和目的 "可在預覽畫面上任意移動" 還差一大段距離
: 請問是該對 ImageView FrameLaout 或是 surfaceView 做參數設定?
: 或是有哪些關鍵字可以給小弟參考呢?
: 感謝板上高手!!! 謝謝!!
小弟在預覽畫面上的圖片(ImageView) 和預覽畫面(surfaceview)做合成
可是在取出 已經移動和放大的 ImageView 內圖片資料 轉成 Bitmap的時候後一直會會發
生 Out Of Memory
處理照片合成的code如下
//===========================================================================
// JPEG CALLBACK函數內處理照片row data
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
Bitmap bm = BitmapFactory.decodeByteArray(_data, 0, _data.length,options);
//取得 已經移動和放大的 ImageView 內圖片資料 轉成 Bitmap
PicImageView.setDrawingCacheEnabled(true); <===========由logcat知道一直發
生 OOM 的點
Bitmap overlay = PicImageView.getDrawingCache(true);
File myCaptureFile = new File(strCaptureFilePath);
//把兩個bitmap 畫在同一個cave上
Bitmap bmOverlay = Bitmap.createBitmap(bm.getWidth(),
bm.getHeight(),
bm.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bottom, new Matrix(), null);
canvas.drawBitmap(overlay, 0, 0, null);
//存到我要的路徑
File myCaptureFile = new File(strCaptureFilePath);
BufferedOutputStream bos = new BufferedOutputStream(new
FileOutputStream(myCaptureFile));
bmOverlay.compress(Bitmap.CompressFormat.JPEG, 100, bos);
bos.flush();
bos.close();
//=============================================================================
找了許多網路資料
但是還是只bitmap很耗記憶體
想請問板上高手
我該從哪一點切入去修改??
感謝各位大大!!! >"<
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.34.228.96
推
02/26 23:13, , 1F
02/26 23:13, 1F
→
02/26 23:15, , 2F
02/26 23:15, 2F
→
02/26 23:15, , 3F
02/26 23:15, 3F
→
02/26 23:15, , 4F
02/26 23:15, 4F
→
02/26 23:16, , 5F
02/26 23:16, 5F
→
02/26 23:17, , 6F
02/26 23:17, 6F
→
02/26 23:17, , 7F
02/26 23:17, 7F
→
02/26 23:18, , 8F
02/26 23:18, 8F
→
02/26 23:18, , 9F
02/26 23:18, 9F
→
02/26 23:19, , 10F
02/26 23:19, 10F
→
02/26 23:19, , 11F
02/26 23:19, 11F
→
02/26 23:21, , 12F
02/26 23:21, 12F
→
02/26 23:21, , 13F
02/26 23:21, 13F
→
02/26 23:21, , 14F
02/26 23:21, 14F
→
02/26 23:22, , 15F
02/26 23:22, 15F
→
02/26 23:23, , 16F
02/26 23:23, 16F
→
02/26 23:23, , 17F
02/26 23:23, 17F
→
02/26 23:23, , 18F
02/26 23:23, 18F
→
02/26 23:24, , 19F
02/26 23:24, 19F
→
02/26 23:24, , 20F
02/26 23:24, 20F
→
02/26 23:24, , 21F
02/26 23:24, 21F
→
02/26 23:24, , 22F
02/26 23:24, 22F
→
02/26 23:25, , 23F
02/26 23:25, 23F
→
02/26 23:25, , 24F
02/26 23:25, 24F
→
02/26 23:27, , 25F
02/26 23:27, 25F
→
02/26 23:29, , 26F
02/26 23:29, 26F
→
02/26 23:29, , 27F
02/26 23:29, 27F
→
02/26 23:29, , 28F
02/26 23:29, 28F
→
02/26 23:32, , 29F
02/26 23:32, 29F
→
02/26 23:33, , 30F
02/26 23:33, 30F
→
02/26 23:34, , 31F
02/26 23:34, 31F
→
02/26 23:36, , 32F
02/26 23:36, 32F
→
02/26 23:36, , 33F
02/26 23:36, 33F
→
02/26 23:37, , 34F
02/26 23:37, 34F
推
02/26 23:39, , 35F
02/26 23:39, 35F
→
02/26 23:39, , 36F
02/26 23:39, 36F
→
02/26 23:39, , 37F
02/26 23:39, 37F
→
02/26 23:40, , 38F
02/26 23:40, 38F
→
02/26 23:40, , 39F
02/26 23:40, 39F
→
02/26 23:41, , 40F
02/26 23:41, 40F
→
02/26 23:41, , 41F
02/26 23:41, 41F
→
02/26 23:41, , 42F
02/26 23:41, 42F
→
02/26 23:42, , 43F
02/26 23:42, 43F
→
02/26 23:42, , 44F
02/26 23:42, 44F
→
02/27 00:07, , 45F
02/27 00:07, 45F
→
02/27 00:08, , 46F
02/27 00:08, 46F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):