Java Code Examples for android.text.TextPaint.setStrokeMiter()

The following are Jave code examples for showing how to use setStrokeMiter() of the android.text.TextPaint class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Raffler-Android   File: CustomTextView.java   Source Code and License Vote up 6 votes
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    int restoreColor = this.getCurrentTextColor();
    if (strokeColor != null) {
        TextPaint paint = this.getPaint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeJoin(strokeJoin);
        paint.setStrokeMiter(strokeMiter);
        this.setTextColor(strokeColor);
        paint.setStrokeWidth(strokeWidth);
        super.onDraw(canvas);
        paint.setStyle(Paint.Style.FILL);
        this.setTextColor(restoreColor);
    }
}
 
Example 2
Project: aos-Video   File: SubtitleTextView.java   Source Code and License Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
    Canvas c = canvas;
    if (mExternalSurface != null) {
        try {
            canvas.getClipBounds(r);
            getLocationOnScreen(location);
            r.offsetTo(location[0],location[1]);
            c = mExternalSurface.lockCanvas(null);
            c.save();
            c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
            c.clipRect(r);
            c.translate(location[0],location[1]);
        } catch (Exception ignored) {
        }
    }
    TextPaint paint = getPaint();
    int color = getCurrentTextColor();
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.MITER);
    paint.setStrokeMiter(1.0f);
    paint.setStrokeWidth(4.0f);
    setTextColor(Color.BLACK);
    super.onDraw(c);
    paint.setStyle(Paint.Style.FILL);
    setTextColor(color);
    super.onDraw(c);
    if (c != canvas) {
        c.restore();
        mExternalSurface.unlockCanvasAndPost(c);
    }
}