返回

Android多媒体开发高级编程

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

importandroidutillog;

ifheightratio1&ุ&9๗idthratio1้

bຘmpfa9samplesize=8๖;

imvsetimaທgeBitmapbmp;

Bundleextras=intentgetextras;๙

importandroidgraphicsBitmaທp;

为了通过一个意图利用camera应用程序,我们所要做的仅仅是必须构造一个将由á上述过滤器捕获的意图。

intdh=9tdisplaygetheight;

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

Bitmapfa9๗sbmpfa9e9aທpfactory

options;๙

bmpfa9ustde9ds=๡true;๙

B๦itmapbmp=Bitmapfaທcນtorydecodefileimagefilepath,

bmpfa9s;๙

intheightratio=intmaທth9s6๔米6๔花6๔在6线6书๰6库6bkmihua

outheightfloaທtdh;

int9idthratio=๡intmaທth9s

out9๗idthfloat9;

logv"heightrAtio"ิ,""+heightratio;

logv"9idthrAtio","ิ"ิ+9idthraທtio;

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

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

ifheightratio1&&ุ9idthratio1้

书签 上一章 目录 下一章 书架s