scanning a mirror darkly
Dec 4, 2006 at 4:19am
scanning a mirror darkly
So, I want to
1) use a ‘mirrored image’, such as http://imig.colorado.edu/~theodore/mirror.jpg
2) using srcdimstart etc., scan a smaller window (say 50×50 pixels) from this image, and strech it out into the final dimensions. so, I might use the following from my input image: left 0, top 0, right 50, bottom 50, and stretch that rect onto these locations of my output destination: left 0, top, 0, right 536, bottom, 300
3) slide the window along, either vertically, or horizontally, maintaining the 50×50 scanning dimensions
4) here’s the catch–I’d like to be able to seamlessly go off of one edge and wind up on the other side (the ‘asteroids’ effect). so if i send my scanning window down past the bottom of the original image, i’d like have it appear to loop back around to the top, with no discontinuity. it should be able to keep looping around forever, with no one the wiser (as if it were scanning some enormously huge tiled image).
The way I’ve been trying to do it involves two layers and alpha masking. Let’s take the example of vertical movement, imagining that we are starting the scanning rect at the top of the image, and moving down vertically. In the case where a 50×50 window give me bottom which hasn’t gone off the edge of the original image, then there is no need to mask anything. However, as soon as the bottom rect value goes past the bottom of my source image, I jump the lowest layer back up to the top of the source image, and create an alpha channel which allows this lowest layer to be seen only at the appropriate part of the window (the boundary of the bottom and top of the source image). Then, the amount of the lowest layer continues to expand, until the highest layer hits the bottom of the image and loops back around, at which time there is no need for a mask again. If I had about 10 more functioning brain cells, I could get this fully working.
However, I’m wondering, is there a better/more elegant solution, maybe even one that some kind soul who wishes to share has already implemented?
‘they wetly bow with hydrocephalitic listlessness / ants mop up their brow’
Dec 4, 2006 at 4:26am
You could just use jit.resamp to do everything for you. It does image
On 12/3/06, Michael Theodore
Dec 4, 2006 at 4:36am
Quote: email@example.com wrote on Sun, 03 December 2006 21:26
cool – ’nuff said then! thanks….
You must be logged in to reply to this topic.