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


Java Paint.reset方法代码示例

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


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

示例1: circleCrop

import android.graphics.Paint; //导入方法依赖的package包/类
private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
    if (source == null) return null;
    int size = Math.min(source.getWidth(), source.getHeight());
    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;
    // TODO this could be acquired from the pool too
    Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }
    float r = size / 2f;
    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setColor(Color.parseColor("#F9F9F9"));
    paint.setStyle(Paint.Style.FILL);
    canvas.drawCircle(r, r, r, paint);
    paint.reset();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    canvas.drawCircle(r, r, r, paint);
    return result;
}
 
开发者ID:YunzhanghuOpen,项目名称:redpacketui-open,代码行数:24,代码来源:CircleTransform.java

示例2: setupStrokePaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Sets up paint according to the props set on a shadow view. Returns {@code true}
 * if the stroke should be drawn, {@code false} if not.
 */
protected boolean setupStrokePaint(Paint paint, float opacity, @Nullable RectF box) {
  paint.reset();
  if (TextUtils.isEmpty(mStrokeColor)) {
    return false;
  }

  paint.setFlags(Paint.ANTI_ALIAS_FLAG);
  paint.setStyle(Paint.Style.STROKE);
  paint.setStrokeCap(mStrokeLinecap);
  paint.setStrokeJoin(mStrokeLinejoin);
  paint.setStrokeMiter(mStrokeMiterlimit * mScale);
  paint.setStrokeWidth(mStrokeWidth * mScale);
  setupPaint(paint, opacity, mStrokeColor, box);

  if (mStrokeDasharray != null && mStrokeDasharray.length > 0) {
    paint.setPathEffect(new DashPathEffect(mStrokeDasharray, mStrokeDashoffset));
  }

  return true;
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:25,代码来源:WXSvgPath.java

示例3: drawBackgroundStroke

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawBackgroundStroke(Canvas canvas, Paint paint) {
    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());

    paint.reset();
    paint.setAntiAlias(true);
    if(Utilities.getFolderPreviewCirclePrefEnabled(Launcher.getLauncherActivity().getApplicationContext()) != -1){
        paint.setColor(Utilities.getFolderPreviewCirclePrefEnabled(Launcher.getLauncherActivity().getApplicationContext()));
    }else {
        paint.setColor(Color.argb(255, BG_INTENSITY, BG_INTENSITY, BG_INTENSITY));
    }
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(mStrokeWidth);

    float radius = getScaledRadius();
    canvas.drawCircle(radius, radius, radius - 1, paint);

    canvas.restore();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:20,代码来源:FolderIcon.java

示例4: drawLeaveBehind

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawLeaveBehind(Canvas canvas, Paint paint) {
    float originalScale = mScale;
    mScale = 0.5f;

    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());

    paint.reset();
    paint.setAntiAlias(true);
    paint.setColor(Color.argb(160, 245, 245, 245));

    float radius = getScaledRadius();
    canvas.drawCircle(radius, radius, radius, paint);

    canvas.restore();
    mScale = originalScale;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:18,代码来源:FolderIcon.java

示例5: setupFillPaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
 * if the fill should be drawn, {@code false} if not.
 */
protected boolean setupFillPaint(Paint paint, float opacity) {
  if (mFillColor != null && mFillColor.length > 0) {
    paint.reset();
    paint.setFlags(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    int colorType = (int) mFillColor[0];
    switch (colorType) {
      case 0:
        paint.setARGB(
            (int) (mFillColor.length > 4 ? mFillColor[4] * opacity * 255 : opacity * 255),
            (int) (mFillColor[1] * 255),
            (int) (mFillColor[2] * 255),
            (int) (mFillColor[3] * 255));
        break;
      default:
        // TODO(6352048): Support gradients etc.
        FLog.w(ReactConstants.TAG, "ART: Color type " + colorType + " not supported!");
    }
    return true;
  }
  return false;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:ARTShapeShadowNode.java

示例6: setupFillPaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Sets up paint according to the props set on a shadow view. Returns {@code true}
 * if the fill should be drawn, {@code false} if not.
 */
protected boolean setupFillPaint(Paint paint, float opacity, @Nullable RectF box) {
  if (!TextUtils.isEmpty(mFillColor)) {
    paint.reset();
    //paint.setColor(SvgParser.parseColor(mFillColor));
    paint.setFlags(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    setupPaint(paint, opacity, mFillColor, box);
    return true;
  }
  return false;
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:16,代码来源:WXSvgPath.java

示例7: init

import android.graphics.Paint; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    DashPathEffect mPathEffect = new DashPathEffect(new float[]{dp2px(2), dp2px(2)}, 1);
    mGradeAxisPaint = new Paint();
    mGradeAxisPaint.reset();
    mGradeAxisPaint.setStyle(Paint.Style.STROKE);
    mGradeAxisPaint.setStrokeWidth(1);
    mGradeAxisPaint.setColor(isDebug ? Color.parseColor("#000000") : Color.parseColor("#16ffffff"));
    mGradeAxisPaint.setAntiAlias(true);
    mGradeAxisPaint.setPathEffect(mPathEffect);

    mTextPaint = new TextPaint();
    mTextPaint.setColor(Color.parseColor("#ffffff"));
    mTextPaint.setTextSize(dp2px(11));
    mTextPaint.setAntiAlias(true);
}
 
开发者ID:maoruibin,项目名称:TrendChartView,代码行数:16,代码来源:TrendYAxisView.java

示例8: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawBackground(Canvas canvas, Paint paint) {
    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());

    paint.reset();
    if(Utilities.isAllowFolderTransparentPrefEnabled(Launcher.getLauncherActivity().getApplicationContext())){
        paint.setStyle(Paint.Style.STROKE);
    }else {
        paint.setStyle(Paint.Style.FILL);
    }
    paint.setXfermode(null);
    paint.setAntiAlias(true);

    int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
    if(Utilities.getFolderPreviewBackgroundPrefEnabled(Launcher.getLauncherActivity().getApplicationContext()) != -1){
        paint.setColor(Utilities.getFolderPreviewBackgroundPrefEnabled(Launcher.getLauncherActivity().getApplicationContext()));
    }else {
        paint.setColor(Color.argb(alpha, BG_INTENSITY, BG_INTENSITY, BG_INTENSITY));
    }
    float radius = getScaledRadius();

    canvas.drawCircle(radius, radius, radius, paint);
    canvas.clipPath(mClipPath, Region.Op.DIFFERENCE);

    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(Color.TRANSPARENT);
    paint.setShadowLayer(mStrokeWidth, 0, mStrokeWidth, Color.argb(SHADOW_OPACITY, 0, 0, 0));
    canvas.drawCircle(radius, radius, radius, paint);

    canvas.restore();
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:32,代码来源:FolderIcon.java

示例9: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawBackground(Canvas canvas, Paint paint) {
    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());
    paint.reset();
    paint.setStyle(Paint.Style.FILL);//充满
    paint.setColor(Color.LTGRAY);
    paint.setAntiAlias(true);
    paint.setAlpha(100);
    RectF oval3 = new RectF(0, 0, mBackground.previewSize, mBackground.previewSize);
    canvas.drawRoundRect(oval3, 40, 40,paint);
    canvas.restore();

}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:14,代码来源:FolderIcon.java

示例10: drawBackgroundStroke

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawBackgroundStroke(Canvas canvas, Paint paint) {
    canvas.save();
    canvas.translate(getOffsetX(), getOffsetY());

    paint.reset();
    paint.setAntiAlias(true);
    paint.setColor(Color.argb(0, BG_INTENSITY, BG_INTENSITY, BG_INTENSITY));
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(mStrokeWidth);
    RectF oval3 = new RectF(0, 0, mBackground.previewSize, mBackground.previewSize);

    canvas.drawRoundRect(oval3,40,40,paint);

    canvas.restore();
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:16,代码来源:FolderIcon.java

示例11: initPaint

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint() {
    mPathEffect = new DashPathEffect(new float[]{dp2, dp2}, 1);
    mGradeAxisPaint = new Paint();
    mGradeAxisPaint.reset();
    mGradeAxisPaint.setStyle(Paint.Style.STROKE);
    mGradeAxisPaint.setStrokeWidth(1);
    mGradeAxisPaint.setColor(isDebug ? Color.parseColor("#f00000") : Color.parseColor("#16ffffff"));
    mGradeAxisPaint.setAntiAlias(true);
    mGradeAxisPaint.setPathEffect(mPathEffect);

    mChartPaint = new Paint();
    mChartPaint.setStyle(Paint.Style.FILL);
    mChartPaint.setStrokeWidth(4);
    mChartPaint.setAntiAlias(true);

    mChartTestLinePaint = new Paint();
    mChartTestLinePaint.setStyle(Paint.Style.STROKE);
    mChartTestLinePaint.setStrokeWidth(dp2px(1));
    mChartTestLinePaint.setColor(Color.parseColor("#DF6A56"));
    mChartTestLinePaint.setAntiAlias(true);
    mChartTestLinePaint.setAlpha(0);
    if (isDebug) {
        mChartTestLinePaint.setAlpha(255);
    }

    mChartIndicatorPaint = new Paint();
    mChartIndicatorPaint.setStyle(Paint.Style.STROKE);
    mChartIndicatorPaint.setStrokeWidth(dp2px(1));

    mWhitePaint = new Paint();
    mWhitePaint.setStyle(Paint.Style.FILL);
    mWhitePaint.setColor(Color.parseColor("#ffffff"));

    mWhiteTextPaint = new TextPaint();
    mWhiteTextPaint.setColor(Color.parseColor("#ffffff"));
    mWhiteTextPaint.setTextSize(dp2px(11));
    mWhiteTextPaint.setAntiAlias(true);

    mWhiteTextPaintHeight = mWhiteTextPaint.descent() + mWhiteTextPaint.ascent();

    mDarkTextPaint = new TextPaint(mWhiteTextPaint);
    mDarkTextPaint.setAlpha(127);

    mPathIndicatorLine = new Path();
    mPathIndicatorLine.setFillType(Path.FillType.WINDING);

    mPathGradLine = new Path();
    mRectIndicator = new RectF();
}
 
开发者ID:maoruibin,项目名称:TrendChartView,代码行数:50,代码来源:TrendChartView.java

示例12: setupStrokePaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Sets up {@link #mPaint} according to the props set on a shadow view. Returns {@code true}
 * if the stroke should be drawn, {@code false} if not.
 */
protected boolean setupStrokePaint(Paint paint, float opacity) {
  if (mStrokeWidth == 0 || mStrokeColor == null || mStrokeColor.length == 0) {
    return false;
  }
  paint.reset();
  paint.setFlags(Paint.ANTI_ALIAS_FLAG);
  paint.setStyle(Paint.Style.STROKE);
  switch (mStrokeCap) {
    case CAP_BUTT:
      paint.setStrokeCap(Paint.Cap.BUTT);
      break;
    case CAP_SQUARE:
      paint.setStrokeCap(Paint.Cap.SQUARE);
      break;
    case CAP_ROUND:
      paint.setStrokeCap(Paint.Cap.ROUND);
      break;
    default:
      throw new JSApplicationIllegalArgumentException(
          "strokeCap " + mStrokeCap + " unrecognized");
  }
  switch (mStrokeJoin) {
    case JOIN_MITER:
      paint.setStrokeJoin(Paint.Join.MITER);
      break;
    case JOIN_BEVEL:
      paint.setStrokeJoin(Paint.Join.BEVEL);
      break;
    case JOIN_ROUND:
      paint.setStrokeJoin(Paint.Join.ROUND);
      break;
    default:
      throw new JSApplicationIllegalArgumentException(
          "strokeJoin " + mStrokeJoin + " unrecognized");
  }
  paint.setStrokeWidth(mStrokeWidth * mScale);
  paint.setARGB(
      (int) (mStrokeColor.length > 3 ? mStrokeColor[3] * opacity * 255 : opacity * 255),
      (int) (mStrokeColor[0] * 255),
      (int) (mStrokeColor[1] * 255),
      (int) (mStrokeColor[2] * 255));
  if (mStrokeDash != null && mStrokeDash.length > 0) {
    paint.setPathEffect(new DashPathEffect(mStrokeDash, 0));
  }
  return true;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:51,代码来源:ARTShapeShadowNode.java


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