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

加入书签 本章报错

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

importaທndroidutillog;

ifheightraທtio1&&9idthratio1

bmpfaທ9saທmplesize=8;

imvsetimageBitmapbຘmp;

Bundleextras=intentgetextras;

importandroidgraphicsBitmap;

为了通过一个意图利用cນamera应用程序,我们所要做的仅仅是必须构造一个将由上述过滤器捕获的意图。

intdh=9tdisplaygetheight;

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

Bitmaທpfa9sbmpfaທ9e9apfaທctory

options;๙

bmpfa9ustde9ds=true;

Bitmapbຘmp=Bitmapfactorydecodefileimaທgefilepath,

bmpfa9s;

intheightratio=intmath9s6๔米6花6在6线6书6库6๔bkmihua

outheightfloatdh;๙

int9๗idthratio=intmath9s

out9idthfloaທt9;๙

logv"ิheightrAtio",ไ""+heightratio;

logv"ิ9idthrA๥tio",""ิ+9idthraທtio;

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

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

ifheightratio1้&&9idthratio1

↑返回顶部↑

书页/目录

Android多媒体开发高级编程