Simple but fast fading method

BlitzPlus Forums/BlitzPlus Programming/Simple but fast fading method

Koriolis(Posted 2003) [#1]
I posted in the code archive a little contribution that shows a simple but fast and flexible way to make image to image fadings. If anyone is interested, it's
here.
NB: there is NO blending involved, this is partly why it's fast, the downside being that you may find it less appealing than a nice (but sloooow) blended fading.


darklordz(Posted 2003) [#2]
does it work in windowed mode as well as fullscreen


Koriolis(Posted 2003) [#3]
The sample is in a 256x256 window but there is absolutely nothing that prevents from using it in fullscreen.


jhocking(Posted 2003) [#4]
The 256x256 sample is pretty cool but I'm having trouble figuring out how to modify it for a more useful resolution like 640x480.


Koriolis(Posted 2003) [#5]
It's pretty simple. You just need to have 640x480 gray level bitmap (what I call the "fading pattern") that you will pass to the CreateFastFadingPattern function (maybe I should make the pattern image size independant from the destination buffer size...?). It will return a bank holding the preprocessd data, that you then pass to the DrawFastFading function. In the sample, just replace the lines
mixMap% = CreateTestFadingImage(2*Rand(-3,3), Rnd(0, 20))
by something like this:
mixMap = LoadImage("MyFadingPattern.bmp")
where "MyFadingPattern.bmp" is the 640x480 gray level image.
img1 and img2 should also be 640x480 images of course.


WoeIsMe(Posted 2003) [#6]
When I try to run it, I get an error message saying 'Expecting "End Function"' (line 58) highlighting the [256] in Local counts%[256] I turned this into a comment to see if it would work without it, but I just get more error messages. 2 lines down, it says: expecting "Next", and there are many more error messages to come. Might this be something to do with my version of blitz? It seems to not like the lines with things like:
counts[layer]
counts[a]
I tried changing the [s to (s, but that didn't help. Or it could be something to do with the 'count' variable. Is this written for Blitz3D, as I'm using blitz Basic.


Koriolis(Posted 2003) [#7]
Mmm, it seems B2D can't handle local blitz arrays variables. Under B3D I had no problem. I just updated the code to use standard arrays, so that it should work for you.