-
1 Attachment(s)
Color Cycle
Hello all vb (L)users... hehe
Basicly, i want to know if there is a way to make it so...
I want to take a picture... and cycle all the colors in it, but i want the colors to cycle smootly.. i have attached a picture of what i would like it to do.
I also want to be able to change the speed on-the-fly.
Thanx again!
-
Well this is easy with DirectDraw, you can do it with palettes. You could do the same sort of thing without DDraw, just using Windows GDI stuff in 256 colour mode, but I doubt that's practical.
Well here's my suggestion: Basically you set up your picture with some unique RGB values for the colours you want to cycle. Either that or you could store an array containing all the coordinates of pixels you want to rotate. Basically you need to have the data for which colours rotate and which don't. I'm not entirely sure (my eyesight isn't good enough) but it looks like you might want everything but black to cycle, and have the rest of it coloured and shaded. So you could just use a greyscale bitmap, and add colour in varying degrees to each part of the image.
To actually change the individual pixels, the fastest thing I can think of without using DDraw or OpenGL or some other decent graphics API is to use SetPixel on each pixel.
Anyway, to cycle the colours I guess you could graduate the colour bias you apply like this:
(Red, Green, Blue)
255, 0, 0
127, 127, 0
0, 255, 0
0, 127, 127
0, 0, 255
127, 0, 127
255, 0, 0
etc.
You would want to make the transition between colours smoother of course, so you'll need to use as many different colours in-between as you want/is feasible.
I'm not sure if that's the best way to do it without something like DDraw. Sure seems slow. Ah well.