Excellent. I added setAlpha and useAlpha in order to preserve my transparency but other than that it works great. Appreciate the help.
Jeremy -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Colin Holgate Sent: Monday, June 02, 2003 10:44 PM To: [EMAIL PROTECTED] Subject: RE: <lingo-l> Imaging lingo >Sorry let me rephrase, I'm looking for some imaging lingo that will >blur the whole image, rather than just the edges. This was an interesting problem. I'm sure there are official anti-aliasing routines out there, but I decided to try and work one out for myself. I ran into an interesting problem, but have a solution for that. If you think about what you need to do, say you have an image like this: 1313131313 3131313131 1313131313 and you want it to be smoothed, you could think of how it would look if you zoomed in (inventing pixels as you go): 1232123212321232123 3212321232123212321 1232123212321232123 The pixels in between the 1's and 3's are 2's. I'm certain that this isn't the best way to think of it, because diagonally the mix won't be exactly 50/50. But ignoring that, you might see that if you can generate that imagined pixel and scale back to normal size, and it gets mixed in with the original pixels, you might have the smoother effect you wanted. The trick then becomes how do you make an even mix of the adjacent pixels. Suppose you scale it up 3X, looking at one column that would be: 1 1 1 3 3 3 Now scale that to 2X of the original, allowing mixing: 1 2 2 3 then halve that, and you get a blend of all the colors you wanted. Now if only copypixels would behave we'd be there. Unfortunately, copypixels seems to be smart enough to know that 3X and back down to 2X is an exact number of pixels, and so doesn't do any mixing at all. Literally the final image is pixel identical to the original. Don't worry, I didn't let a little thing like that stop me. Incidentally, it turns out that you can skip the 2X stage and just go to 3X and back to 1X, and get the right mix (copypixels permitting). The way to fool copypixels is to not go to exactly 3X: on antijaggy theimage i = image(theimage.width * 3.01,theimage.height * 3.01,32,0) i2 = image(theimage.width,theimage.height,32,0) i.copypixels(theimage,i.rect,theimage.rect) i2.copypixels(i,i2.rect,i.rect) return i2 end Call this routine like this: member("whatever").image = antijaggy(member("whatever").image) The results are fairly pleasing. [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!] [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
