GaugeVector.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:AccelerationExplorer 作者:
/**
 * Draw the gauge.
 *
 * @param canvas
 */
private void drawAxis(Canvas canvas) {
    // Draw the Y axis
    canvas.drawLine(rimRect.centerX(), rimRect.top, rimRect.centerX(),
            rimRect.bottom, axisPaint);

    // Draw the X axis
    canvas.drawLine(rimRect.left, rimRect.centerY(), rimRect.right,
            rimRect.centerY(), axisPaint);

    // Draw the Y axis arrow
    Path yArrowPath = new Path();
    yArrowPath.setFillType(FillType.EVEN_ODD);

    yArrowPath.moveTo(rimRect.centerX() - 0.002f, rimRect.top);
    yArrowPath.lineTo(rimRect.centerX() + 0.05f, rimRect.top + 0.05f);
    yArrowPath.moveTo(rimRect.centerX() + 0.002f, rimRect.top);
    yArrowPath.lineTo(rimRect.centerX() - 0.05f, rimRect.top + 0.05f);

    canvas.drawPath(yArrowPath, axisPaint);

    // Draw the Y axis arrow
    Path xArrowPath = new Path();
    xArrowPath.setFillType(FillType.EVEN_ODD);

    xArrowPath.moveTo(rimRect.right, rimRect.centerY() + 0.002f);
    xArrowPath.lineTo(rimRect.right - 0.05f, rimRect.centerY() - 0.05f);

    xArrowPath.moveTo(rimRect.right, rimRect.centerY() - 0.002f);
    xArrowPath.lineTo(rimRect.right - 0.05f, rimRect.centerY() + 0.05f);

    canvas.drawPath(xArrowPath, axisPaint);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号