help please!

I have absolutely no idea where to start with this program. Please help in any way you can! Thanks, Julie

Develop a C function named rotate90 that takes
nothing as input and returns nothing as output, and
rotates the pixels (unsigned char) of a two-dimensional
array named imgdata (a global variable) for rows
from 0 to imgheight and columns from 0 to imgwidth
(both imgheight and imgwidth are also global variables).
Your function should be developped in such a way that
it can be integrated in the grayscale/ppm/pnm Image
Viewer program of the lecture notes (and transcript)
such that if one added an appropriate button to the
program's GUI (in Make Controls) and corresponding
code in the ProcessMessages() function (including a
call to DrawData() to redraw the image), then pressing
the button would cause a displayed image to be re-
displayed with a 90 degree rotation. Features that
were in the left-to-righ direction in the original
image will be in the up-down direction in the rotated
image. Verify that your function works and paste it
below (DO NOT paste the whole Image Viewer code! Paste
just your rotate90 function).



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void rotate90(HWND window)
{
    int row, col, temporary;
    unsigned char imgdatatemp[MaxSize][MaxSize];
       
      	 for (row = 0 ; row < imgheight ; row++)
        for (col = 0 ; col < imgwidth ; col++)
        {
            imgdatatemp[row][col] = imgdata[row][col];
        }
    
    	 for (row = 0 ; row < imgheight ; row++)
        for (col = 0 ; col < imgwidth ; col++)
        {
            imgdata[row][col] = imgdatatemp[col][row];
        }
  
    temporary= imgheight; 
    imgheight = imgwidth;
    imgwidth = temporary;
}
Topic archived. No new replies allowed.