Android翻页效果—电子书(4)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:39 点击:次
float width = this.mChildRect.right;
float height = this.mChildRect.bottom;
canvas.save();
// canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG));
canvas.clipPath(this.mBackPagePath, Region.Op.INTERSECT);
float xShift = 2.0F * this.mPivotX - width;
float xRotate = width - this.mPivotX;
float yRotate = height;
if ((this.mCorner & 0x1) != 0) {
xShift = width - 2.0F * this.mPivotX;
xRotate = this.mPivotX;
}
if ((this.mCorner & 0x2) != 0) {
yRotate = 0.0F;
}
canvas.translate(this.mOuterOffsetX + xShift, this.mOuterOffsetY);
canvas.rotate(this.mRotation, xRotate, yRotate);
//画原本的背面
if (this.mBackPage != null) {
this.mBackPage.setBounds(0, 0, this.mChildRect.right, this.mChildRect.bottom);
this.mBackPage.draw(canvas);
}
//画回调函数中的画背面
if (this.mPage != null) {
Log.v("log2 drawBackPage2:", "drawing back page");
this.mPage.drawBackPage(canvas);
}
canvas.restore();
canvas.save();
//
LinearGradient grad = new LinearGradient(
ex,ey,ex-(ex-bx)/4,ey-(ey-by)/4,R.color.gray3,0xC9C9C9,Shader.TileMode.CLAMP);
Paint p=new Paint();
p.setShader(grad);
// p.setAlpha(120);
canvas.drawPath(this.mBackPagePath,p);
canvas.restore();
//中间阴影问题,起点蓝色-》 白色-》 蓝色终点,这样起点前和终点后的区域也为蓝色了。
canvas.save();
// canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG));
LinearGradient grad1 = new LinearGradient(
ex-(ex-bx)/4,ey-(ey-by)/4,bx,by,0xC9C9C9,R.color.gray3,Shader.TileMode.CLAMP);
Paint p1=new Paint();
p1.setShader(grad1);
// p1.setAlpha(120);
canvas.drawPath(this.mBackPagePath,p1);
canvas.restore();
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>