正文

圖像合成(7)

Android多媒體開發(fā)高級(jí)編程 作者:(美)艾佛瑞


Log.v("HEIGHTRATIO",""+heightRatio);

               Log.v("WIDTHRATIO",""+widthRatio);

 

               //如果兩個(gè)比率都大于1,那么圖像的一條邊會(huì)大于屏幕

               if (heightRatio > 1 && widthRatio > 1){

                    if (heightRatio > widthRatio){

                         //若高度比率更大,則根據(jù)它縮放

                         bmpFactoryOptions.inSampleSize = heightRatio;

                    }

                    else{

                         //若寬度比率更大,則根據(jù)它縮放

                         bmpFactoryOptions.inSampleSize = widthRatio;

                    }

               }

 

               // 對(duì)它進(jìn)行真正的解碼

               bmpFactoryOptions.inJustDecodeBounds = false;

               returnBmp = BitmapFactory.decodeStream(getContentResolver().

               openInputStream(imageFileUri), null, bmpFactoryOptions);

          } catch (FileNotFoundException e) {

               Log.v("ERROR",e.toString());

          }

 

          return returnBmp;

     }

}

 


上一章目錄下一章

Copyright ? 讀書網(wǎng) ranfinancial.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號(hào) 鄂公網(wǎng)安備 42010302001612號(hào)