Thread View: comp.graphics.algorithms
2 messages
2 total messages
Started by Sim Zacks
Mon, 07 Dec 1998 00:00
90 degree rotation algorithm.
Author: Sim Zacks
Date: Mon, 07 Dec 1998 00:00
Date: Mon, 07 Dec 1998 00:00
19 lines
1361 bytes
1361 bytes
Could you please look at the algorithm I just figured out and tell me what you think of it. If there's a better method, or anything, please let me know. I am dealing with 1 bit per pixel images. 90 degree rotation 1. Imagewidth := pixels per row 2. Imageheight := pixels per column 3. Newrownumber := imageheight � rownum +1 4. Firstpixelinrow := imagewidth * (rownumber-1) +1 5. Pixelnuminrow := pixelnum � first pixel in row 6. Newpixelnum := pixelnuminrow * imageheight+newrownumber; 7. CorrectByte := newpixelnum div 8 + 1; 8. Allocate enough memory for new image 9. Fill the memory with 0�s 10. AND the current byte to get the current pixel 11. OR the current Pixel with the Byte you want to put it into 12. Do this for entire image.
Re: 90 degree rotation algorithm.
Author: Sim Zacks
Date: Mon, 07 Dec 1998 00:00
Date: Mon, 07 Dec 1998 00:00
24 lines
1524 bytes
1524 bytes
I screwed up in calculating the new pixel number. Can anyone help? Sim Zacks wrote: > Could you please look at the algorithm I just figured out and tell me > what you think of it. > If there's a better method, or anything, please let me know. > I am dealing with 1 bit per pixel images. > > 90 degree rotation > > 1. Imagewidth := pixels per row > 2. Imageheight := pixels per column > 3. Newrownumber := imageheight � rownum +1 > 4. Firstpixelinrow := imagewidth * (rownumber-1) +1 > 5. Pixelnuminrow := pixelnum � first pixel in row > 6. Newpixelnum := pixelnuminrow * imageheight+newrownumber; > 7. CorrectByte := newpixelnum div 8 + 1; > 8. Allocate enough memory for new image > 9. Fill the memory with 0�s > 10. AND the current byte to get the current pixel > 11. OR the current Pixel with the Byte you want to put it into > 12. Do this for entire image.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads