Java Code Examples for android.graphics.Path#setFillType()

The following examples show how to use android.graphics.Path#setFillType() . 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: SVGAndroidRenderer.java    From XDroidAnimation with Apache License 2.0 6 votes vote down vote up
private Path makePathAndBoundingBox(SVG.PolyLine obj)
{
   Path  path = new Path();

   path.moveTo(obj.points[0], obj.points[1]);
   for (int i=2; i<obj.points.length; i+=2) {
      path.lineTo(obj.points[i], obj.points[i+1]);
   }
   if (obj instanceof SVG.Polygon)
      path.close();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }

   path.setFillType(getClipRuleFromState());
   return path;
}
 
Example 2
Source File: BookmarkUtils.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Use touch-icon or higher-resolution favicon and round the corners.
 * @param context    Context used to get resources.
 * @param touchIcon  Touch icon bitmap.
 * @param canvas     Canvas that holds the touch icon.
 */
private static void drawTouchIconToCanvas(
        Context context, Bitmap touchIcon, Canvas canvas) {
    Rect iconBounds = new Rect(0, 0, canvas.getWidth(), canvas.getHeight());
    Rect src = new Rect(0, 0, touchIcon.getWidth(), touchIcon.getHeight());
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setFilterBitmap(true);
    canvas.drawBitmap(touchIcon, src, iconBounds, paint);
    // Convert dp to px.
    int borderRadii = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            TOUCHICON_BORDER_RADII, context.getResources().getDisplayMetrics());
    Path path = new Path();
    path.setFillType(Path.FillType.INVERSE_WINDING);
    RectF rect = new RectF(iconBounds);
    rect.inset(INSET_DIMENSION_FOR_TOUCHICON, INSET_DIMENSION_FOR_TOUCHICON);
    path.addRoundRect(rect, borderRadii, borderRadii, Path.Direction.CW);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    canvas.drawPath(path, paint);
}
 
Example 3
Source File: BookmarkUtils.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Use touch-icon or higher-resolution favicon and round the corners.
 * @param context    Context used to get resources.
 * @param touchIcon  Touch icon bitmap.
 * @param canvas     Canvas that holds the touch icon.
 */
private static void drawTouchIconToCanvas(
        Context context, Bitmap touchIcon, Canvas canvas) {
    Rect iconBounds = new Rect(0, 0, canvas.getWidth(), canvas.getHeight());
    Rect src = new Rect(0, 0, touchIcon.getWidth(), touchIcon.getHeight());
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setFilterBitmap(true);
    canvas.drawBitmap(touchIcon, src, iconBounds, paint);
    // Convert dp to px.
    int borderRadii = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            TOUCHICON_BORDER_RADII, context.getResources().getDisplayMetrics());
    Path path = new Path();
    path.setFillType(Path.FillType.INVERSE_WINDING);
    RectF rect = new RectF(iconBounds);
    rect.inset(INSET_DIMENSION_FOR_TOUCHICON, INSET_DIMENSION_FOR_TOUCHICON);
    path.addRoundRect(rect, borderRadii, borderRadii, Path.Direction.CW);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    canvas.drawPath(path, paint);
}
 
Example 4
Source File: SVGAndroidRenderer.java    From microMathematics with GNU General Public License v3.0 6 votes vote down vote up
private void addObjectToClip(SVG.Path obj, Path combinedPath, Matrix combinedPathMatrix)
{
   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;

   if (obj.transform != null)
      combinedPathMatrix.preConcat(obj.transform);

   Path  path = (new PathConverter(obj.d)).getPath();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }
   checkForClipPath(obj);

   //path.setFillType(getClipRuleFromState());
   combinedPath.setFillType(getClipRuleFromState());
   combinedPath.addPath(path, combinedPathMatrix);
}
 
Example 5
Source File: CardShadowDrawable.java    From litho with Apache License 2.0 6 votes vote down vote up
private static void setPath(Path path, int shadowX, int shadowY, float cornerRadius) {

    final RectF innerBounds =
        new RectF(shadowX, shadowY, shadowX + 2 * cornerRadius, shadowY + 2 * cornerRadius);

    final RectF outerBounds = new RectF(0, 0, 2 * cornerRadius, 2 * cornerRadius);

    path.reset();
    path.setFillType(Path.FillType.EVEN_ODD);
    path.moveTo(shadowX + cornerRadius, shadowY);
    path.arcTo(innerBounds, 270f, -90f, true);
    path.rLineTo(-shadowX, 0);
    path.lineTo(0, cornerRadius);
    path.arcTo(outerBounds, 180f, 90f, true);
    path.lineTo(shadowX + cornerRadius, 0);
    path.rLineTo(0, shadowY);
    path.close();
  }
 
Example 6
Source File: SVGAndroidRenderer.java    From XDroidAnimation with Apache License 2.0 6 votes vote down vote up
private void addObjectToClip(SVG.Path obj, Path combinedPath, Matrix combinedPathMatrix)
{
   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;

   if (obj.transform != null)
      combinedPathMatrix.preConcat(obj.transform);

   Path  path = (new PathConverter(obj.d)).getPath();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }
   checkForClipPath(obj);

   //path.setFillType(getClipRuleFromState());
   combinedPath.setFillType(getClipRuleFromState());
   combinedPath.addPath(path, combinedPathMatrix);
}
 
Example 7
Source File: YLVerticalGraphicLabelView.java    From Android-YLScrollView with MIT License 6 votes vote down vote up
private void drawTopLine(Canvas canvas, Paint paint) {
        paint.setStrokeWidth(STROKE_WIDTH);
//        paint.setPathEffect(null);
        paint.setStyle(Paint.Style.STROKE);

        float point_y_s = getMeasuredHeight() * (1 - LENGTH_RATIO) / 2;
        float point_y_e = getMeasuredHeight() / 2 - 2 * MID_POINT_RADIUS;

        Path path = new Path();
        path.setFillType(Path.FillType.EVEN_ODD);

        path.moveTo(getMeasuredWidth() / 2, point_y_s);
        path.lineTo(getMeasuredWidth() / 2, point_y_e);

        canvas.drawPath(path, paint);

        drawArrow(canvas, paint, true, getMeasuredWidth() / 2, point_y_s);
    }
 
Example 8
Source File: SVGAndroidRenderer.java    From starcor.xul with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addObjectToClip(SVG.Path obj, Path combinedPath, Matrix combinedPathMatrix)
{
   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;

   if (obj.transform != null)
      combinedPathMatrix.preConcat(obj.transform);

   Path  path = (new PathConverter(obj.d)).getPath();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }
   checkForClipPath(obj);

   //path.setFillType(getClipRuleFromState());
   combinedPath.setFillType(getClipRuleFromState());
   combinedPath.addPath(path, combinedPathMatrix);
}
 
Example 9
Source File: MaterialSpinner.java    From XERUNG with Apache License 2.0 6 votes vote down vote up
private void initPaintObjects() {

        int labelTextSize = getResources().getDimensionPixelSize(R.dimen.label_text_size);

        paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        textPaint.setTextSize(labelTextSize);
        if (typeface != null) {
            textPaint.setTypeface(typeface);
        }
        textPaint.setColor(baseColor);
        baseAlpha = textPaint.getAlpha();

        selectorPath = new Path();
        selectorPath.setFillType(Path.FillType.EVEN_ODD);

        selectorPoints = new Point[3];
        for (int i = 0; i < 3; i++) {
            selectorPoints[i] = new Point();
        }
    }
 
Example 10
Source File: SVGAndroidRenderer.java    From XDroidAnimation with Apache License 2.0 5 votes vote down vote up
private void addObjectToClip(SVG.Text obj, Path combinedPath, Matrix combinedPathMatrix)
{
   updateStyleForElement(state, obj);

   if (!display())
      return;

   if (obj.transform != null)
      combinedPathMatrix.preConcat(obj.transform);

   // Get the first coordinate pair from the lists in the x and y properties.
   float  x = (obj.x == null || obj.x.size() == 0) ? 0f : obj.x.get(0).floatValueX(this);
   float  y = (obj.y == null || obj.y.size() == 0) ? 0f : obj.y.get(0).floatValueY(this);
   float  dx = (obj.dx == null || obj.dx.size() == 0) ? 0f : obj.dx.get(0).floatValueX(this);
   float  dy = (obj.dy == null || obj.dy.size() == 0) ? 0f : obj.dy.get(0).floatValueY(this);

   // Handle text alignment
   if (state.style.textAnchor != Style.TextAnchor.Start) {
      float  textWidth = calculateTextWidth(obj);
      if (state.style.textAnchor == Style.TextAnchor.Middle) {
         x -= (textWidth / 2);
      } else {
         x -= textWidth;  // 'End' (right justify)
      }
   }

   if (obj.boundingBox == null) {
      TextBoundsCalculator  proc = new TextBoundsCalculator(x, y);
      enumerateTextSpans(obj, proc);
      obj.boundingBox = new Box(proc.bbox.left, proc.bbox.top, proc.bbox.width(), proc.bbox.height());
   }
   checkForClipPath(obj);

   Path  textAsPath = new Path();
   enumerateTextSpans(obj, new PlainTextToPath(x + dx, y + dy, textAsPath));

   combinedPath.setFillType(getClipRuleFromState());
   combinedPath.addPath(textAsPath, combinedPathMatrix);
}
 
Example 11
Source File: TransformationDrawable.java    From HeadsUp with GNU General Public License v2.0 5 votes vote down vote up
protected TransformationDrawable(@NonNull float[][]... vertex) {
    mVertex = vertex;

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

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.WHITE);
    mPaint.setStyle(Paint.Style.FILL);
}
 
Example 12
Source File: BootstrapDrawableFactory.java    From Android-Bootstrap with MIT License 5 votes vote down vote up
/**
 * Creates arrow icon that depends on ExpandDirection
 *
 * @param context context
 * @param width  width of icon in pixels
 * @param height height of icon in pixels
 * @param color arrow color
 * @param expandDirection arrow direction
 * @return icon drawable
 */
private static Drawable createArrowIcon(Context context, int width, int height, int color, ExpandDirection expandDirection) {
    Bitmap canvasBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(canvasBitmap);
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL_AND_STROKE);
    paint.setStrokeWidth(1);
    paint.setColor(color);
    paint.setAntiAlias(true);
    Path path = new Path();
    path.setFillType(Path.FillType.EVEN_ODD);
    switch (expandDirection) {
        case UP:
            path.moveTo(0, (height / 3) * 2);
            path.lineTo(width, (height / 3) * 2);
            path.lineTo(width / 2, height / 3);
            path.lineTo(0, (height / 3) * 2);
            break;
        case DOWN:
            path.moveTo(0, height / 3);
            path.lineTo(width, height / 3);
            path.lineTo(width / 2, (height / 3) * 2);
            path.lineTo(0, height / 3);
            break;
    }
    path.close();
    canvas.drawPath(path, paint);
    return new BitmapDrawable(context.getResources(), canvasBitmap);
}
 
Example 13
Source File: XYGraph.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 5 votes vote down vote up
public XYGraph(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mPaintLine = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintEdge = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraph = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaintGraphStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPathGraph = new Path();

    mPaintEdge.setStyle(Paint.Style.STROKE);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.XYGraph, defStyleAttr, 0);

    int accentColor = ViewUtils.getThemeAccentColor(getContext());
    mPaintLine.setColor(a.getColor(R.styleable.XYGraph_linecolor, accentColor));
    mPaintEdge.setColor(a.getColor(R.styleable.XYGraph_edgecolor, accentColor));
    mPaintEdge.setStrokeWidth(a.getDimension(R.styleable.XYGraph_edgestrokewidth,
            getResources().getDimension(R.dimen.xygraph_edge_stroke_width)));

    int graphColor = a.getColor(R.styleable.XYGraph_graphcolor, accentColor);

    mPaintGraphStroke.setColor(graphColor);
    mPaintGraphStroke.setStyle(Paint.Style.STROKE);
    mPaintGraphStroke.setStrokeWidth(a.getDimension(R.styleable.XYGraph_graphstrokewidth,
            getResources().getDimension(R.dimen.xygraph_graph_stroke_width)));

    graphColor = Color.argb(120, Color.red(graphColor), Color.green(graphColor), Color.blue(graphColor));

    mPaintGraph.setColor(graphColor);
    mPaintGraph.setStyle(Paint.Style.FILL);
    mPathGraph.setFillType(Path.FillType.EVEN_ODD);

    mEdgeVisible = a.getBoolean(R.styleable.XYGraph_edgevisibile, true);

    a.recycle();
}
 
Example 14
Source File: CompassView.java    From android with Apache License 2.0 5 votes vote down vote up
private void initArrows(int w, int h) {
    mArrowBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
    mArrowBitmap.eraseColor(Color.TRANSPARENT);
    Canvas arrowCanvas = new Canvas(mArrowBitmap);
    mArrowRotator = new Matrix();

    int hw = w / 2;
    int hh = h / 2;

    int t1 = (int) (w * 0.35);
    int t2 = (int) (w * 0.05);

    Point d = new Point(hw - t2, hh);
    Point e = new Point(hw + t2, hh);
    Point f = new Point(hw, hh - t1);
    Point g = new Point(hw, hh + t1);

    Path path = new Path();
    path.setFillType(Path.FillType.EVEN_ODD);
    path.moveTo(d.x, d.y);
    path.lineTo(e.x, e.y);
    path.lineTo(f.x, f.y);
    path.close();

    Path path2 = new Path();
    path2.setFillType(Path.FillType.EVEN_ODD);
    path2.moveTo(d.x, d.y);
    path2.lineTo(e.x, e.y);
    path2.lineTo(g.x, g.y);
    path2.close();

    arrowCanvas.drawPath(path, mCirclePaint);
    arrowCanvas.drawPath(path2, mWhiteArrowPaint);
    arrowCanvas.save();
}
 
Example 15
Source File: ArrowBubbleDrawable.java    From 365browser with Apache License 2.0 5 votes vote down vote up
public ArrowBubbleDrawable(Context context) {
    mRadiusPx = context.getResources().getDimensionPixelSize(R.dimen.text_bubble_corner_radius);
    mArrowWidthPx =
            context.getResources().getDimensionPixelSize(R.dimen.text_bubble_arrow_width);
    mArrowHeightPx =
            context.getResources().getDimensionPixelSize(R.dimen.text_bubble_arrow_height);

    // Set up the arrow path and paint for drawing.
    mArrowPath = new Path();
    mArrowPath.setFillType(Path.FillType.EVEN_ODD);
    mArrowPath.moveTo(-mArrowWidthPx / 2.f, mArrowHeightPx);
    mArrowPath.lineTo(0, 0);
    mArrowPath.lineTo(mArrowWidthPx / 2.f, mArrowHeightPx);
    mArrowPath.lineTo(-mArrowWidthPx / 2.f, mArrowHeightPx);
    mArrowPath.close();

    mArrowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mArrowPaint.setColor(Color.WHITE);
    mArrowPaint.setStyle(Paint.Style.FILL);

    mBubbleDrawable = new ShapeDrawable(
            new RoundRectShape(new float[] {mRadiusPx, mRadiusPx, mRadiusPx, mRadiusPx,
                    mRadiusPx, mRadiusPx, mRadiusPx, mRadiusPx},
                    null, null));

    mBubbleDrawable.setCallback(this);
}
 
Example 16
Source File: SVGAndroidRenderer.java    From XDroidAnimation with Apache License 2.0 5 votes vote down vote up
private void render(SVG.Path obj)
{
   debug("Path render");

   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;
   if (!state.hasStroke && !state.hasFill)
      return;

   if (obj.transform != null)
      canvas.concat(obj.transform);

   Path  path = (new PathConverter(obj.d)).getPath();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }
   updateParentBoundingBox(obj);

   checkForGradiantsAndPatterns(obj);      
   checkForClipPath(obj);
   
   boolean  compositing = pushLayer();

   if (state.hasFill) {
      path.setFillType(getFillTypeFromState());
      doFilledPath(obj, path);
   }
   if (state.hasStroke)
      doStroke(path);

   renderMarkers(obj);

   if (compositing)
      popLayer(obj);
}
 
Example 17
Source File: MainActivity.java    From Android-9-Development-Cookbook with MIT License 5 votes vote down vote up
@Override
public int onPostProcess(Canvas canvas) {
    Path path = new Path();
    path.setFillType(Path.FillType.INVERSE_EVEN_ODD);
    int width = canvas.getWidth();
    int height = canvas.getHeight();
    path.addCircle(width/2,height/2,600, Path.Direction.CW);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(Color.TRANSPARENT);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
    canvas.drawPath(path, paint);
    return PixelFormat.TRANSLUCENT;
}
 
Example 18
Source File: ShortcutHelper.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Adapts a website's icon (e.g. favicon or touch icon) to the Material design style guidelines
 * for home screen icons. This involves adding some padding and rounding the corners.
 *
 * @param context Context used to create the intent.
 * @param webIcon The website's favicon or touch icon.
 * @return Bitmap Either the touch-icon or the newly created favicon.
 */
@CalledByNative
public static Bitmap createHomeScreenIconFromWebIcon(Bitmap webIcon) {
    // getLauncherLargeIconSize() is just a guess at the launcher icon size, and is often
    // wrong -- the launcher can show icons at any size it pleases. Instead of resizing the
    // icon to the supposed launcher size and then having the launcher resize the icon again,
    // just leave the icon at its original size and let the launcher do a single rescaling.
    // Unless the icon is much too big; then scale it down here too.
    Context context = ContextUtils.getApplicationContext();
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    int maxInnerSize = Math.round(am.getLauncherLargeIconSize() * MAX_INNER_SIZE_RATIO);
    int innerSize = Math.min(maxInnerSize, Math.max(webIcon.getWidth(), webIcon.getHeight()));
    int padding = Math.round(ICON_PADDING_RATIO * innerSize);
    int outerSize = innerSize + 2 * padding;

    Bitmap bitmap = null;
    try {
        bitmap = Bitmap.createBitmap(outerSize, outerSize, Bitmap.Config.ARGB_8888);
    } catch (OutOfMemoryError e) {
        Log.w(TAG, "OutOfMemoryError while creating bitmap for home screen icon.");
        return webIcon;
    }

    // Draw the web icon with padding around it.
    Canvas canvas = new Canvas(bitmap);
    Rect innerBounds = new Rect(padding, padding, outerSize - padding, outerSize - padding);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setFilterBitmap(true);
    canvas.drawBitmap(webIcon, null, innerBounds, paint);

    // Round the corners.
    int cornerRadius = Math.round(ICON_CORNER_RADIUS_RATIO * outerSize);
    Path path = new Path();
    path.setFillType(Path.FillType.INVERSE_WINDING);
    RectF innerBoundsF = new RectF(innerBounds);
    path.addRoundRect(innerBoundsF, cornerRadius, cornerRadius, Path.Direction.CW);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    canvas.drawPath(path, paint);

    return bitmap;
}
 
Example 19
Source File: SVGAndroidRenderer.java    From microMathematics with GNU General Public License v3.0 4 votes vote down vote up
private void render(SVG.Path obj)
{
   debug("Path render");

   if (obj.d == null)
      return;

   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;
   if (!state.hasStroke && !state.hasFill)
      return;

   if (obj.transform != null)
      canvas.concat(obj.transform);

   Path  path = (new PathConverter(obj.d)).getPath();

   if (obj.boundingBox == null) {
      obj.boundingBox = calculatePathBounds(path);
   }
   updateParentBoundingBox(obj);

   checkForGradientsAndPatterns(obj);
   checkForClipPath(obj);
   
   boolean  compositing = pushLayer();

   if (state.hasFill) {
      path.setFillType(getFillTypeFromState());
      doFilledPath(obj, path);
   }
   if (state.hasStroke)
      doStroke(path);

   renderMarkers(obj);

   if (compositing)
      popLayer(obj);
}
 
Example 20
Source File: LanesStyleKit.java    From graphhopper-navigation-android with MIT License 4 votes vote down vote up
public static void drawLaneStraight(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int primaryColor, PointF size) {
  // General Declarations
  Stack<Matrix> currentTransformation = new Stack<Matrix>();
  currentTransformation.push(new Matrix());
  Paint paint = CacheForLaneStraight.paint;

  // Local Variables
  float expression = Math.min(size.x / 30f, size.y / 30f);

  // Resize to Target Frame
  canvas.save();
  RectF resizedFrame = CacheForLaneStraight.resizedFrame;
  LanesStyleKit.resizingBehaviorApply(resizing, CacheForLaneStraight.originalFrame, targetFrame, resizedFrame);
  canvas.translate(resizedFrame.left, resizedFrame.top);
  canvas.scale(resizedFrame.width() / 30f, resizedFrame.height() / 30f);

  // Frame
  RectF frame = CacheForLaneStraight.frame;
  frame.set(0f, 0f, size.x, size.y);

  // Group
  {
    RectF group = CacheForLaneStraight.group;
    group.set(0f, 0f, 12.02f, 24f);
    canvas.save();
    canvas.translate(9f, 3f);
    currentTransformation.peek().postTranslate(9f, 3f);
    canvas.scale(expression, expression);
    currentTransformation.peek().postScale(expression, expression);

    // Rectangle
    RectF rectangleRect = CacheForLaneStraight.rectangleRect;
    rectangleRect.set(4f, 8f, 8f, 24f);
    Path rectanglePath = CacheForLaneStraight.rectanglePath;
    rectanglePath.reset();
    rectanglePath.addRect(rectangleRect, Path.Direction.CW);

    paint.reset();
    paint.setFlags(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(primaryColor);
    canvas.drawPath(rectanglePath, paint);

    // Bezier
    RectF bezierRect = CacheForLaneStraight.bezierRect;
    bezierRect.set(0f, 0f, 12.02f, 9.99f);
    Path bezierPath = CacheForLaneStraight.bezierPath;
    bezierPath.reset();
    bezierPath.moveTo(group.left + group.width() * 0.33372f, group.top + group.height() * 0.4135f);
    bezierPath.lineTo(group.left + group.width() * 0.33414f, group.top + group.height() * 0.36075f);
    bezierPath.lineTo(group.left + group.width() * 0.33397f, group.top + group.height() * 0.36096f);
    bezierPath.cubicTo(group.left + group.width() * 0.33397f, group.top + group.height() * 0.35842f, group.left + group.width() * 0.33364f, group.top + group.height() * 0.35542f, group.left + group.width() * 0.33364f, group.top + group.height() * 0.35262f);
    bezierPath.cubicTo(group.left + group.width() * 0.33364f, group.top + group.height() * 0.3405f, group.left + group.width() * 0.31766f, group.top + group.height() * 0.33075f, group.left + group.width() * 0.29345f, group.top + group.height() * 0.33075f);
    bezierPath.cubicTo(group.left + group.width() * 0.29096f, group.top + group.height() * 0.33075f, group.left + group.width() * 0.28796f, group.top + group.height() * 0.33079f, group.left + group.width() * 0.28563f, group.top + group.height() * 0.331f);
    bezierPath.lineTo(group.left + group.width() * 0.28588f, group.top + group.height() * 0.33087f);
    bezierPath.lineTo(group.left + group.width() * 0.05882f, group.top + group.height() * 0.37217f);
    bezierPath.lineTo(group.left + group.width() * 0.05916f, group.top + group.height() * 0.37212f);
    bezierPath.cubicTo(group.left + group.width() * 0.05416f, group.top + group.height() * 0.37312f, group.left + group.width() * 0.04867f, group.top + group.height() * 0.37371f, group.left + group.width() * 0.04293f, group.top + group.height() * 0.37371f);
    bezierPath.cubicTo(group.left + group.width() * 0.01922f, group.top + group.height() * 0.37371f, group.left, group.top + group.height() * 0.36408f, group.left, group.top + group.height() * 0.35221f);
    bezierPath.cubicTo(group.left, group.top + group.height() * 0.346f, group.left + group.width() * 0.00516f, group.top + group.height() * 0.34033f, group.left + group.width() * 0.01356f, group.top + group.height() * 0.33642f);
    bezierPath.lineTo(group.left + group.width() * 0.01331f, group.top + group.height() * 0.3365f);
    bezierPath.lineTo(group.left + group.width() * 0.50046f, group.top);
    bezierPath.lineTo(group.left + group.width() * 0.98669f, group.top + group.height() * 0.33908f);
    bezierPath.lineTo(group.left + group.width() * 0.98644f, group.top + group.height() * 0.339f);
    bezierPath.cubicTo(group.left + group.width() * 0.99484f, group.top + group.height() * 0.34292f, group.left + group.width(), group.top + group.height() * 0.34862f, group.left + group.width(), group.top + group.height() * 0.35483f);
    bezierPath.cubicTo(group.left + group.width(), group.top + group.height() * 0.36671f, group.left + group.width() * 0.98078f, group.top + group.height() * 0.37629f, group.left + group.width() * 0.95707f, group.top + group.height() * 0.37629f);
    bezierPath.cubicTo(group.left + group.width() * 0.95133f, group.top + group.height() * 0.37629f, group.left + group.width() * 0.94584f, group.top + group.height() * 0.37575f, group.left + group.width() * 0.94084f, group.top + group.height() * 0.37471f);
    bezierPath.lineTo(group.left + group.width() * 0.94118f, group.top + group.height() * 0.37475f);
    bezierPath.lineTo(group.left + group.width() * 0.71412f, group.top + group.height() * 0.33346f);
    bezierPath.lineTo(group.left + group.width() * 0.71437f, group.top + group.height() * 0.33358f);
    bezierPath.cubicTo(group.left + group.width() * 0.71204f, group.top + group.height() * 0.33342f, group.left + group.width() * 0.70904f, group.top + group.height() * 0.33333f, group.left + group.width() * 0.70655f, group.top + group.height() * 0.33333f);
    bezierPath.cubicTo(group.left + group.width() * 0.68234f, group.top + group.height() * 0.33333f, group.left + group.width() * 0.66636f, group.top + group.height() * 0.34308f, group.left + group.width() * 0.66636f, group.top + group.height() * 0.35521f);
    bezierPath.cubicTo(group.left + group.width() * 0.66636f, group.top + group.height() * 0.358f, group.left + group.width() * 0.66603f, group.top + group.height() * 0.361f, group.left + group.width() * 0.66603f, group.top + group.height() * 0.36354f);
    bezierPath.lineTo(group.left + group.width() * 0.66586f, group.top + group.height() * 0.36338f);
    bezierPath.lineTo(group.left + group.width() * 0.66628f, group.top + group.height() * 0.41608f);

    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();
}