Java Code Examples for android.graphics.Paint.setStrokeCap()

The following are Jave code examples for showing how to use setStrokeCap() of the android.graphics.Paint class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ImageEraser   File: MainActivity.java   View Source Code Vote up 6 votes
public void UpdateCanvas() {
    canvasMaster.drawColor(0, Mode.CLEAR);
    canvasMaster.drawBitmap(lastEditedBitmap, 0.0f, 0.0f, null);
    int i = 0;
    while (true) {
        if (i >= paths.size()) {
            break;
        }
        int brushSize = brushSizes.get(i);
        Paint paint = new Paint();
        paint.setColor(0);
        paint.setStyle(Style.STROKE);
        paint.setAntiAlias(true);
        paint.setStrokeJoin(Join.ROUND);
        paint.setStrokeCap(Cap.ROUND);
        paint.setXfermode(new PorterDuffXfermode(Mode.SRC));
        paint.setStrokeWidth((float) brushSize);
        canvasMaster.drawPath(paths.get(i), paint);
        i += 1;
    }
    touchImageView.invalidate();
}
 
Example 2
Project: ReadMark   File: ELetter.java   View Source Code Vote up 6 votes
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mRectF = new RectF(x - MAX_RADIUS_CIRCLE
            , y - MAX_RADIUS_CIRCLE
            , x + MAX_RADIUS_CIRCLE
            , y + MAX_RADIUS_CIRCLE);
    mFirstPoint = new Point(x - MAX_RADIUS_CIRCLE, y);
    mSecondPoint = new Point(mFirstPoint);
}
 
Example 3
Project: ReadMark   File: DLetter.java   View Source Code Vote up 6 votes
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mRectF = new RectF(x - MAX_RADIUS_CIRCLE
            , y - MAX_RADIUS_CIRCLE
            , x + MAX_RADIUS_CIRCLE
            , y + MAX_RADIUS_CIRCLE);
    mFirPoint = new Point(x + MAX_RADIUS_CIRCLE, y - 2 * MAX_RADIUS_CIRCLE);
    mSecPoint = new Point(mFirPoint);
}
 
Example 4
Project: BooheeRuler   File: InnerRuler.java   View Source Code Vote up 6 votes
private void initPaints() {
        mSmallScalePaint = new Paint();
        mSmallScalePaint.setStrokeWidth(mParent.getSmallScaleWidth());
        mSmallScalePaint.setColor(mParent.getScaleColor());
        mSmallScalePaint.setStrokeCap(Paint.Cap.ROUND);;

        mBigScalePaint = new Paint();
        mBigScalePaint.setColor(mParent.getScaleColor());
        mBigScalePaint.setStrokeWidth(mParent.getBigScaleWidth());
        mBigScalePaint.setStrokeCap(Paint.Cap.ROUND);;

        mTextPaint = new Paint();
        mTextPaint.setAntiAlias(true);
        mTextPaint.setColor(mParent.getTextColor());
        mTextPaint.setTextSize(mParent.getTextSize());
        mTextPaint.setTextAlign(Paint.Align.CENTER);
//        mTextPaint.setStrokeJoin(Paint.Join.ROUND);
        mOutLinePaint = new Paint();
        mOutLinePaint.setStrokeWidth(0);
        mOutLinePaint.setColor(mParent.getScaleColor());
    }
 
Example 5
Project: screenfilter   File: BasePainter.java   View Source Code Vote up 5 votes
private void init() {
    paint = new Paint();
    paint.setColor(bgColor);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setAntiAlias(true);

    toBgPainter = new Paint();
    toBgPainter.setColor(toBgColor);
    toBgPainter.setStrokeCap(Paint.Cap.ROUND);
    toBgPainter.setAntiAlias(true);
    toBgPainter.setAlpha(0);

    initColorAnimator();
    ballMoveObservable.addObserver(this);
}
 
Example 6
Project: buildAPKsApps   File: XYChart.java   View Source Code Vote up 5 votes
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
    Paint paint) {
  paint.setStrokeCap(cap);
  paint.setStrokeJoin(join);
  paint.setStrokeMiter(miter);
  paint.setPathEffect(pathEffect);
  paint.setStyle(style);
}
 
Example 7
Project: buildAPKsSamples   File: CubeWallpaper2.java   View Source Code Vote up 5 votes
CubeEngine() {
    // Create a Paint to draw the lines for our cube
    final Paint paint = mPaint;
    paint.setColor(0xffffffff);
    paint.setAntiAlias(true);
    paint.setStrokeWidth(2);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStyle(Paint.Style.STROKE);

    mStartTime = SystemClock.elapsedRealtime();

    mPrefs = CubeWallpaper2.this.getSharedPreferences(SHARED_PREFS_NAME, 0);
    mPrefs.registerOnSharedPreferenceChangeListener(this);
    onSharedPreferenceChanged(mPrefs, null);
}
 
Example 8
Project: VoiceRipple   File: MainActivity.java   View Source Code Vote up 5 votes
private Paint getArcPaint() {
  Paint paint = new Paint();
  paint.setColor(ContextCompat.getColor(this, R.color.temp_color));
  paint.setStrokeWidth(20);
  paint.setAntiAlias(true);
  paint.setStrokeCap(Paint.Cap.SQUARE);
  paint.setStyle(Paint.Style.STROKE);
  return paint;
}
 
Example 9
Project: ReadMark   File: SecondCake.java   View Source Code Vote up 5 votes
@Override
protected void initConfig() {
    mEndMovingLength = -130;
    mPaint = new Paint();
    //mPaint.setStyle(Paint.Style.STROKE);
    //设置画一条直线后结尾处的形状
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    //设置连接处的形状
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setAntiAlias(true);
}
 
Example 10
Project: ReadMark   File: RLetter.java   View Source Code Vote up 5 votes
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mLength1 = 3 * MAX_RADIUS_CIRCLE;
    //mLength2 = (int) Math.sqrt(MAX_RADIUS_CIRCLE * MAX_RADIUS_CIRCLE + MAX_RADIUS_CIRCLE * MAX_RADIUS_CIRCLE);

    mCircleX = x;
    mCircleY = y - MAX_RADIUS_CIRCLE;

    mRectF = new RectF(mCircleX - MAX_RADIUS_CIRCLE
            , mCircleY - MAX_RADIUS_CIRCLE
            , mCircleX + MAX_RADIUS_CIRCLE
            , mCircleY + MAX_RADIUS_CIRCLE);


    mFirstPoint = new Point(x - MAX_RADIUS_CIRCLE
            , y - 2 * MAX_RADIUS_CIRCLE);
    mSecondPoint = new Point(mFirstPoint);

    mThirdPoint = new Point(x - MAX_RADIUS_CIRCLE, y + MAX_RADIUS_CIRCLE / 4);
    mFourthPoint = new Point(mThirdPoint);
    mFifthPoint = new Point(mThirdPoint);
}
 
Example 11
Project: ReadMark   File: MLetter.java   View Source Code Vote up 5 votes
@Override
protected void initConfig(int x, int y) {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Config.WHITE);
    mPaint.setStrokeCap(Paint.Cap.SQUARE);

    mFirPoint = new Point(x, y - 2 * MAX_RADIUS_CIRCLE);
    mSecPoint = new Point(mFirPoint);
    mThiPoint = new Point(mFirPoint);
    mFourPoint = new Point(mFirPoint);
}
 
Example 12
Project: PDR   File: MapView.java   View Source Code Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
	super.onDraw(canvas);

	// ����ͼ��ı���ɫ
	canvas.drawColor(Color.TRANSPARENT);
	// ��ӻ���
	Paint paint_Line = new Paint();
	paint_Line.setAntiAlias(true); // �����
	paint_Line.setStrokeWidth(2); // ���û��ʿ��
	paint_Line.setStyle(Style.STROKE);
	paint_Line.setColor(Color.BLUE); // ���ʵ���ɫ

	Paint paint_Point = new Paint();
	paint_Point.setAntiAlias(true); // �����
	paint_Point.setStrokeWidth(8); // ���û��ʿ��
	paint_Point.setStyle(Style.STROKE);
	paint_Point.setColor(Color.RED); // ���ʵ���ɫ
	paint_Point.setStrokeCap(Cap.ROUND);//Բͷ�Ļ���ͷ
	
	
		
	
	switch (test_flag) {
	case 0:          //�ӱ������ݿ��õ��ĵ�
		drawDpPoint(canvas, testPoints, paint_Point);
		break;
	
	case 1:          //�ӷ���������õ���
		drawDpPoint(canvas, testPoint, paint_Point);
		break;
	default:
		break;
	}
}
 
Example 13
Project: FastTextView   File: StrokeReplacementSpan.java   View Source Code Vote up 5 votes
@Override
public void draw(@NonNull Canvas canvas, CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, float x, int top, int y, int bottom, @NonNull Paint paint) {
  canvas.save();
  canvas.translate(mStrokeWidth, 0);
  paint.setColor(mStrokeColor);
  paint.setStrokeCap(Paint.Cap.ROUND);
  paint.setStrokeWidth(mStrokeWidth);
  paint.setStyle(Paint.Style.STROKE);
  canvas.drawText(text, start, end, x, y, paint);
  paint.setColor(mTextColor);
  paint.setStyle(Paint.Style.FILL);
  canvas.drawText(text, start, end, x, y, paint);
  canvas.restore();
}
 
Example 14
Project: AnchorImageView   File: AnchorImageView.java   View Source Code Vote up 5 votes
private void init() {
    drawRoundRectRadius = dpToPx(5);
    setScaleType(ImageView.ScaleType.FIT_XY);

    clickableStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickableStroke.setStrokeWidth(1f);
    clickableStroke.setStyle(Paint.Style.STROKE);
    clickableStroke.setStrokeCap(Paint.Cap.ROUND);
    clickableStroke.setColor(Color.BLUE);

    clickFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickFill.setStyle(Paint.Style.FILL_AND_STROKE);
    clickFill.setStrokeCap(Paint.Cap.ROUND);
    clickFill.setColor(Color.BLUE);
    clickFill.setAlpha(70);

    clickStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    clickStroke.setStyle(Paint.Style.STROKE);
    clickStroke.setColor(Color.BLUE);
    clickStroke.setStrokeWidth(2f);
    clickStroke.setStrokeCap(Paint.Cap.ROUND);

    warnFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    warnFill.setStyle(Paint.Style.FILL_AND_STROKE);
    warnFill.setStrokeCap(Paint.Cap.ROUND);
    warnFill.setColor(Color.YELLOW);
    warnFill.setAlpha(70);

    warnStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    warnStroke.setStyle(Paint.Style.STROKE);
    warnStroke.setColor(Color.YELLOW);
    warnStroke.setStrokeWidth(2f);
    warnStroke.setStrokeCap(Paint.Cap.ROUND);

    setOnTouchListener(this);
    gestureDetector = new GestureDetector(getContext(), new OnGestureListenerAnchor(this));
}
 
Example 15
Project: ScreenRecordCaptureMaster   File: ProgressButtonView.java   View Source Code Vote up 5 votes
private void initView(Context context) {
    bgArcColor = Color.parseColor("#33f4f4f4");

    //背景
    allArcPaint = new Paint();
    allArcPaint.setAntiAlias(true);
    allArcPaint.setStyle(Paint.Style.FILL);
    allArcPaint.setColor(bgArcColor);
    allArcPaint.setStrokeCap(Paint.Cap.ROUND);

    mCenterCirclePaint = new Paint();
    mCenterCirclePaint.setAntiAlias(true);
    mCenterCirclePaint.setStyle(Paint.Style.FILL);
    mCenterCirclePaint.setColor(Color.WHITE);
    mCenterCirclePaint.setStrokeCap(Paint.Cap.ROUND);

    centerPaint = new Paint();
    centerPaint.setAntiAlias(true);
    centerPaint.setStyle(Paint.Style.FILL);
    centerPaint.setColor(Color.argb(255, 255, 45, 53));
    centerPaint.setStrokeCap(Paint.Cap.ROUND);

    //当前进度
    progressPaint = new Paint();
    progressPaint.setAntiAlias(true);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeWidth(progressWidth);
    progressPaint.setColor(Color.argb(255, 255, 45, 53));
    progressPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 16
Project: Sega   File: SimpleRatingBar.java   View Source Code Vote up 5 votes
/**
 * Inits paint objects and default values.
 */
private void initView() {
    starPath = new Path();
    cornerPathEffect = new CornerPathEffect(starCornerRadius);

    paintStarOutline = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
    paintStarOutline.setStyle(Paint.Style.FILL_AND_STROKE);
    paintStarOutline.setAntiAlias(true);
    paintStarOutline.setDither(true);
    paintStarOutline.setStrokeJoin(Paint.Join.ROUND);
    paintStarOutline.setStrokeCap(Paint.Cap.ROUND);
    paintStarOutline.setColor(Color.BLACK);
    paintStarOutline.setPathEffect(cornerPathEffect);

    paintStarBorder = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
    paintStarBorder.setStyle(Paint.Style.STROKE);
    paintStarBorder.setStrokeJoin(Paint.Join.ROUND);
    paintStarBorder.setStrokeCap(Paint.Cap.ROUND);
    paintStarBorder.setStrokeWidth(starBorderWidth);
    paintStarBorder.setPathEffect(cornerPathEffect);

    paintStarBackground = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
    paintStarBackground.setStyle(Paint.Style.FILL_AND_STROKE);
    paintStarBackground.setAntiAlias(true);
    paintStarBackground.setDither(true);
    paintStarBackground.setStrokeJoin(Paint.Join.ROUND);
    paintStarBackground.setStrokeCap(Paint.Cap.ROUND);

    paintStarFill = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
    paintStarFill.setStyle(Paint.Style.FILL_AND_STROKE);
    paintStarFill.setAntiAlias(true);
    paintStarFill.setDither(true);
    paintStarFill.setStrokeJoin(Paint.Join.ROUND);
    paintStarFill.setStrokeCap(Paint.Cap.ROUND);

    defaultStarSize = applyDimension(COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
}
 
Example 17
Project: tensorflow-hangul-recognition   File: PaintView.java   View Source Code Vote up 5 votes
public PaintView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    path = new Path();

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(Color.WHITE);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStrokeWidth(6);
}
 
Example 18
Project: EasyTableView   File: CalendarCheckDecoration.java   View Source Code Vote up 5 votes
public CalendarCheckDecoration(float strokeWidth, int color) {
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeWidth(strokeWidth);
    paint.setColor(color);
    path = new Path();
}
 
Example 19
Project: Rxjava2.0Demo   File: LineRotateLoadingView.java   View Source Code Vote up 4 votes
private void initPaint() {
    mPaint = new Paint();
    mPaint.setColor(mPaintColor);
    mPaint.setAntiAlias(true);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
Example 20
Project: AutoOff   File: CircularSeekBar.java   View Source Code Vote up 4 votes
/**
 * Initializes the {@code Paint} objects with the appropriate styles.
 */
protected void initPaints() {
	mCirclePaint = new Paint();
	mCirclePaint.setAntiAlias(true);
	mCirclePaint.setDither(true);
	mCirclePaint.setColor(mCircleColor);
	mCirclePaint.setStrokeWidth(mCircleStrokeWidth);
	mCirclePaint.setStyle(Paint.Style.STROKE);
	mCirclePaint.setStrokeJoin(Paint.Join.ROUND);
	mCirclePaint.setStrokeCap(Paint.Cap.ROUND);

	mCircleFillPaint = new Paint();
	mCircleFillPaint.setAntiAlias(true);
	mCircleFillPaint.setDither(true);
	mCircleFillPaint.setColor(mCircleFillColor);
	mCircleFillPaint.setStyle(Paint.Style.FILL);

	mCircleProgressPaint = new Paint();
	mCircleProgressPaint.setAntiAlias(true);
	mCircleProgressPaint.setDither(true);
	mCircleProgressPaint.setColor(mCircleProgressColor);
	mCircleProgressPaint.setStrokeWidth(mCircleStrokeWidth);
	mCircleProgressPaint.setStyle(Paint.Style.STROKE);
	mCircleProgressPaint.setStrokeJoin(Paint.Join.ROUND);
	mCircleProgressPaint.setStrokeCap(Paint.Cap.ROUND);

	mCircleProgressGlowPaint = new Paint();
	mCircleProgressGlowPaint.set(mCircleProgressPaint);
	mCircleProgressGlowPaint.setMaskFilter(new BlurMaskFilter((5f * DPTOPX_SCALE), BlurMaskFilter.Blur.NORMAL));

	mPointerPaint = new Paint();
	mPointerPaint.setAntiAlias(true);
	mPointerPaint.setDither(true);
	mPointerPaint.setStyle(Paint.Style.FILL);
	mPointerPaint.setColor(mPointerColor);
	mPointerPaint.setStrokeWidth(mPointerRadius);

	mPointerHaloPaint = new Paint();
	mPointerHaloPaint.set(mPointerPaint);
	mPointerHaloPaint.setColor(mPointerHaloColor);
	mPointerHaloPaint.setAlpha(mPointerAlpha);
	mPointerHaloPaint.setStrokeWidth(mPointerRadius + mPointerHaloWidth);

	mPointerHaloBorderPaint = new Paint();
	mPointerHaloBorderPaint.set(mPointerPaint);
	mPointerHaloBorderPaint.setStrokeWidth(mPointerHaloBorderWidth);
	mPointerHaloBorderPaint.setStyle(Paint.Style.STROKE);

}