绘制内容 @param canvas
(Canvas canvas)
| 117 | * @param canvas |
| 118 | */ |
| 119 | @Override |
| 120 | protected void onDraw(Canvas canvas) { |
| 121 | super.onDraw(canvas); |
| 122 | |
| 123 | // 移动坐标系到画布中央 |
| 124 | canvas.translate(mWidth / 2, mHeight / 2); |
| 125 | |
| 126 | // 绘制背景圆形 |
| 127 | canvas.drawCircle(0, 0, 240, mPaint); |
| 128 | |
| 129 | // 得出图像边长 |
| 130 | int sideLength = okBitmap.getHeight(); |
| 131 | |
| 132 | // 得到图像选区 和 实际绘制位置 |
| 133 | Rect src = new Rect(sideLength * animCurrentPage, 0, sideLength * (animCurrentPage + 1), sideLength); |
| 134 | Rect dst = new Rect(-200, -200, 200, 200); |
| 135 | |
| 136 | // 绘制 |
| 137 | canvas.drawBitmap(okBitmap, src, dst, null); |
| 138 | } |
| 139 | |
| 140 | |
| 141 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected