Code archives/Graphics/Shadow from an image
This code has been declared by its author to be Public Domain code.
Download source code
| This function creates a shadow an image, by reading the "red" value and setting it to all three rgb values, amking a grey. its reasonably fast aswell. |
Function GenerateShadow(img, r = 255, g = 0, b = 255) setbuffer imagebuffer(img) lockbuffer for x = 0 to imagewidth(img) - 1 for y = 0 to imageheight(img) - 1 col = readpixelfast (x, y) color 0, 0, col if not (colorred() = r and colorgreen() = g and colorblue() = 255) color colorred(), colorred(), colorred() plot x, y endif next next unlockbuffer setbuffer backbuffer() return img end function |