AbstractChart.java 文件源码

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

项目:iOffice 作者:
/**
 * Draws the chart background.
 * 
 * @param renderer the chart renderer
 * @param canvas the canvas to paint to
 * @param x the top left x value of the view to draw to
 * @param y the top left y value of the view to draw to
 * @param width the width of the view to draw to
 * @param height the height of the view to draw to
 * @param paint the paint used for drawing
 * @param newColor if a new color is to be used
 * @param color the color to be used
 */
protected void drawBackgroundAndFrame(DefaultRenderer renderer, Canvas canvas, IControl control, Rect rect, Paint paint) 
{
 int alpha = paint.getAlpha();
 Path path = new Path();
 path.addRect((float)rect.left, (float)rect.top, (float)rect.right, (float)rect.bottom, Direction.CCW);
 // draw fill
    BackgroundAndFill fill = renderer.getBackgroundAndFill();
    if (fill != null)
    {
        paint.setStyle(Style.FILL);
        BackgroundDrawer.drawPathBackground(canvas, control, 1, fill, rect, null, 1.0f, path, paint);
        paint.setAlpha(alpha);
    }

    // draw border
    Line frame = renderer.getChartFrame();
    if (frame != null)
    {
        paint.setStyle(Style.STROKE);
        paint.setStrokeWidth(2);
        if(frame.isDash())
        {
          DashPathEffect dashPathEffect = new DashPathEffect(new float[] {5, 5}, 10);
            paint.setPathEffect(dashPathEffect);
        }            

        BackgroundDrawer.drawPathBackground(canvas, null, 1, frame.getBackgroundAndFill(), rect, null, 1.0f, path, paint);
        paint.setStyle(Style.FILL);
        paint.setAlpha(alpha);
    }

    paint.reset();
    paint.setAntiAlias(true);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号