new topic     » goto parent     » topic index » view thread      » older message » newer message

Hey everyone.

I am currently creating a game graphics library, glib.e, which
has heavily optimised sprite drawing capabilities. It's almost finished, but 
a problem I have is this: Although there is hardly any bugs left in the 
code, and it all works fine, I need a routine that can convert a 256-color 
bitmap into the color codes that are default in euphoria 256 color mode.

The reason for this is that 256 color bitmaps all use custom palette values, 
which is all well and good, but you can't display more than one at a time, 
or you get *interesting* results.

What I've tried is similar to this

(not real code)
bitmap_palette = pic[1] / 4
eudef_palette = get_all_palette()


in a loop,

look for each entry of bitmap_palette in eudef_palette

i.e. index = find(bitmap_palette[count], eudef_palette)

if index then change each pixel in pic[2] that has value count to a new 
value index.

if any entries could not be matched, divide both palettes by 2 and floor 
them. This will make the palette values more crude, and easier to match.

and repeat, until all entries are found.

I've been using a mask array, to hold which arrays are found and what arent.

Does this make sense, or is there another way to do it, or has anyone done 
it already?

=====================================================
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__|Mr Trick

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu