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?
Printable View
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?
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.
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
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.
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. :)Quote:
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
I don't have C or C++. Anyone that can do this for me? Or have another way of doing this?Quote:
i suggest that you write a dll with C or C++. Then use it, and you should have routines fast enough. :)
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.