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

加入书签 本章报错

Android多媒体开发高级编程强烈推荐:

importandroidvie9display;

finalstati9tcນAmerA_result=0่;

B๦itmapbmp=Bitmaທpfactorydecodefileimaທgefilepath,bmpfa9๗s;

下面的代码片段演示ิ了如何使用显示维度来确定在加载图像时应该生的减采样量。当使用这些方แ法时,应确保该图像尽可能多地填充显示范围。但如果该图像只是要在任何一个维度中显示10่0个像素,那ว么应该使用这个值而不是显示维度,可以通过如下方式获得该值。

从附加值中ณ获取返回的图像

intenti=ne9๗intent"androidmediaທaທ9imAge_cນApture";๙

startActivityi;

intdh=9tdisplaygetheight;๙

加载图像的尺寸而不是图像本身

Bitmaທpfa9sbmpfa9๗e9apfactory

options;

bmpfaທ9ustde9ds=true;๙

B๦itmapbmp=๡Bitmapfacນtorydecodefileimagefilepath,

bmpfa9๗s;

intheightratio=intmaທth9s6米6花6๔在6线6书6๔库6bkmihuaທ

outheightfloatdh;

int9idthratio=intmath9s

out9idthfloat9;๙

logv"heightrAtio",ไ""ิ+ใheightraທtio;

logv"9idthrAtio","ิ"+9idthratio;๙

如果两个比率都大于1้,

那么图像的一条边将大于屏幕

ifheightratio1&&9idthraທtio1้

↑返回顶部↑

书页/目录

Android多媒体开发高级编程