
// header files

#include <memory.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <cmath> 
using namespace std;



//structures
typedef struct 
{
	int	xsize;	        	/* horizontal size of the image in Pixels */
	int	ysize;	        	/* vertical size of the image in Pixels */
	unsigned char* data;	/* pointer to first scanline of Image */
	int	span;		        /* byte offset between two scanlines */
} GGImage;




//declarations
char *getFileNameWithoutExtension(char *, char *);
char *getFileNameExtension(char *, char *);

GGImage *AllocGGImage		(int , int );
GGImage *AllocGGImagePPM	(int , int );
void FreeGGImage(GGImage *);

GGImage *LoadGGImagePGM (const char*);
GGImage *LoadGGImagePPM (const char*);
int     SaveGGImagePGM  (const char*, GGImage*);
int		SaveGGImagePPM	(const char*, GGImage*);

GGImage *CropImage(GGImage *, int , int , int , int ); // for pgm

GGImage *RotatePGMImage(GGImage * , int);
GGImage *RotatePPMImage(GGImage * , int);
GGImage *MirrorImagePGM(GGImage *);
GGImage *MirrorImagePPM(GGImage *);

void getCoordinatesInRotatedPGMImage(double, GGImage *, GGImage *, int, int, double *,	double * );


GGImage *ScaleSizeMedianPGM(GGImage *, int , int );
GGImage *ScaleSizeMedianPPM(GGImage *, int , int );
GGImage *ScaleSizeMeanPPM(GGImage *, int , int );



// definitions
#define MAX(x, y) ((x) > (y) ? (x) :(y))
#define MIN(x, y) ((x) < (y) ? (x) :(y))
#define PI (3.1415927)
#define border 5



