Example usage for android.graphics Paint DITHER_FLAG

List of usage examples for android.graphics Paint DITHER_FLAG

Introduction

In this page you can find the example usage for android.graphics Paint DITHER_FLAG.

Prototype

int DITHER_FLAG

To view the source code for android.graphics Paint DITHER_FLAG.

Click Source Link

Document

Paint flag that enables dithering when blitting.

Usage

From source file:com.dongdong.wheel.WheelView.java

/**
 * Initializes resources/*from  w w  w  . java  2s.  c  o m*/
 */
private void initResourcesIfNecessary() {
    if (mItemsPaint == null) {
        mItemsPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG);
        //mItemsPaint.density = getResources().getDisplayMetrics().density;
        mItemsPaint.setTextSize(TEXT_SIZE);
    }

    if (mValuePaint == null) {
        mValuePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.DITHER_FLAG);
        //mValuePaint.density = getResources().getDisplayMetrics().density;
        mValuePaint.setTextSize(TEXT_SIZE);
        mValuePaint.setShadowLayer(0.1f, 0, 0.1f, 0xFFC0C0C0);
    }

    if (mCenterDrawable == null) {
        mCenterDrawable = ContextCompat.getDrawable(getContext(), R.drawable.wheel_val);
    }

    if (mTopShadow == null) {
        mTopShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (mBottomShadow == null) {
        mBottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}

From source file:com.example.view.wheel.WheelView.java

/**
 * Initializes resources//from   w  w w  . j  a v a 2  s . c  om
 */
private void initResourcesIfNecessary() {
    if (itemsPaint == null) {
        itemsPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG);
        //itemsPaint.density = getResources().getDisplayMetrics().density;
        itemsPaint.setTextSize(BaseUtil.dp2px(context, TEXT_SIZE));
    }

    if (valuePaint == null) {
        valuePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.DITHER_FLAG);
        //valuePaint.density = getResources().getDisplayMetrics().density;
        valuePaint.setTextSize(BaseUtil.dp2px(context, TEXT_SIZE));
        valuePaint.setColor(Color.BLUE);
        //   valuePaint.setShadowLayer(0.1f, 0, 0.1f, 0xFFC0C0C0);
    }
    if (linePaint == null) {
        linePaint = new Paint();
        linePaint.setColor(Color.parseColor("#FF6D4B"));
        linePaint.setStrokeWidth(10.0F);
    }
    if (centerDrawable == null) {
        centerDrawable = ContextCompat.getDrawable(context, R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    //setBackgroundResource(R.drawable.wheel_bg);
    setBackgroundColor(Color.WHITE);
}