Unverified Commit d53b7857 authored by alexander-gorshenev's avatar alexander-gorshenev Committed by GitHub

Added basic color constants into Color object (#207)

parent b8a4a399
......@@ -50,13 +50,9 @@ fun displayScene(renderer: Renderer, nanoTime: Long) {
val canvas = renderer.canvas!!
val paint = Paint()
// TODO: make color constants.
//paint.setColor(Color.GREEN)
paint.setColor(0xFF00FF00.toInt())
paint.setColor(Color.GREEN)
// TODO: make color constants.
// canvas.clear(Color.RED)
canvas.clear(0xFFFF0000.toInt())
canvas.clear(Color.RED)
canvas.save();
canvas.translate(128.0f, 128.0f)
......
......@@ -59,4 +59,14 @@ object Color {
require(0 <= b && b <= 255) { "Blue is out of 0..255 range: $b" }
return b and 0xFF or (color and -0x100)
}
const val TRANSPARENT: Int = 0x00_00_00_00
const val BLACK: Int = 0xFF_00_00_00.toInt()
const val WHITE: Int = 0xFF_FF_FF_FF.toInt()
const val RED: Int = 0xFF_FF_00_00.toInt()
const val GREEN: Int = 0xFF_00_FF_00.toInt()
const val BLUE: Int = 0xFF_00_00_FF.toInt()
const val YELLOW: Int = 0xFF_FF_FF_00.toInt()
const val CYAN: Int = 0xFF_00_FF_FF.toInt()
const val MAGENTA: Int = 0xFF_FF_00_FF.toInt()
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment