@@ -5,26 +5,25 @@ import bumblebee.color.GRAY
5
5
import bumblebee.color.RGB
6
6
import bumblebee.color.RGBA
7
7
import bumblebee.util.Converter.Companion.toHex
8
- import komat.space.Vect
9
8
10
9
class ImgInspector {
11
10
companion object {
12
11
fun getColorAt (imgPix : ImgPix , row : Int , col : Int ) : Color {
13
12
return when (imgPix.bytesPerPixel){
14
13
15
- 1 -> GRAY ((imgPix.mat [imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt())
14
+ 1 -> GRAY ((imgPix.cube [imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt())
16
15
17
16
3 -> RGB (
18
- (imgPix.mat [0 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt(),
19
- (imgPix.mat [1 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt(),
20
- (imgPix.mat [2 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt())
17
+ (imgPix.cube [0 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt(),
18
+ (imgPix.cube [1 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt(),
19
+ (imgPix.cube [2 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt())
21
20
22
21
// GBAR to RGBA
23
22
4 -> RGBA (
24
- (imgPix.mat [3 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt(),
25
- (imgPix.mat [0 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt(),
26
- (imgPix.mat [1 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt(),
27
- (imgPix.mat [2 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte ).toUByte().toInt()
23
+ (imgPix.cube [3 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt(),
24
+ (imgPix.cube [0 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt(),
25
+ (imgPix.cube [1 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt(),
26
+ (imgPix.cube [2 + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte() ).toUByte().toInt()
28
27
)
29
28
30
29
else -> {
@@ -36,7 +35,7 @@ class ImgInspector {
36
35
fun getHexStringAt (imgPix : ImgPix , row : Int , col : Int ) : String {
37
36
val vect = ByteArray (imgPix.bytesPerPixel)
38
37
for (i : Int in 0 until imgPix.bytesPerPixel){
39
- vect[i] = imgPix.mat [i + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row] as Byte
38
+ vect[i] = imgPix.cube [i + imgPix.bytesPerPixel * col + (imgPix.width * imgPix.bytesPerPixel) * row].toByte()
40
39
}
41
40
return vect.toHex()
42
41
}
0 commit comments