在旋转的位图图像上投下阴影

时间:2012-02-16 03:31:24

标签: android bitmap shadow

以下是我的代码,

Paint mShadow = new Paint();
mShadow.setAntiAlias(true); 
mShadow.setShadowLayer(10, 10,10, Color.BLACK); 
canvas.save(); 
canvas.rotate((int)degrees,  100,  100);
canvas.drawBitmap(_image,200,200, mShadow);
canvas.restore();

试过这个,但阴影也会旋转 你怎么能让阴影保持同一方向?

1 个答案:

答案 0 :(得分:0)

尝试这样:

Paint mShadow = new Paint();
mShadow.setAntiAlias(true); 
mShadow.setShadowLayer(10, 10,10, Color.BLACK); 

canvas.drawRect(200, 200, 200+ (float) _image.getWidth(), 200 + (float) _image.getHeight(), mShadow);

canvas.save(); 
canvas.rotate((int)degrees,  100,  100);
canvas.drawBitmap(_image,200,200, null);
canvas.restore();