compose-tetris icon indicating copy to clipboard operation
compose-tetris copied to clipboard

绘画屏幕边框的公式

Open cxp-13 opened this issue 1 year ago • 1 comments

以绘制左上部分举例: 注释掉的是原本的代码 我个人理解是按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))

cxp-13 avatar Feb 03 '23 15:02 cxp-13