Example usage for android.graphics CornerPathEffect CornerPathEffect

List of usage examples for android.graphics CornerPathEffect CornerPathEffect

Introduction

In this page you can find the example usage for android.graphics CornerPathEffect CornerPathEffect.

Prototype

public CornerPathEffect(float radius) 

Source Link

Document

Transforms geometries that are drawn (either STROKE or FILL styles) by replacing any sharp angles between line segments into rounded angles of the specified radius.

Usage

From source file:de.hs_bremen.aurora_hunter.ui.views.KpIndexChartView.java

public KpIndexChartView(Context context, AttributeSet attributeSet) {
    super(context, attributeSet);
    setFocusable(true);/*from ww w  .  j ava2  s .  co  m*/
    setFocusableInTouchMode(true);

    setOnTouchListener(this);

    int colorBg = ContextCompat.getColor(getContext(), R.color.colorBackgroundChart);
    int colorFg = ContextCompat.getColor(getContext(), R.color.colorKPChart);

    mGraphPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    //mGraphPaint.setStyle(Paint.Style.STROKE);
    mGraphPaint.setStrokeWidth(STROKE_WIDTH);
    mGraphPaint.setColor(colorBg);
    mGraphPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    //mGraphPaint.setShader(new LinearGradient(0, 0, 0, getHeight(), colorFg, colorBg, Shader.TileMode.MIRROR));

    mGraphPaint.setDither(true); // set the dither to true
    mGraphPaint.setStrokeJoin(Paint.Join.ROUND); // set the join to round you want
    mGraphPaint.setStrokeCap(Paint.Cap.ROUND); // set the mGraphPaint cap to round too
    mGraphPaint.setAntiAlias(true);
    mGraphPaint.setAlpha(100);

    paintG1Line.setStrokeWidth(1f);
    paintG1Line.setColor(Color.BLACK);
    paintG1Line.setStyle(Paint.Style.STROKE);
    paintG1Line.setDither(true); // set the dither to true
    paintG1Line.setAntiAlias(true);
    paintG1Line.setAlpha(100);

    paintTxt.setStrokeWidth(10f);
    paintTxt.setDither(true); // set the dither to true
    paintTxt.setStrokeJoin(Paint.Join.ROUND); // set the join to round you want
    paintTxt.setStrokeCap(Paint.Cap.ROUND); // set the mGraphPaint cap to round too
    paintTxt.setPathEffect(new CornerPathEffect(10)); // set the path effect when they join.
    paintTxt.setAntiAlias(true);
    paintTxt.setColor(Color.BLACK);
    paintTxt.setTextSize(20);
    paintTxt.setFakeBoldText(true);
    paintTxt.setAlpha(150);

}

From source file:de.hs_bremen.aurora_hunter.ui.views.PredictionGraphView.java

public PredictionGraphView(Context pContext, AttributeSet pAttributeSet) {
    super(pContext, pAttributeSet);

    setFocusable(true);//from w  w w  .  ja  va2s  .co  m
    setFocusableInTouchMode(true);
    setOnTouchListener(this);

    int color = ContextCompat.getColor(getContext(), R.color.colorAccent);
    mNotificationLevelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mNotificationLevelPaint.setColor(color);

    mNotificationLevelTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mNotificationLevelTextPaint.setTextAlign(Paint.Align.LEFT);
    mNotificationLevelTextPaint.setTextSize(80);
    mNotificationLevelTextPaint.setColor(color);

    mGraphPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    //mGraphPaint.setStyle(Paint.Style.STROKE);
    mGraphPaint.setStrokeWidth(STROKE_WIDTH);
    mGraphPaint.setColor(Color.BLACK);
    mGraphPaint.setStyle(Paint.Style.FILL);

    mGraphPaint.setDither(true);
    mGraphPaint.setStrokeJoin(Paint.Join.ROUND);
    mGraphPaint.setStrokeCap(Paint.Cap.ROUND);
    mGraphPaint.setAntiAlias(true);
    mGraphPaint.setAlpha(220);

    mTextPaint.setStrokeWidth(10f);
    mTextPaint.setDither(true);
    mTextPaint.setStrokeJoin(Paint.Join.ROUND);
    mTextPaint.setStrokeCap(Paint.Cap.ROUND);
    mTextPaint.setPathEffect(new CornerPathEffect(10));
    mTextPaint.setAntiAlias(true);
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setTextSize(30);
    mTextPaint.setFakeBoldText(true);
    mTextPaint.setAlpha(220);
}

From source file:com.umeng.common.ui.widgets.ViewPagerIndicator.java

public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    // ?//from ww  w .  ja v a  2  s  .com
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

    mLinePaint = new Paint();
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mLinePaint.setStyle(Style.FILL);
    mLinePaint.setStrokeWidth(10);

    mDividerLinePaint = new Paint();
    mDividerLinePaint.setAntiAlias(true);
    mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mDividerLinePaint.setStyle(Style.FILL);
    mDividerLinePaint.setStrokeWidth(5);

    COLOR_TEXT_NORMAL = ColorQueque.getColor("umeng_comm_indicator_default");
    COLOR_TEXT_HIGHLIGHTCOLOR = ColorQueque.getColor("umeng_comm_indicator_highlight");
}

From source file:com.umeng.comm.ui.imagepicker.widgets.ViewPagerIndicator.java

public ViewPagerIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    // ?// w ww .  ja  v a  2s.c  o  m
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mPaint.setStyle(Style.FILL);
    mPaint.setPathEffect(new CornerPathEffect(3));

    mLinePaint = new Paint();
    mLinePaint.setAntiAlias(true);
    mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mLinePaint.setStyle(Style.FILL);
    mLinePaint.setStrokeWidth(10);

    mDividerLinePaint = new Paint();
    mDividerLinePaint.setAntiAlias(true);
    mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
    mDividerLinePaint.setStyle(Style.FILL);
    mDividerLinePaint.setStrokeWidth(5);
}

From source file:jp.co.recruit_lifestyle.android.widget.ColoringLoadingView.java

private void initPaint() {
    mCharacterPaint = new Paint();
    mCharacterPaint.setColor(Color.BLACK);
    mCharacterPaint.setStyle(Paint.Style.STROKE);
    mCharacterPaint.setStrokeWidth(20);/*from w  w  w  .j  av  a 2  s  .c  om*/
    mCharacterPaint.setStrokeCap(Paint.Cap.ROUND);
    mCharacterPaint.setPathEffect(new CornerPathEffect(10));
    mCharacterPaint.setAntiAlias(true);

    mLoadingPaint = new Paint();
    mLoadingPaint.setColor(Color.BLACK);
    mLoadingPaint.setStrokeWidth(10);
    mLoadingPaint.setStyle(Paint.Style.STROKE);
    mLoadingPaint.setStrokeCap(Paint.Cap.ROUND);
    mLoadingPaint.setPathEffect(new CornerPathEffect(10));
    mLoadingPaint.setAntiAlias(true);

    mPencilPaint = new Paint();
    mPencilPaint.setStyle(Paint.Style.FILL);
    mPencilPaint.setColor(Color.BLACK);
    mPencilPaint.setAntiAlias(true);

    mColoringPaint = new Paint();
    mColoringPaint.setStyle(Paint.Style.STROKE);
    mColoringPaint.setStrokeWidth(30);
    mColoringPaint.setStrokeCap(Paint.Cap.ROUND);
    mColoringPaint.setAntiAlias(true);
    mColoringPaint.setColor(0xffF8C92C);

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setStyle(Paint.Style.FILL);
    mBackgroundPaint.setAntiAlias(true);
    mBackgroundPaint.setColor(Color.WHITE);

    mShadowPaint = new Paint();
    mShadowPaint.setStyle(Paint.Style.FILL);
    mShadowPaint.setColor(0x70000000);
    mShadowPaint.setMaskFilter(new BlurMaskFilter(16, BlurMaskFilter.Blur.NORMAL));

}

From source file:ee.ioc.phon.android.speak.Utils.java

static Bitmap bytesToBitmap(byte[] byteBuffer, int w, int h, int startPosition, int endPosition) {
    final ShortBuffer waveBuffer = ByteBuffer.wrap(byteBuffer).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer();
    final Bitmap b = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
    final Canvas c = new Canvas(b);
    final Paint paint = new Paint();
    paint.setColor(0xFFFFFFFF); // 0xAARRGGBB
    paint.setAntiAlias(true);/*www  .  ja  va2  s  .co  m*/
    paint.setStyle(Paint.Style.STROKE);
    paint.setAlpha(80);

    final PathEffect effect = new CornerPathEffect(3);
    paint.setPathEffect(effect);

    final int numSamples = waveBuffer.remaining();
    int endIndex;
    if (endPosition == 0) {
        endIndex = numSamples;
    } else {
        endIndex = Math.min(endPosition, numSamples);
    }

    int startIndex = startPosition - 2000; // include 250ms before speech
    if (startIndex < 0) {
        startIndex = 0;
    }
    final int numSamplePerWave = 200; // 8KHz 25ms = 200 samples
    final float scale = 10.0f / 65536.0f;

    final int count = (endIndex - startIndex) / numSamplePerWave;
    final float deltaX = 1.0f * w / count;
    int yMax = h / 2;
    Path path = new Path();
    c.translate(0, yMax);
    float x = 0;
    path.moveTo(x, 0);
    for (int i = 0; i < count; i++) {
        final int avabs = getAverageAbs(waveBuffer, startIndex, i, numSamplePerWave);
        int sign = ((i & 01) == 0) ? -1 : 1;
        final float y = Math.min(yMax, avabs * h * scale) * sign;
        path.lineTo(x, y);
        x += deltaX;
        path.lineTo(x, y);
    }
    if (deltaX > 4) {
        paint.setStrokeWidth(2);
    } else {
        paint.setStrokeWidth(Math.max(0, (int) (deltaX - .05)));
    }
    c.drawPath(path, paint);
    return b;
}

From source file:com.example.SmartBoard.DrawingView.java

private void setupDrawing() {
    //get drawing area setup for interaction
    drawPath = new Path();
    drawPathRecv = new Path();
    drawPaint = new Paint();
    drawPaint.setDither(true);/*from w ww . j  a  v  a2  s  .  c  o m*/
    drawPaint.setPathEffect(new CornerPathEffect(10));
    drawPaint.setColor(paintColor);
    drawPaint.setAntiAlias(true);
    drawPaint.setStrokeWidth(strokeWidth);
    drawPaint.setStyle(Paint.Style.STROKE);
    drawPaint.setStrokeJoin(Paint.Join.ROUND);
    drawPaint.setStrokeCap(Paint.Cap.ROUND);
    canvasPaint = new Paint(Paint.DITHER_FLAG);

    drawPaintSender = new Paint();
    drawPaintSender.setDither(true);
    drawPaintSender.setPathEffect(new CornerPathEffect(10));
    drawPaintSender.setColor(paintColor);
    drawPaintSender.setAntiAlias(true);
    drawPaintSender.setStrokeWidth(strokeWidth);
    drawPaintSender.setStyle(Paint.Style.STROKE);
    drawPaintSender.setStrokeJoin(Paint.Join.ROUND);
    drawPaintSender.setStrokeCap(Paint.Cap.ROUND);
    client = MQTTHandler.getInstance().getClientHandle();
}

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Activities.MapScreen.MapScreen.java

private void setupWayOverlay() {
    Path p = new Path();
    p.moveTo(4.f, 0.f);/*ww  w .ja  v  a  2  s .  c  o m*/
    p.lineTo(0.f, -4.f);
    p.lineTo(8.f, -4.f);
    p.lineTo(12.f, 0.f);
    p.lineTo(8.f, 4.f);
    p.lineTo(0.f, 4.f);

    Paint fastWayOverlayColor = new Paint(Paint.ANTI_ALIAS_FLAG);
    fastWayOverlayColor.setStyle(Paint.Style.STROKE);
    fastWayOverlayColor.setColor(Color.BLUE);
    fastWayOverlayColor.setAlpha(160);
    fastWayOverlayColor.setStrokeWidth(5.f);
    fastWayOverlayColor.setStrokeJoin(Paint.Join.ROUND);
    fastWayOverlayColor.setPathEffect(new ComposePathEffect(
            new PathDashPathEffect(p, 12.f, 0.f, PathDashPathEffect.Style.ROTATE), new CornerPathEffect(30.f)));

    // create the WayOverlay and add the ways
    this.fastWayOverlay = new FastWayOverlay(session, fastWayOverlayColor);
    mapView.getOverlays().add(this.fastWayOverlay);
    Result result = session.getResult();
    if (result != null) {
        addPathToMap(result.getWay());
    }
}