Results 1 to 7 of 7

Thread: DirectX Fading

  1. #1

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407

    Talking DirectX Fading

    Ok, i would like to know how you would fade things in and out with DirectX or something on a VB Form. Like, for instance you would click a command button and the picture would fade out and then you would click another command button and the picture would fade back in. What is the code for that? Can you use DirectX for that or should i use something else?

  2. #2
    Zaei
    Guest
    Fading basically involves interpolating one color value to another for each pixel in an image. For Fade to black, you just interpolate from original color->black. The algorithm for interpolation is:
    Code:
    let s equal a value from 0 to 1, where 0 equals the original value, and one is the destination value:
    
    currVal = OriginalVal + s * (OriginalVal - DestVal)
    Basically, loop through every pixel in an image, and get the pixel value. Retrieve each color component and run it through the equation above. Using VB, this is impossible to do in real-time.

    Z.

    [edit]
    using VB, this is impossible, without DirectX, or other custom C++ DLL.

  3. #3

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407
    Ok well what i really want to do is fade menus like if you click File. Just like Windows 2000 but i want to make it work on Windows 9x. I was wondering if i could use directx or some fading code that could do that.

  4. #4
    Addicted Member
    Join Date
    Feb 2001
    Location
    Classified
    Posts
    234
    I was trying to do the same sort of thing a while back, but i couldent get it done.

    You will need to use the AlphaBlend API function, i managed to get a form semi-transperent, but i could never get the menus to do anything for me.

    Private Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As Long
    My ICQ Status: (85634850)

    Seriously Sick Tshirts

  5. #5

    Thread Starter
    Frenzied Member SomethinCool's Avatar
    Join Date
    Jan 2001
    Location
    Malvern, PA
    Posts
    1,407
    would any of this alphablending stuff be on MSDN online?

  6. #6
    Addicted Member
    Join Date
    Feb 2001
    Location
    Classified
    Posts
    234
    probably, i remember looking it up their at one point

    me and a few others on this board worked it out on this forum, if it keeps stuff from like, half a year ago, you should beable to find it ;o
    My ICQ Status: (85634850)

    Seriously Sick Tshirts

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Heh its simple to do in VBScript on an HTML webpage you should try it.. If you want to see the effects I got with it visit the ToW thread in the discussion area, look for a nice pic
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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