登录
首页 » Android » Android 使用Matrix.postRotate方法旋转图片

Android 使用Matrix.postRotate方法旋转图片

于 2022-03-14 发布 文件大小:32.93 kB
0 191
下载积分: 2 下载次数: 1

代码说明:

Android图像操作一例,使用Matrix.postRotate方法旋转图片,这些的图片格式是BMP,其它格式可能也能用吧,没测试,旋转BMP图片的效果如截图所示,用户单击向左或向右按钮后,图片旋转90度,旋转角度根据自己需要自定义。旋转方法主要是使用Matrix.postRotate,旋转的过程保持图片原有的比例,实现思路,以向左旋转图片为例:   程序刚运行,加载默认的Drawable ,设置维持的图像比例,ScaleTimes=1,维持1:1的宽高比例,使用Matrix.postScale设置维度 ,使用Matrix.postRotate方法旋转Bitmap,然后再创建新的Bitmap对象。   向右旋转则与此相似,具体实现请下载源码包。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android 通讯录应用 设计源码下载(含设计文档),毕业设计可参考
    android 通讯录应用 设计源码下载(含设计文档),毕业设计可参考
    2014-06-26下载
    积分:1
  • Android 仿抖音APP下拉刷新功能
    Android 仿抖音APP下拉刷新功能,首先分析这个效果的实现思路,大致如下:   1、上拉时页面有翻页效果,可以用scrollview的pagingEnabled来实现,也就是说列表页不管你用tableview还是collectionview,只要每个cell是全屏的就可以。   2、下拉:当页面不是停留在第一个cell时,下拉就只是scrollView的滚动效果,不会触发刷新,当页面停留在第一个cell,也就是说scrollView.contentOffset.y = 0的时候,手指下拉才会触发刷新效果,并且下拉时scrollView不动,也就是没有scrollview的弹性效果,因此scrollView.bounces = NO。   3、既然下拉时scrollView不动,就不能使用代理来监听scrollView的滑动实现刷新,于是我想到了用touches的系列方法来监控手指下滑位移。   4、动画分解有五步:   (1)下拉时“推荐、附近”的那个导航条和“下拉刷新内容”的视图有渐隐渐显的效果,位置也随着手指下移,可以通过手指下滑位移计算alpha来实现   (2)下拉时,“下拉刷新内容”的视图右边那个有缺口的小圆环会随着手指滑动转圈,下滑时逆时针旋转   (3)下滑一定距离后如果不松手,又继续上滑,会执行前两步的反效果,圆环顺时针旋转,手指停在屏幕上,圆环就停止转动   (4)下滑到某个临界点,导航条和刷新视图都不再移动(此时导航条已经完全透明),所以可以通过计算起始点和当前点移动距离来计算透明度、位移、旋转角度,这些操作都在touchesMoved中实现   (5)到临界点松手后,导航条和刷新视图都回到原始位置,小圆环一直顺时针转圈,直到刷新结束,停止动画,隐藏刷新视图,显示导航条,如果没达到临界点就松手,不会触发刷新。。
    2022-11-22 22:45:03下载
    积分:1
  • 2015嵌入式小车实例
    【实例简介】
    2021-11-06 00:37:29下载
    积分:1
  • link
    说明:  android手机系统的游戏连连看,游戏的基本功能已经实现(the game of the android system picture matching )
    2011-04-02 00:01:50下载
    积分:1
  • android 异步 执行 任务 例子 附讲解
    Rules::The AsyncTask instance must be created in UI thread. .execute must be invoked on the UI thread.Never call  objMyTask.onPreExecute(), objMyTask.doInBackground(), objMyTask.onProgressUpdate(),  objMyTask.onPostExecute manually.The AsyncTask can be executed only once (an exception will be thrown if a second execution is attempted.)AsyncTask have Four Main Method... onPreExecute()  doInBackground() onProgressUpdate() onPostExecute()  onPreExecute-This method is called first when you start AsyncTask using objAsync.execute().And mostly this method is use for initializing dialog(ProgressDialog,CustomDialog) and showing. doInBackground-The main purpose of AsyncTask is accomplished by this method.Any non-UI thread process is running in this method.Such as Rss Feed Reader,Image and video Uploading and Downloading.You cant handle your View in this method.Because this method is non-UI thread.While any background process is running if you want to handle UI therea are  onProgressUpdate method. after completion of process this method send result to OnPostExecute. onProgressUpdate-While backgrounding task is running ,you can handle your UI using this method .Such as status of downloading or uploading task.and this method is called from  doInBackground.Using publishProgress() you can call onProgressUpdate method to update UI while process is running. onPostExecute -This method is called after the background computation finishes.The result of background process in passed in this method as parameters.And now you can dismiss progress dialog ,to indicate that background task is completed. You can cancel AsyncTask using objAsyncTask.cancel().then you just check in doInBackground, if (isCancelled()) { break; } else {        //continue... } See this Image For more Clear.
    2013-07-05下载
    积分:1
  • beg-android-4-master
    Source code for the book Beginning Android 4 Authors: Authors: Murphy, Mark, Allen, Grant
    2019-06-12 04:07:20下载
    积分:1
  • acaro
    game caro android run in platform Java
    2012-04-16 23:59:00下载
    积分:1
  • android fiip特效
    android fiip特效
    2013-12-22下载
    积分:1
  • android仿来电滑动接听或挂断界面
    android仿来电滑动接听或挂断界面,自己写的代码,已经测试过了可以正常使用。
    2022-12-09 08:10:03下载
    积分:1
  • iVideoChat视频录制发布到red5服务器
    在网上的一个开源项目 只有客户端代码,采用rtmp协议,服务器可以采用red5测试。 代码具有参考价值,使用方法,提取videoActivity相关内容,修改rtmp地址,可以设置发布方式为record还是live方式。服务器采用red5的OFLA Demo进行测试
    2023-04-20 01:50:04下载
    积分:1
  • 696516资源总数
  • 106648会员总数
  • 8今日下载