Skip to content

Instantly share code, notes, and snippets.

@Krishan14sharma
Last active November 7, 2017 09:09
Show Gist options
  • Save Krishan14sharma/8601824e56bfc28b88ffffc0c1999d80 to your computer and use it in GitHub Desktop.
Save Krishan14sharma/8601824e56bfc28b88ffffc0c1999d80 to your computer and use it in GitHub Desktop.
val X_PARTITION_RATIO = 1 / 3f
val Y_PARTITION_RATIO = 1 / 3f
...
private fun drawVerticalLines(canvas: Canvas) {
canvas.drawLine(width * X_PARTITION_RATIO, 0f, width * X_PARTITION_RATIO, height.toFloat(), paint)
canvas.drawLine(width * (2 * X_PARTITION_RATIO), 0f, width * (2 * X_PARTITION_RATIO), height.toFloat(), paint)
}
private fun drawHorizontalLines(canvas: Canvas) {
canvas.drawLine(0f, height * Y_PARTITION_RATIO, width.toFloat(), height * Y_PARTITION_RATIO, paint)
canvas.drawLine(0f, height * (2 * Y_PARTITION_RATIO), width.toFloat(), height * (2 * Y_PARTITION_RATIO), paint)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment