当前位置: 首页>>代码示例>>Java>>正文


Java Paint.setDither方法代码示例

本文整理汇总了Java中android.graphics.Paint.setDither方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setDither方法的具体用法?Java Paint.setDither怎么用?Java Paint.setDither使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.setDither方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scaleBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
private static void scaleBitmap(Bitmap src, Bitmap dst) {
    Paint cPaint = new Paint();
    cPaint.setAntiAlias(true);
    cPaint.setDither(true);
    cPaint.setFilterBitmap(true);

    float ratioX = dst.getWidth() / (float) src.getWidth();
    float ratioY = dst.getHeight() / (float) src.getHeight();
    float middleX = dst.getWidth() * 0.5f;
    float middleY = dst.getHeight() * 0.5f;

    Matrix scaleMatrix = new Matrix();
    scaleMatrix.setScale(ratioX, ratioY, middleX, middleY);
    Canvas canvas = new Canvas(dst);
    canvas.setMatrix(scaleMatrix);
    canvas.drawBitmap(src, middleX - src.getWidth() / 2,
            middleY - src.getHeight() / 2, cPaint);
}
 
开发者ID:SumiMakito,项目名称:AwesomeQRCode,代码行数:19,代码来源:AwesomeQRCode.java

示例2: initPaint

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint() {
    linePaint = new Paint();
    linePaint.setStyle(Paint.Style.STROKE);
    linePaint.setAntiAlias(true);
    linePaint.setColor(lineColor);
    linePaint.setDither(true);
    linePaint.setStrokeWidth(lineStrokeWidth);

    roomTempPaint = new Paint();
    roomTempPaint.setStyle(Paint.Style.STROKE);
    roomTempPaint.setAntiAlias(true);
    roomTempPaint.setColor(roomTempLineColor);
    roomTempPaint.setDither(true);
    roomTempPaint.setStrokeWidth(dataStrokeWidth);

    targetTempPaint = new Paint();
    targetTempPaint.setStyle(Paint.Style.STROKE);
    targetTempPaint.setAntiAlias(true);
    targetTempPaint.setColor(targetTempLineColor);
    targetTempPaint.setDither(true);
    targetTempPaint.setStrokeWidth(dataStrokeWidth);

    mBmpPaint = new Paint();
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:25,代码来源:HistoryChartView.java

示例3: drawNumbers

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Function to draw number in the bitmap
 *
 * @param number Number to draw
 * @return the new bitmap after draw
 */
public Bitmap drawNumbers(String number) {
    float fontAndPadding = getResources().getDimension(R.dimen.draw_number);
    Paint paint = new Paint();
    paint.setTextSize(fontAndPadding);
    paint.setColor(Color.WHITE);
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    paint.setFakeBoldText(true);
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_repeat);
    Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(mutableBitmap);
    canvas.drawText(number, bitmap.getWidth() - fontAndPadding, fontAndPadding, paint);
    return mutableBitmap;
}
 
开发者ID:fekracomputers,项目名称:QuranAndroid,代码行数:22,代码来源:QuranPageReadActivity.java

示例4: ShadowViewDrawable

import android.graphics.Paint; //导入方法依赖的package包/类
public ShadowViewDrawable(ShadowProperty shadowProperty, int color, float rx, float ry) {
    this.shadowProperty = shadowProperty;
    shadowOffset = this.shadowProperty.getShadowOffset();

    this.rx = rx;
    this.ry = ry;

    paint = new Paint();
    paint.setAntiAlias(true);
    /**
     * 解决旋转时的锯齿问题
     */
    paint.setFilterBitmap(true);
    paint.setDither(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(color);
    /**
     * 设置阴影
     */
    paint.setShadowLayer(shadowProperty.getShadowRadius(), shadowProperty.getShadowDx(), shadowProperty.getShadowDy(), shadowProperty.getShadowColor());

    drawRect = new RectF();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:24,代码来源:ShadowViewDrawable.java

示例5: initialize

import android.graphics.Paint; //导入方法依赖的package包/类
private void initialize() {
    // We want a green box around the face:
    DisplayMetrics metrics = getResources().getDisplayMetrics();

    int stroke = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, metrics);
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(Color.GREEN);
    mPaint.setStrokeWidth(stroke);
    mPaint.setStyle(Paint.Style.STROKE);

    mTextPaint = new Paint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setDither(true);
    int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, metrics);
    mTextPaint.setTextSize(size);
    mTextPaint.setColor(Color.GREEN);
    mTextPaint.setStyle(Paint.Style.FILL);


}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:23,代码来源:FaceOverlayView.java

示例6: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context) {
    mTextPaint = new Paint();
    mPaint = new Paint();
    mPath = new Path();
    startPoint = new Point(200, 200);
    endPoint = new Point(800, 800);
    assistPoint = new Point(800, 200);
    // 抗锯齿
    mPaint.setAntiAlias(true);
    // 防抖动
    mPaint.setDither(true);
    //坐标
    mTextPaint.setColor(Color.RED);
    mTextPaint.setTextSize(20);
    mTextPaint.setStrokeWidth(10);
    mTextPaint.setAntiAlias(true);
    mTextPaint.setDither(true);
}
 
开发者ID:flyou,项目名称:PropertyAnimatorDemo,代码行数:19,代码来源:MyBezierView.java

示例7: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context) {

        setConfig(new ChartConfig(), false);

        axisPaint = new Paint();
        axisPaint.setStrokeWidth(axisWidth);
        axisPaint.setColor(axisColor);
        axisPaint.setAntiAlias(true);
        axisPaint.setStyle(Paint.Style.STROKE);
        axisPaint.setTextSize(coordinateTextSize);

        functionLinePaint = new Paint();
        functionLinePaint.setStrokeWidth(functionLineWidth);
        functionLinePaint.setColor(lineColor);
        functionLinePaint.setAntiAlias(true);
        functionLinePaint.setDither(true);
        functionLinePaint.setStyle(Paint.Style.STROKE);

        pointPaint = new Paint();
        pointPaint.setColor(DEFAULT_SINGLE_POINT_COLOR);
        pointPaint.setStyle(Paint.Style.FILL);
        pointPaint.setAntiAlias(true);

        // prepare an array to cache the split points
        xPointsValues = new PointF[segmentSize];
    }
 
开发者ID:KiBa1215,项目名称:CoordinateAxisChart,代码行数:27,代码来源:CoordinateAxisChart.java

示例8: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    mPath = new Path();
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setTextSize(18f);
    mPaint.setColor(colorStretching);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mDragTangentPoint = new PointF[2];
    mCenterTangentPoint = new PointF[2];
    mControlPoint = new PointF();
    mCenterCircle = new PointF();
    mCenterCircleCopy = new PointF();
    mDragCircle = new PointF();
    mDragCircleCopy = new PointF();
}
 
开发者ID:javonleee,项目名称:DragPointView,代码行数:17,代码来源:DragPointViewWindow.java

示例9: AlertDrawable

import android.graphics.Paint; //导入方法依赖的package包/类
public AlertDrawable(int outerCircleRadiusDP, int textSizeSP, int cornerArc, String drawText, Context context) {
    mContext = context;

    circleRadius = ScreenUtils.unitToPixels(context, TypedValue.COMPLEX_UNIT_DIP, outerCircleRadiusDP);
    textSize = ScreenUtils.unitToPixels(context, TypedValue.COMPLEX_UNIT_SP, textSizeSP);
    mDrawText = TextUtils.isEmpty(drawText) ? " " : drawText;
    initBitmap(mDrawText);
    mBackGroundPaint = new Paint();
    mBackGroundPaint.setAntiAlias(true);
    mBackGroundPaint.setDither(true);
    mBackGroundPaint.setColor(Color.WHITE);
    mBackGroundPaint.setStyle(Paint.Style.FILL);


    mCircleFillPaint = new Paint();
    mCircleFillPaint.setAntiAlias(true);
    mCircleFillPaint.setDither(true);
    mCircleFillPaint.setColor(ContextCompat.getColor(context, R.color.colorMultiArc));
    mCircleFillPaint.setStyle(Paint.Style.FILL);

    mOuterCircleFillPaint = new Paint();
    mOuterCircleFillPaint.setAntiAlias(true);
    mOuterCircleFillPaint.setDither(true);
    mOuterCircleFillPaint.setColor(Color.WHITE);
    mOuterCircleFillPaint.setStyle(Paint.Style.FILL);
    mOuterCircleFillPaint.setTextSize(textSize);


    borderPath = new Path();
    borderRect = new Rect();

    CornerPathEffect cornerPathEffect = new CornerPathEffect(cornerArc);
    mBackGroundPaint.setPathEffect(cornerPathEffect);

    outerCircleOffset = context.getResources().getInteger(R.integer.outerCircleOffset);
}
 
开发者ID:nidhinvv,项目名称:BubbleAlert,代码行数:37,代码来源:AlertDrawable.java

示例10: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init() {
    mShape = SHAPE_DIAMOND;
    mHueTouch = false;

    mColorInitial = 0;
    mColorHSV = new float[] { 0f, 1f, 1f };
    mHSV = new float[] { 0f, 1f, 1f };
    mXY = new double[] {0, 0};

    mInitialViewPaint = new Paint();
    mInitialViewPaint.setAntiAlias(true);

    mColorPaint = new Paint();
    mColorPaint.setAntiAlias(true);
    mColorPaint.setDither(true);

    mPointerPaint = new Paint();
    mPointerPaint.setStyle(Style.STROKE);
    mPointerPaint.setStrokeWidth(2f);
    mPointerPaint.setAntiAlias(true);

    mHueRingPaint = new Paint();
    mHueRingPaint.setStyle(Style.STROKE);
    mHueRingPaint.setAntiAlias(true);
    mHueRingPaint.setDither(true);

    mHueArrowPaint = new Paint();
    mHueArrowPaint.setAntiAlias(true);

    mHueArrowPath = new Path();
    mTrianglePath = new Path();

    mSquareRect = new RectF();

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        // Needed by ComposeShader
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:40,代码来源:ColorPicker.java

示例11: initPaintTools

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Init paint and other draw tools
 */
private void initPaintTools() {

    // init paint
    mPaint = new Paint();
    mPaint.setDither(true);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.WHITE);

    mArgbEvaluator = new ArgbEvaluator();
}
 
开发者ID:Belolme,项目名称:Tabbar,代码行数:14,代码来源:TabBarItem.java

示例12: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(int size) {
    mSize = size;
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(Color.GREEN);
    mPaint.setStrokeWidth(3);
    mPaint.setStyle(Paint.Style.STROKE);
}
 
开发者ID:lytcom,项目名称:CameraKitView,代码行数:10,代码来源:FocusView.java

示例13: setupTargetBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * 在内存中绘制可变色的Icon
 */
private void setupTargetBitmap(int alpha) {
    mBitmap = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
            Bitmap.Config.ARGB_8888);
    mCanvas = new Canvas(mBitmap);
    mPaint = new Paint();
    mPaint.setColor(mColor);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setAlpha(alpha);
    mCanvas.drawRect(mIconRect, mPaint);
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    mPaint.setAlpha(255);
    mCanvas.drawBitmap(mIconBitmap, null, mIconRect, mPaint);
}
 
开发者ID:chenlindev,项目名称:beyondwords,代码行数:18,代码来源:ChangeColorIconWithText.java

示例14: getCroppedRoundBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
public Bitmap getCroppedRoundBitmap(Bitmap bmp, int radius) {
    Bitmap squareBitmap;
    Bitmap scaledSrcBmp;
    int diameter = radius * 2;
    int bmpWidth = bmp.getWidth();
    int bmpHeight = bmp.getHeight();
    Bitmap bitmap;
    int i;
    if (bmpHeight > bmpWidth) {
        bitmap = bmp;
        i = (bmpHeight - bmpWidth) / 2;
        squareBitmap = Bitmap.createBitmap(bitmap, 0, i, bmpWidth, bmpWidth);
    } else if (bmpHeight < bmpWidth) {
        int x = (bmpWidth - bmpHeight) / 2;
        bitmap = bmp;
        i = 0;
        squareBitmap = Bitmap.createBitmap(bitmap, x, i, bmpHeight, bmpHeight);
    } else {
        squareBitmap = bmp;
    }
    if (squareBitmap.getWidth() == diameter && squareBitmap.getHeight() == diameter) {
        scaledSrcBmp = squareBitmap;
    } else {
        scaledSrcBmp = Bitmap.createScaledBitmap(squareBitmap, diameter, diameter, true);
    }
    Bitmap output = Bitmap.createBitmap(scaledSrcBmp.getWidth(), scaledSrcBmp.getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);
    Paint paint = new Paint();
    Rect rect = new Rect(0, 0, scaledSrcBmp.getWidth(), scaledSrcBmp.getHeight());
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    canvas.drawARGB(0, 0, 0, 0);
    canvas.drawCircle((float) (scaledSrcBmp.getWidth() / 2), (float) (scaledSrcBmp.getHeight() / 2), (float) (scaledSrcBmp.getWidth() / 2), paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(scaledSrcBmp, rect, rect, paint);
    return output;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:39,代码来源:RoundImageView.java

示例15: initPaints

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaints() {
    mTextPaint = new Paint();
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setAntiAlias(true);
    mTextPaint.setDither(true);
    mTextPaint.getTextBounds(mText, 0, mText.length(), mTextRect);
    mIconPaint = new Paint();
}
 
开发者ID:JackWHLiu,项目名称:jackknife,代码行数:10,代码来源:ShadeView.java


注:本文中的android.graphics.Paint.setDither方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。