All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.casperix.math.array.uint8.UByteBasedMap2D.kt Maven / Gradle / Ivy

package ru.casperix.math.array.uint8

import ru.casperix.math.array.MutableMap2D
import ru.casperix.math.vector.int32.Vector2i

@OptIn(ExperimentalUnsignedTypes::class)
class UByteBasedMap2D(val bytes: UByteArray3D, val codec: UByteCodec) : MutableMap2D {
	override val dimension = bytes.dimension.getXY()

	override fun get(position: Vector2i): Custom {
		val pixel = bytes.getColumn(position)
		return codec.decode(pixel)
	}

	override fun set(position: Vector2i, value: Custom) {
		val pixel = codec.encode(value)
		bytes.setColumn(position, pixel)
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy