Java Code Examples for android.graphics.Paint#setStrokeJoin()
The following examples show how to use
android.graphics.Paint#setStrokeJoin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineScalePulseOut.java From crystal-preloaders with Apache License 2.0 | 6 votes |
@Override public synchronized void onDraw(Canvas canvas, Paint fgPaint, Paint bgPaint, float width, float height, float cx, float cy) { fgPaint.setStrokeWidth(STROKE_WIDTH); fgPaint.setStyle(Paint.Style.STROKE); fgPaint.setStrokeJoin(Paint.Join.ROUND); fgPaint.setStrokeCap(Paint.Cap.ROUND); for(int i = 0; i < TOTAL_LINES; i++){ canvas.save(); canvas.scale(1, yScale[i], cx, cy); canvas.drawLine(x[i], x[0], x[i], height - x[0], fgPaint); canvas.restore(); } }
Example 2
Source File: BarcodeGraphic.java From MVBarcodeReader with Apache License 2.0 | 6 votes |
BarcodeGraphic(GraphicOverlay overlay) { super(overlay); mCurrentColorIndex = (mCurrentColorIndex + 1) % COLOR_CHOICES.length; final int selectedColor = COLOR_CHOICES[mCurrentColorIndex]; mRectPaint = new Paint(); mRectPaint.setColor(selectedColor); mRectPaint.setStyle(Paint.Style.STROKE); mRectPaint.setStrokeWidth(STROKE_WIDTH); mRectPaint.setStrokeCap(Paint.Cap.ROUND); mRectPaint.setStrokeJoin(Paint.Join.ROUND); mOverlayPaint = new Paint(); mOverlayPaint.setStyle(Paint.Style.FILL); mOverlayPaint.setColor(selectedColor); mOverlayPaint.setAlpha(100); }
Example 3
Source File: StrokeView.java From sinovoice-pathfinder with MIT License | 6 votes |
private void initView() { mPath = new Path(); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeWidth(mScriptWidth); mPaint.setColor(mScriptColor); mBorderPaint = new Paint(); mBorderPaint.setAntiAlias(true); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setStrokeCap(Paint.Cap.ROUND); mBorderPaint.setStrokeJoin(Paint.Join.ROUND); mBorderPaint.setStrokeWidth(5); mBorderPaint.setColor(0xFF000000); mBrushPaint = new Paint(); mBrushPaint.setStyle(Paint.Style.FILL); mBrushPaint.setStrokeCap(Paint.Cap.ROUND); mBrushPaint.setStrokeJoin(Paint.Join.ROUND); }
Example 4
Source File: Maze.java From Form-N-Fun with MIT License | 6 votes |
/** * display maze */ void display(Canvas c) { Paint paint = new Paint(); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setColor(Color.RED); Path path = new Path(); path.moveTo(rigidpoints.getPoints().get(0).x, rigidpoints.getPoints().get(0).y); //join lines for (int j = 1; j < rigidpoints.size(); j++) { path.lineTo(rigidpoints.getPoints().get(j).x, rigidpoints.getPoints().get(j).y); //join lines } c.drawPath(path, paint);//draw points }
Example 5
Source File: CloudSunView.java From MaterialCalendar with Apache License 2.0 | 6 votes |
private void init() { // initialize default values degrees = 0; count = 0; startAngle = 45; sweepAngle = 165; isAnimated = true; paint = new Paint(); paint.setColor(strokeColor); paint.setStrokeWidth(10); paint.setAntiAlias(true); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStyle(Paint.Style.STROKE); paint.setShadowLayer(0, 0, 0, Color.BLACK); cloud = new Cloud(); }
Example 6
Source File: ENVolumeView.java From ENViews with Apache License 2.0 | 5 votes |
public ENVolumeView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.volume); int lineColor = ta.getColor(R.styleable.volume_volume_line_color, DEFAULT_LINE_COLOR); int lineWidth = ta.getInteger(R.styleable.volume_volume_line_width, DEFAULT_LINE_WIDTH); int bgLineColor = ta.getInteger(R.styleable.volume_volume_bg_line_color, DEFAULT_BG_LINE_COLOR); int bgLineWidth = ta.getInteger(R.styleable.volume_volume_bg_line_width, DEFAULT_BG_LINE_WIDTH); ta.recycle(); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setColor(lineColor); mPaint.setStrokeWidth(lineWidth); mBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBgPaint.setStyle(Paint.Style.STROKE); mBgPaint.setStrokeCap(Paint.Cap.ROUND); mBgPaint.setStrokeJoin(Paint.Join.ROUND); mBgPaint.setColor(bgLineColor); mBgPaint.setStrokeWidth(bgLineWidth); mPath = new Path(); mDstPath = new Path(); mPathMeasure = new PathMeasure(); }
Example 7
Source File: OC_Hw.java From GLEXP-Team-onebillion with Apache License 2.0 | 5 votes |
public void preparePaintForDrawing() { drawingPaint = new Paint(); drawingPaint.setStyle(Paint.Style.STROKE); drawingPaint.setStrokeWidth(drawPathWidth()); drawingPaint.setColor(Color.WHITE); drawingPaint.setStrokeJoin(Paint.Join.ROUND); drawingPaint.setStrokeCap(Paint.Cap.ROUND); drawingPaint.setAntiAlias(true); drawingPaint.setDither(true); }
Example 8
Source File: StepArcView.java From LLApp with Apache License 2.0 | 5 votes |
/** * 2.绘制当前步数的红色圆弧 */ private void drawArcRed(Canvas canvas, RectF rectF) { Paint paintCurrent = new Paint(); paintCurrent.setStrokeJoin(Paint.Join.ROUND); paintCurrent.setStrokeCap(Paint.Cap.ROUND);//圆角弧度 paintCurrent.setStyle(Paint.Style.STROKE);//设置填充样式 paintCurrent.setAntiAlias(true);//抗锯齿功能 paintCurrent.setStrokeWidth(borderWidth);//设置画笔宽度 paintCurrent.setColor(getResources().getColor(R.color.red));//设置画笔颜色 canvas.drawArc(rectF, startAngle, currentAngleLength, false, paintCurrent); }
Example 9
Source File: LinearProgressDrawable.java From MDPreference with Apache License 2.0 | 5 votes |
private LinearProgressDrawable(float progressPercent, float secondaryProgressPercent, int maxLineWidth, float maxLineWidthPercent, int minLineWidth, float minLineWidthPercent, int strokeSize, int verticalAlign, int[] strokeColors, int strokeSecondaryColor, boolean reverse, int travelDuration, int transformDuration, int keepDuration, Interpolator transformInterpolator, int progressMode, int inAnimDuration, int outAnimDuration){ setProgress(progressPercent); setSecondaryProgress(secondaryProgressPercent); mMaxLineWidth = maxLineWidth; mMaxLineWidthPercent = maxLineWidthPercent; mMinLineWidth = minLineWidth; mMinLineWidthPercent = minLineWidthPercent; mStrokeSize = strokeSize; mVerticalAlign = verticalAlign; mStrokeColors = strokeColors; mStrokeSecondaryColor = strokeSecondaryColor; mReverse = reverse; mTravelDuration = travelDuration; mTransformDuration = transformDuration; mKeepDuration = keepDuration; mTransformInterpolator = transformInterpolator; mProgressMode = progressMode; mInAnimationDuration = inAnimDuration; mOutAnimationDuration = outAnimDuration; mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeJoin(Paint.Join.ROUND); mPath = new Path(); }
Example 10
Source File: DrawCustomView.java From zulip-android with Apache License 2.0 | 5 votes |
private void init() { currentBrushSize = getResources().getInteger(R.integer.brush_medium_size); paintColor = ContextCompat.getColor(getContext(), R.color.red_marker_tool); drawPath = new Path(); drawPaint = new Paint(); drawPaint.setColor(paintColor); drawPaint.setAntiAlias(true); drawPaint.setStrokeWidth(currentBrushSize); drawPaint.setStyle(Paint.Style.STROKE); drawPaint.setStrokeJoin(Paint.Join.ROUND); drawPaint.setStrokeCap(Paint.Cap.ROUND); canvasPaint = new Paint(Paint.DITHER_FLAG); }
Example 11
Source File: ActivityPaint.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
void setPaintColor() { paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setColor(paintColor); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeWidth(brushSize); }
Example 12
Source File: Config.java From LockDemo with Apache License 2.0 | 5 votes |
public static Paint createPaint() { final Paint paint = new Paint(); paint.setDither(true); paint.setAntiAlias(true); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); return paint; }
Example 13
Source File: SnakeCircleBuilder.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
/** * 初始化画笔 */ private void initPaint(float lineWidth) { mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mStrokePaint.setStyle(Paint.Style.STROKE); mStrokePaint.setStrokeWidth(lineWidth); mStrokePaint.setColor(Color.WHITE); mStrokePaint.setDither(true); mStrokePaint.setFilterBitmap(true); mStrokePaint.setStrokeCap(Paint.Cap.ROUND); mStrokePaint.setStrokeJoin(Paint.Join.ROUND); }
Example 14
Source File: DoubleCircleBuilder.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
/** * 初始化画笔 */ private void initPaint(float lineWidth) { mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mStrokePaint.setStyle(Paint.Style.STROKE); mStrokePaint.setStrokeWidth(lineWidth); mStrokePaint.setColor(Color.WHITE); mStrokePaint.setDither(true); mStrokePaint.setFilterBitmap(true); mStrokePaint.setStrokeCap(Paint.Cap.ROUND); mStrokePaint.setStrokeJoin(Paint.Join.ROUND); }
Example 15
Source File: SingleCircleBuilder.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
/** * 初始化画笔 */ private void initPaint(float lineWidth) { mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mStrokePaint.setStyle(Paint.Style.STROKE); mStrokePaint.setStrokeWidth(lineWidth); mStrokePaint.setColor(Color.WHITE); mStrokePaint.setDither(true); mStrokePaint.setFilterBitmap(true); mStrokePaint.setStrokeCap(Paint.Cap.ROUND); mStrokePaint.setStrokeJoin(Paint.Join.ROUND); }
Example 16
Source File: VoronoiView.java From Vorolay with Apache License 2.0 | 5 votes |
private void initPaint() { p = new Paint(); p.setAntiAlias(true); p.setColor(mBorderColor); p.setStrokeWidth(mBorderWidth); p.setStyle(Paint.Style.STROKE); if (mRoundCornersEnabled) { p.setStrokeJoin(Paint.Join.ROUND); p.setStrokeCap(Paint.Cap.SQUARE); p.setPathEffect(new CornerPathEffect(15)); } }
Example 17
Source File: DrawingView.java From DrawingView-Android with MIT License | 5 votes |
private void init() { path = new Path(); bitmapPaint = new Paint(Paint.DITHER_FLAG); paint = new Paint(); paint.setAntiAlias(true); paint.setDither(true); paint.setColor(Color.BLACK); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setStrokeWidth(penSize); drawMode = true; paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN)); }
Example 18
Source File: LanesStyleKit.java From graphhopper-navigation-android with MIT License | 4 votes |
public static void drawLaneSlightRight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) { // General Declarations Stack<Matrix> currentTransformation = new Stack<Matrix>(); currentTransformation.push(new Matrix()); Paint paint = CacheForLaneSlightRight.paint; // Local Variables float expression = Math.min(size.x / 30f, size.y / 30f); // Resize to Target Frame canvas.save(); RectF resizedFrame = CacheForLaneSlightRight.resizedFrame; LanesStyleKit.resizingBehaviorApply(resizing, CacheForLaneSlightRight.originalFrame, targetFrame, resizedFrame); canvas.translate(resizedFrame.left, resizedFrame.top); canvas.scale(resizedFrame.width() / 30f, resizedFrame.height() / 30f); // Frame RectF frame = CacheForLaneSlightRight.frame; frame.set(0f, 0f, size.x, size.y); // Group { canvas.save(); canvas.translate(9.28f, -0.86f); currentTransformation.peek().postTranslate(9.28f, -0.86f); canvas.scale(expression, expression); currentTransformation.peek().postScale(expression, expression); // Bezier 3 RectF bezier3Rect = CacheForLaneSlightRight.bezier3Rect; bezier3Rect.set(0f, 10.61f, 7.17f, 27.6f); Path bezier3Path = CacheForLaneSlightRight.bezier3Path; bezier3Path.reset(); bezier3Path.moveTo(7.17f, 10.61f); bezier3Path.lineTo(1.47f, 15.89f); bezier3Path.cubicTo(0.6f, 17.21f, 0f, 18.82f, 0f, 20.47f); bezier3Path.lineTo(0f, 27.6f); paint.reset(); paint.setFlags(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth(4f); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeMiter(10f); canvas.save(); paint.setStyle(Paint.Style.STROKE); paint.setColor(primaryColor); canvas.drawPath(bezier3Path, paint); canvas.restore(); // Bezier canvas.save(); canvas.translate(10.25f, 0f); currentTransformation.peek().postTranslate(10.25f, 0f); canvas.rotate(49f); currentTransformation.peek().postRotate(49f); RectF bezierRect = CacheForLaneSlightRight.bezierRect; bezierRect.set(0f, 0f, 12.02f, 9.99f); Path bezierPath = CacheForLaneSlightRight.bezierPath; bezierPath.reset(); bezierPath.moveTo(4.01f, 9.92f); bezierPath.lineTo(4.02f, 8.66f); bezierPath.lineTo(4.01f, 8.66f); bezierPath.cubicTo(4.01f, 8.6f, 4.01f, 8.53f, 4.01f, 8.46f); bezierPath.cubicTo(4.01f, 8.17f, 3.82f, 7.94f, 3.53f, 7.94f); bezierPath.cubicTo(3.5f, 7.94f, 3.46f, 7.94f, 3.43f, 7.94f); bezierPath.lineTo(3.44f, 7.94f); bezierPath.lineTo(0.71f, 8.93f); bezierPath.lineTo(0.71f, 8.93f); bezierPath.cubicTo(0.65f, 8.96f, 0.58f, 8.97f, 0.52f, 8.97f); bezierPath.cubicTo(0.23f, 8.97f, 0f, 8.74f, 0f, 8.45f); bezierPath.cubicTo(0f, 8.3f, 0.06f, 8.17f, 0.16f, 8.07f); bezierPath.lineTo(0.16f, 8.08f); bezierPath.lineTo(6.02f, 0f); bezierPath.lineTo(11.86f, 8.14f); bezierPath.lineTo(11.86f, 8.14f); bezierPath.cubicTo(11.96f, 8.23f, 12.02f, 8.37f, 12.02f, 8.52f); bezierPath.cubicTo(12.02f, 8.8f, 11.79f, 9.03f, 11.5f, 9.03f); bezierPath.cubicTo(11.43f, 9.03f, 11.37f, 9.02f, 11.31f, 8.99f); bezierPath.lineTo(11.31f, 8.99f); bezierPath.lineTo(8.58f, 8f); bezierPath.lineTo(8.59f, 8.01f); bezierPath.cubicTo(8.56f, 8f, 8.52f, 8f, 8.49f, 8f); bezierPath.cubicTo(8.2f, 8f, 8.01f, 8.23f, 8.01f, 8.53f); bezierPath.cubicTo(8.01f, 8.59f, 8f, 8.66f, 8f, 8.73f); bezierPath.lineTo(8f, 8.72f); bezierPath.lineTo(8.01f, 9.99f); paint.reset(); paint.setFlags(Paint.ANTI_ALIAS_FLAG); bezierPath.setFillType(Path.FillType.EVEN_ODD); paint.setStyle(Paint.Style.FILL); paint.setColor(primaryColor); canvas.drawPath(bezierPath, paint); canvas.restore(); canvas.restore(); } canvas.restore(); }
Example 19
Source File: CircularSeekBar.java From Melophile with Apache License 2.0 | 4 votes |
/** * Initializes the {@code Paint} objects with the appropriate styles. */ private 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); }
Example 20
Source File: PuzzleView.java From EasyPhotos with Apache License 2.0 | 4 votes |
private void init(Context context, AttributeSet attrs) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PuzzleView); lineSize = ta.getInt(R.styleable.PuzzleView_easy_line_size, 4); lineColor = ta.getColor(R.styleable.PuzzleView_easy_line_color, ContextCompat.getColor(getContext(), R.color.easy_photos_fg_primary)); selectedLineColor = ta.getColor(R.styleable.PuzzleView_easy_selected_line_color, ContextCompat.getColor(getContext(), R.color.easy_photos_fg_accent)); handleBarColor = ta.getColor(R.styleable.PuzzleView_easy_handle_bar_color, ContextCompat.getColor(getContext(), R.color.easy_photos_fg_accent)); piecePadding = ta.getDimensionPixelSize(R.styleable.PuzzleView_easy_piece_padding, 0); needDrawLine = ta.getBoolean(R.styleable.PuzzleView_easy_need_draw_line, false); needDrawOuterLine = ta.getBoolean(R.styleable.PuzzleView_easy_need_draw_outer_line, false); duration = ta.getInt(R.styleable.PuzzleView_easy_animation_duration, 300); pieceRadian = ta.getFloat(R.styleable.PuzzleView_easy_radian, 0f); ta.recycle(); bounds = new RectF(); // init some paint linePaint = new Paint(); linePaint.setAntiAlias(true); linePaint.setColor(lineColor); linePaint.setStrokeWidth(lineSize); linePaint.setStyle(Paint.Style.STROKE); linePaint.setStrokeJoin(Paint.Join.ROUND); linePaint.setStrokeCap(Paint.Cap.SQUARE); selectedAreaPaint = new Paint(); selectedAreaPaint.setAntiAlias(true); selectedAreaPaint.setStyle(Paint.Style.STROKE); selectedAreaPaint.setStrokeJoin(Paint.Join.ROUND); selectedAreaPaint.setStrokeCap(Paint.Cap.ROUND); selectedAreaPaint.setColor(selectedLineColor); selectedAreaPaint.setStrokeWidth(lineSize); handleBarPaint = new Paint(); handleBarPaint.setAntiAlias(true); handleBarPaint.setStyle(Paint.Style.FILL); handleBarPaint.setColor(handleBarColor); handleBarPaint.setStrokeWidth(lineSize * 3); midPoint = new PointF(); }