Results 1 to 2 of 2

Thread: Color Cycle

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    LewZer-LanD
    Posts
    120

    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!
    Attached Images Attached Images  
    Kid A

    18 Year Old Programmer
    Visual Basic 6 & .NET Enterprise, ASP, WinXP (Advanced Server) Administration, HTML, Graphic Arts, Winsock, Learning VC++ and now maybe C#.. heh
    [vbcode]
    'back in the day vb6 code
    Private Sub My_Life()
    If Hour(Now) > 3 And Hour(Now) < 13 Then
    Status = "Sleeping"
    Else
    Status = "Computing"
    End If
    End Sub
    [/vbcode]

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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.
    Harry.

    "From one thing, know ten thousand things."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width