Re: Masking
- Posted by Irv Mullins <irvm at ellijay.com> Nov 08, 2003
- 665 views
On Saturday 08 November 2003 02:30 pm, Stewart wrote: > > > Is there a fster way to display a bitmap on the screen without the pixels > which are the mask color, other than plotting each color individually in a > loop? > > this is the code im using at the moment: > > for y = 1 to length(img) do > for x = 1 to length(img[y]) do > if img[y][x] != MASK_COLOR then > pixel(img[y][x], {imgX + x, imgY + y}) > end if > end if > end for > > this is too slow for what i am doing. I realize this probably won't help you, but I was just writing a program which moves a sprite with transparent background around on a photographic background image. To do this in Linux/GTK takes exactly one line of code to load the image: img = image("images/tux.xpm") and one line to move it: set(background,"Put",{ img, x, y }) It works with .gif, .png, .xpm, and .tif files, perhaps others. Regards, Irv -- Robert Tappen Morris, Jr., got six months in jail for crashing 10% of the computers that Bill Gates made $100 million crashing last weekend.