image blender by Phaelax29th May 2004 4:49
|
---|
Summary fades one image into another based on fade percent. Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com function blend_image(img1 as integer, img2 as integer, dest as integer, percent as integer) make memblock from image 255, img1 make memblock from image 256, img2 make memblock from image 257, img2 width = memblock dword(255,0) height = memblock dword(255,4) K# = percent/100.0 for x = 1 to width for y = 1 to height location = ((y-1)*width + x - 1)*4 + 12 b = memblock byte(255, location) g = memblock byte(255, location+1) r = memblock byte(255, location+2) b = b + ((memblock byte(256, location) - b) * K#) g = g + ((memblock byte(256, location+1) - g) * K#) r = r + ((memblock byte(256, location+2) - r) * K#) write memblock dword 257, location, rgb(r,g,b) next y next x make image from memblock dest, 257 delete memblock 255 delete memblock 256 delete memblock 257 endfunction |