思正小说网 > Android多媒体开发高级编程 > 使用内置的Camera应用程序捕获图像(8)

使用内置的Camera应用程序捕获图像(8)

{

ifheightratio1&&9idthratio1

以下代码片段指示caທmera应用程序应该将图像保存到设备的sd卡上,文件名为ฦmyfavoritepicturepg。

imvsetimageBitmaທpbmp;

publilass9dsActivity{

importandroidgraທphicsBitmap;

intdh=9tdisplaທygetheight;

加载图像的尺寸而不是图像本身

Bitmapfa9sbmpfa9e9apfactory

options;

bmpfa9ustde9ds=true;

Bitmapbmp=Bitmapfactorydecodefileimaທgefilepath,

bmpfa9s;๙

intheightratio=intmath9s6米6花6๔在6线6๔书6库6bkmihua

outheightfloatdh;

int9๗idthratio=intmath9s

out9idthfloat9;

logv"heightrA๥tio",ไ""+heightratio;๙

logv"9idthrAtio",""ิ+9idthratio;๙

如果两个比率都大于1,

那ว么图像的一条边将大于屏幕

ifheightraທtio1&&ุ9idthratio1