So encountered an issue that I cant figure out how to work around.
So I am building an RGB palette index table. Easiest way is a Map, the RGB in hexstring as the Key, and the "index" as the value. so if I pass in the RGB, I can get the correct index back.
Anyways, Here is my code:
Problem is, if I try to to a GET of anything, all I retrieve is null. No matter what RGB I try, that the routine above puts into the table. I did a Log in the loop to know that the key is there. But its not there...
I attached my palette text file.
any ideas?
So I am building an RGB palette index table. Easiest way is a Map, the RGB in hexstring as the Key, and the "index" as the value. so if I pass in the RGB, I can get the correct index back.
Anyways, Here is my code:
B4X:
'Load Radar Palette
Dim PaletteString As String = File.ReadString(File.DirAssets, "Radar.pal")
Dim RadarPalette() As String = Regex.Split("#", PaletteString.ToUpperCase)
'Dim RGBVal As String
RadarImagePalette.Initialize
For I = 0 To RadarPalette.Length-1
RadarImagePalette.Put(RadarPalette(I), I)
Next
For Each k As String In RadarImagePalette.Keys
Log(k)
Log(RadarImagePalette.Get(k))
Next
Dim k As String = "000000" 'This is one of the values stored as a Key.
Log(RadarImagePalette.Get(k)) 'Returns Null
Problem is, if I try to to a GET of anything, all I retrieve is null. No matter what RGB I try, that the routine above puts into the table. I did a Log in the loop to know that the key is there. But its not there...
I attached my palette text file.
any ideas?