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

绘画屏幕边框的公式 #8

Open
cxp-13 opened this issue Feb 3, 2023 · 1 comment
Open

绘画屏幕边框的公式 #8

cxp-13 opened this issue Feb 3, 2023 · 1 comment

Comments

@cxp-13
Copy link

cxp-13 commented Feb 3, 2023

以绘制左上部分举例:
注释掉的是原本的代码
我个人理解是按x轴的中心去绘制,然后垂直下滑到y轴的中心点。因为x和y的边长不一样。
但是代码的两个点的y,都看不明白是啥意思。并不是在轴的中心点。

sample:
boder

var path = Path().apply {
        moveTo(topLef.x, topLef.y)
        lineTo(topRight.x, topRight.y)
        lineTo(
            topRight.x / 2 + topLef.x / 2,
//            topLef.y + topRight.x / 2 + topLef.x / 2 - topLef.x
            topLef.y + topRight.x / 2 - topLef.x / 2
        )
        lineTo(
            topRight.x / 2 + topLef.x / 2,
//            bottomLeft.y - topRight.x / 2 + topLef.x / 2
            bottomLeft.y / 2 + topLef.y / 2,
        )
        lineTo(bottomLeft.x, bottomLeft.y)
        close()
    }
    drawPath(path, Color.Black.copy(0.5f))
@vitaviva
Copy link
Owner

p1 p2 两个点不需要是y轴的中心。这块为了画屏幕的边框的阴影效果,屏幕是长方形的所以两条斜线在x轴无法闭环,拉一条y线闭环而已,没有特别用意。

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