1. Bitmap bitmap = BitmapFactory.decodeResource(res, id);
2. InputStream is = context.getResources().openRawResource(R.drawable.app_sample_code); Bitmap bitmap = BitmapFactory.decodeStream(is);
//得到一个Bitmap的截图(感觉相当于一个原图像的模型):
bitmap.extractAlpha();
3. //设置画笔的遮罩效果
p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
4. //设置画刷的效果
mShader = new LinearGradient(0, 0, 100, 70, new int[] {
Color.RED, Color.GREEN, Color.BLUE },
null, Shader.TileMode.MIRROR);
5. //通过图片取得图片的Drawable
Drawable dr = context.getResources().getDrawable(R.drawable.beach);