多媒体编程

 

 

 


   加载大图片代码:

public void click(View v){
     //解析图片时需要使用到的参数都封装在这个对象里了
     Options opt = new Options();
     //不为像素申请内存,只获取图片宽高
     opt.inJustDecodeBounds = true;
     BitmapFactory.decodeFile("sdcard/dog.jpg", opt);
     //拿到图片宽高
     int imageWidth = opt.outWidth;
     int imageHeight = opt.outHeight;
     
     Display dp = getWindowManager().getDefaultDisplay();
     //拿到屏幕宽高
  int screenWidth = dp.getWidth();
     int screenHeight = dp.getHeight();
     
     //计算缩放比例
     int scale = 1;
     int scaleWidth = imageWidth / screenWidth;
     int scaleHeight = imageHeight / screenHeight;
     if(scaleWidth >= scaleHeight && scaleWidth >= 1){
      scale = scaleWidth;
     }
     else if(scaleWidth < scaleHeight && scaleHeight >= 1){
      scale = scaleHeight;
     }
     
     //设置缩放比例
     opt.inSampleSize = scale;
     opt.inJustDecodeBounds = false;
     Bitmap bm = BitmapFactory.decodeFile("sdcard/dog.jpg", opt);
     
     ImageView iv = (ImageView) findViewById(R.id.iv);
     iv.setImageBitmap(bm);
    }

 

 

创建图片副本

 

 

图片的简单特效

Matrix详解:http://blog.csdn.net/flash129/article/details/8234599

 

播放视频的第三方组件:Vitamio 、百度媒体云(http://developer.baidu.com/wiki/index.php?title=docs/cplat/media/video/console);

 

 

播放网络音乐

 

创建图片副本

 

posted on 2015-12-21 23:20  dmz1024  阅读(224)  评论(0)    收藏  举报