RootsRendererView.java 文件源码

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

项目:MPSolveForAndroid 作者:
/** 
 * @brief Prepare the Paints for later user in the onDraw() method.
 * 
 * Note that this method peform also some other basic initializations, such
 * as computing some sizes in a device-independent way and initializing
 * some String formatter. 
 * 
 *  As a rule of thumb, every expensive operation that does not need to
 *  be performed on every onDraw() call should be called here. 
 */
private void initPaints() {
    axisFormat = new DecimalFormat("#.#E0");

    // Compute a Device independent point size
    pointSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
            4, getResources().getDisplayMetrics());

    // ...and in the same spirit get a device independent width for the
    // ticks that we will draw on the axis. 
    tickWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
            3, getResources().getDisplayMetrics());

    // Paint used for the X and Y axis. 
    axisPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    axisPaint.setColor(
            getResources().getColor(R.color.rootsRendererView_axis));
    axisPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
            12, getResources().getDisplayMetrics()));

    // Paint used for the points of the plot
    pointsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    pointsPaint.setColor(
            getResources().getColor(R.color.rootsRendererView_points));
    pointsPaint.setStyle(Style.FILL_AND_STROKE);
    pointsPaint.setMaskFilter(new BlurMaskFilter(2, Blur.INNER));

    // Paint similar to the above, but used for points marked
    // in the Approximation list. 
    markedPointsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    markedPointsPaint.setColor(
            getResources().getColor(R.color.rootsRendererView_MarkedPoints));
    markedPointsPaint.setStyle(Style.FILL_AND_STROKE);
    markedPointsPaint.setMaskFilter(new BlurMaskFilter (2, Blur.INNER));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号