| www.delorie.com/archives/browse.cgi | search |
| From: | Mark Phillips <umphill5 AT cs DOT umanitoba DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Flipping an image |
| Date: | Tue, 13 Jul 1999 11:33:30 -0500 |
| Organization: | The University of Manitoba |
| Lines: | 27 |
| Message-ID: | <Pine.SUN.3.96.990713113215.6737A-100000@silver.cs.umanitoba.ca> |
| References: | <7mf2qk$nlg$1 AT rockall DOT cc DOT strath DOT ac DOT uk> <7mfdr3$m9r$1 AT taliesin DOT netcom DOT net DOT uk> |
| NNTP-Posting-Host: | silver.cs.umanitoba.ca |
| Mime-Version: | 1.0 |
| X-Trace: | canopus.cc.umanitoba.ca 931883614 17032 130.179.24.6 (13 Jul 1999 16:33:34 GMT) |
| X-Complaints-To: | Postmaster AT cc DOT umanitoba DOT ca |
| NNTP-Posting-Date: | 13 Jul 1999 16:33:34 GMT |
| In-Reply-To: | <7mfdr3$m9r$1@taliesin.netcom.net.uk> |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
> Alan Wills wrote in message <7mf2qk$nlg$1 AT rockall DOT cc DOT strath DOT ac DOT uk>...
> >void flip_image(int array[], int rows, int cols)
> >{
> >int row_count, col_count, total_pixelsp;
> >
> > for(row_count = 0; row_count < rows; row_count++)
> > {
> > for(col_count = 0; col_count < cols; col_count++)
> > {
>
>
> // Something like this ? (note: this is untested)
> tmp = array[row_count * cols + col_count];
> array[row_count * cols + col_count] = array[(row_count + 1) * cols - 1 -
> col_count];
> array[(row_count + 1) * cols - 1 - col_count] = tmp;
>
> > }
> > }
> >}
I'm pretty sure if you do it this way you'll only want the inside loop to
go up to cols/2 instead of cols since then you'd be flipping the image and
then re-flipping it back the way it was.
mark
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |