Draw an iamge with a preset palette?

Blitz3D Forums/Blitz3D Programming/Draw an iamge with a preset palette?

CopperCircle(Posted 2007) [#1]
Hi, does anyone know of a dll or good method to draw an image with a preset reduced palette. I need to draw a true color image using a pre defined 16/32 color palette, matching the colors to the closest available in the palette.

Thanks.


jfk EO-11110(Posted 2007) [#2]
I think that's easy, simply readpixelfast each pixel, then parse the palette and seek for the best match. If you seperated RGB in both, pixel and palette color then you may add the 3 diffrences together to get the full diffrence. Tho, green has a slightly higher significance, I think you may ignore this.

Probably you need to add some smarter algorithms to find the best match. Like R to GB relation (aka hue) etc.

Of course, it's not very fast. Make sure the palette is ready as R,G,B in an array.


CopperCircle(Posted 2007) [#3]
This is sort of what I have been doing, I have also used pixel brightness in the calculations, but it is slow.
I was hopping that someone may know of a dll that could be used.