Results 1 to 7 of 7

Thread: How do I fade two images into each other?

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That's an simple qwestion. If PSP can do it, why can't I. I need to set the % of how much the first image is faden into the second.
    Can someone assist me?

  2. #2
    New Member
    Join Date
    Feb 1999
    Location
    Kuopio, Finland
    Posts
    7
    Fading between two images is very easy thing to do.

    x = 0-100
    % value how much the first image is shown

    R1,G1,B1 = all ranging from 0 to 255
    1 pixel's red, green and blue components of image1

    R2,G2,B2 = all ranging from 0 to 255
    1 pixel's red, green and blue components of image2

    R,G,B = all ranging from 0 to 255
    1 pixel's red, green and blue components of result

    R = ((x * R1) + ((100-x) * R2)) / 100
    G = ((x * G1) + ((100-x) * G2)) / 100
    B = ((x * B1) + ((100-x) * B2)) / 100

    That was it. Very simple thing to do... but ofcourse you need to get to manipulate all RGB-values of images involved. If you want to do this from vb, I suggest that the images you want to crossfade are saved in 24-bit bmp-format(raw), and the result image created, will be also in the same format. Then you can just use LoadPicture to show the result image.

  3. #3

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Bah, no offence but I have already tried that, and it goes to slow for me to accept. I wan't the speed like in bitcomparations using blt's in API

  4. #4
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    its been a while since i`ve done this sort of thing, but maybe use a look up table of all possible vals? Depends on whether your chip can do faster memory accesses vs actually calculating in real time. depends on cache/ram/processor speed. also, havent even thought about how big the lookup would have to be - must fit into cache for any sensible results.

    a.

  5. #5
    New Member
    Join Date
    Feb 1999
    Location
    Kuopio, Finland
    Posts
    7

    Bah, no offence but I have already tried that, and it goes to slow for me to accept. I wan't the speed like in bitcomparations using blt's in API
    Eternal dilemma: 'I need more speed...'. If you really want speed to your routines, i suggest that you write a dll with C or C++. Then use it, and you should have routines fast enough.

  6. #6

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    i suggest that you write a dll with C or C++. Then use it, and you should have routines fast enough.
    I don't have C or C++. Anyone that can do this for me? Or have another way of doing this?

  7. #7
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    You could look for help from a *very* altruistic person on a usenet newsgroup (comp.lang.c, alt.programming etc)... or look for `demo` source - this sort of thing has been done before, many times, and very fast. (is hornet.org still up? or a mirror?) I imagine theres already some source somewhere on the net. Just probably not in Visual Basic, which was hardly written with speed of program execution in mind

    a.

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