delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/13/17:23:04

Message-ID: <358C2518.864D9FE1@go.ro>
Date: Sun, 21 Jun 1998 00:09:44 +0300
From: Radu Georgescu aka skoola <skoola AT go DOT ro>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Flipping an image
References: <7mf2qk$nlg$1 AT rockall DOT cc DOT strath DOT ac DOT uk>
Reply-To: djgpp AT delorie DOT com

> 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++)
>      {
>         array[???] = array[???];
>      }
>    }
> }

think:
there should be something like:
for(i=0;i<row/2;i++)
   for(j=0;j<col;j++)
       {
       a=array[i*bytes_per_line+j];
       array[i*bytes_per_line+j]=array[(i+1)*bytes_per_line-j];
       array[(i+1)*bytes_per_line-j]=a;
      }
now try to undertand the code.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019