I use tileset as a index of colors, and have only 40 colors.
but bitmap 32 bits have more than 40 colors.
What 40 colors do you have then? I mean how do they define these 40 colors?
I want to convert a bitmap picture to display in Tilemap by convert colors and store in array.
Not sure if I'm starting to understand you, do you want to convert each pixel and then draw each pixel with a vertex array/tile map?
Simple math is something about Hue or saturation?
I don't know, bit converting some colors from the 32bit color space to your 40 color space shouldn't be so hard, if the 40 colors are logically choosen (while ignoring the uselessness of a 40 color limit).
All of this is an argument of my school project
Why don't you ask your assistant/prof/teacher first then? Because they (usually) get payed for their teaching/assistance, plus they probably speak your lanuage.