Hi there,

I am having a very strange problem with my crossfades. First, let me explain

my approach.

Right now I have two 8-bits 320x200 images, which only use 16 of the 256

palette entries. So far no problem. I calculate two 256-color palettes.

Palette one holds the colors used in image one, and palette two holds the

colors used for image two, and I calculate these palettes so that every

possible color combination is accounted for, and so that I can 'slide' from

the first to the second palette. Then I generate image data that, for every

pixel, looks at the original color values from the two images and calculates

a new color value that is consistent with the calculated palettes. This is

what makes the crossfade happen. The palettes are set up as follows:

Index 0 slides from color 0 of the first image to color 0 of the second image

Index 1 slides from color 0 of the first image to color 1 of the second image

Index 2 slides from color 0 of the first image to color 2 of the second image

...

Index 15 slides from color 0 of the first image to color 15 of the second image

Index 16 slides from color 1 of the first image to color 0 of the second image

Index 17 slides from color 1 of the first image to color 1 of the second image

...

Index 253 slides from color 15 of the first image to color 13 of the second image

Index 254 slides from color 15 of the first image to color 14 of the second image

Index 255 slides from color 15 of the first image to color 15 of the second image

The above is to illustrate the following calculation:

int Pal1, Pal2

for(Pal1=0; Pal1<16; Pal1++)<br>
for(Pal2=0; Pal2<16; Pal2++)<br>
{

PalFrom[Pal1*16+Pal2][0] = OrigPal1[Pal1][0]

PalFrom[Pal1*16+Pal2][1] = OrigPal1[Pal1][1]

PalFrom[Pal1*16+Pal2][2] = OrigPal1[Pal1][2]

PalTo[Pal1*16+Pal2][0] = OrigPal2[Pal2][0]

PalTo[Pal1*16+Pal2][1] = OrigPal2[Pal2][1]

PalTo[Pal1*16+Pal2][2] = OrigPal2[Pal2][2]

}

I generate the image data loke so:

int Pixel;

for(Pixel=0; Pixel<320*200; Pixel++)<br>
CrossPic[Pixel] = OrigPic1[Pixel] * 16 + OrigPic2[Pixel];

So, when all this is done, I have generated an image which I draw on the

screen. When I set the palette 'PalFrom', it looks as though I put the

original first image on screen, and if I set palette 'PalTo', it looks as if

the second original image was drawn on screen. And all this without changing

the image data on screen (the image I calculated from the two original images).

Up to now, no problem. The problem arises when I actually want to slide

from 'PalFrom' to 'PalTo'. For this I use the SlidePalette function from my

own little vgalib, which has always done a fine job. It neatly slides the

RGB values for every palette index from the first palette specified to the

second, in an amount of steps I also supply as a parameter. This function

works perfectly. The more reason for me being surprised, because when I

initiate the crossfade (putting the generated image on screen, and then

sliding from 'PalFrom' to 'PalTo'), every color seems to slide through a couple

of other nonsense-colors before arriving at the desired color from 'PalTo'.

(the starting and ending colors _are_ correct, but they all first cycle through

some strange colors couple of times before finished). It would seem a logical

conclusion that my SlidePalette function is buggy, but I have seen it more

than often slide from any generic palette to any other one, without problems

whatsoever. I was hoping that someone out there had encountered such a problem

before, or for whatever reason sees my mistake (if anyone follows all my

blabbering in the first place...

Think you can help me out? Please do! I am at a loss...

Thanks,

Mark