Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I customize the blue area in the image? #229

Open
arcpuree opened this issue Aug 29, 2021 · 4 comments
Open

Can I customize the blue area in the image? #229

arcpuree opened this issue Aug 29, 2021 · 4 comments

Comments

@arcpuree
Copy link

arcpuree commented Aug 29, 2021

I want to change the blue area from the image to three colors.

234834234_2048436081972191_4335282346229780161_n

@yunikkk
Copy link
Collaborator

yunikkk commented Oct 1, 2021

@arcpuree is the question still valid?

@arcpuree
Copy link
Author

arcpuree commented Oct 2, 2021 via email

@yunikkk yunikkk closed this as completed Oct 5, 2021
@yunikkk yunikkk reopened this Oct 5, 2021
@yunikkk
Copy link
Collaborator

yunikkk commented Oct 5, 2021

@arcpuree we don't expose API to customize lane render, actually. However, you could draw it yourself using simple Canvas rendering. You'll need to receive RoadDescription object, that contains detected lanes array, for each of them there is two LaneEdges. Each LaneEdge contains Bezier that can be drawn on canvas, e.g.

...
    fun drawLane(lane: Lane?) {
        fillPath.reset()

        lane?.let {
            val leftP1 = VisionManager.worldToPixel(lane.leftEdge.curve.p1)
            val leftP2 = VisionManager.worldToPixel(lane.leftEdge.curve.p2)
            val leftP3 = VisionManager.worldToPixel(lane.leftEdge.curve.p3)
            val leftP4 = VisionManager.worldToPixel(lane.leftEdge.curve.p4)
            val rightP1 = VisionManager.worldToPixel(lane.rightEdge.curve.p1)
            val rightP2 = VisionManager.worldToPixel(lane.rightEdge.curve.p2)
            val rightP3 = VisionManager.worldToPixel(lane.rightEdge.curve.p3)
            val rightP4 = VisionManager.worldToPixel(lane.rightEdge.curve.p4)

            fillPath.apply {
                moveTo(
                    leftP1.x.toFloat(),
                    leftP1.y.toFloat()
                )
                cubicTo(
                    leftP2.x.toFloat(),
                    leftP2.y.toFloat(),
                    leftP3.x.toFloat(),
                    leftP3.y.toFloat(),
                    leftP4.x.toFloat(),
                    leftP4.y.toFloat()
                )

                lineTo(
                    rightP4.x.toFloat(),
                    rightP4.y.toFloat()
                )
                cubicTo(
                    rightP3.x.toFloat(),
                    rightP3.y.toFloat(),
                    rightP2.x.toFloat(),
                    rightP2.y.toFloat(),
                    rightP1.x.toFloat(),
                    rightP1.y.toFloat()
                )
                close()
            }
        }

        invalidate()
    }

    override fun onDraw(canvas: Canvas) {
        canvas.drawPath(fillPath, fillPaint)

        super.onDraw(canvas)
    }
...

@arcpuree
Copy link
Author

arcpuree commented Oct 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants