Opt in for ExperimentalUnsignedTypes
This commit is contained in:
parent
b0a4f766b4
commit
35ddb2166c
1 changed files with 2 additions and 0 deletions
|
@ -5,6 +5,7 @@ const val BYTES_PER_PIXEL = 4
|
||||||
|
|
||||||
data class Color(val r: UByte, val g: UByte, val b: UByte, val alpha: UByte = UByte.MAX_VALUE)
|
data class Color(val r: UByte, val g: UByte, val b: UByte, val alpha: UByte = UByte.MAX_VALUE)
|
||||||
|
|
||||||
|
@OptIn(ExperimentalUnsignedTypes::class)
|
||||||
class Bitmap(val width: Int, val height: Int) {
|
class Bitmap(val width: Int, val height: Int) {
|
||||||
val data = UByteArray(width * height * BYTES_PER_PIXEL)
|
val data = UByteArray(width * height * BYTES_PER_PIXEL)
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ class Bitmap(val width: Int, val height: Int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalUnsignedTypes::class)
|
||||||
fun File.writeBitmap(bitmap: Bitmap) {
|
fun File.writeBitmap(bitmap: Bitmap) {
|
||||||
outputStream().use { stream ->
|
outputStream().use { stream ->
|
||||||
stream.write(0) // ID length
|
stream.write(0) // ID length
|
||||||
|
|
Loading…
Add table
Reference in a new issue