#pragma once

/*
SDL_Surface* flip_surface(SDL_Surface* surface, int flags) {
	//http://lazyfoo.net/SDL_tutorials/lesson31/index.php

	//Pointer to the soon to be flipped surface
	SDL_Surface *flipped = NULL;
	//If the image is color keyed
	if (surface->flags&SDL_SRCCOLORKEY) {
		flipped = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h, surface->format->BitsPerPixel, surface->format->Rmask, surface->format->Gmask, surface->format->Bmask, 0 );
	}
	//Otherwise
	else {
		flipped = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h, surface->format->BitsPerPixel, surface->format->Rmask, surface->format->Gmask, surface->format->Bmask, surface->format->Amask );
	}

	//If the surface must be locked
	if ( SDL_MUSTLOCK(surface) ) {
		//Lock the surface
		SDL_LockSurface(surface);
	}

	//Go through columns
	for ( int x=0,rx=flipped->w-1; x<flipped->w; x++,--rx ) {
		//Go through rows
		for ( int y=0,ry=flipped->h-1; y<flipped->h; y++,--ry ) { 
			//Get pixel
			Uint32 pixel = get_pixel32(surface,x,y);
			//Copy pixel
			if ( (flags&FLIP_VERTICAL) && (flags&FLIP_HORIZONTAL ) ) {
				put_pixel32( flipped, rx, ry, pixel );
			}
			else if (flags&FLIP_HORIZONTAL) {
				put_pixel32( flipped, rx, y, pixel );
			}
			else if (flags&FLIP_VERTICAL) {
				put_pixel32( flipped, x, ry, pixel );
			}
		}
	}

	//Unlock surface
	if ( SDL_MUSTLOCK(surface) ) {
		SDL_UnlockSurface( surface );
	}
	//Copy color key
	if ( surface->flags&SDL_SRCCOLORKEY ) {
		SDL_SetColorKey( flipped, SDL_RLEACCEL | SDL_SRCCOLORKEY, surface->format->colorkey );
	}

	//Return flipped surface
	return flipped;
} 
*/

Uint32 surface_pixel_get(SDL_Surface* surface, int x, int y);

void surface_pixel_set(SDL_Surface* surface, int x, int y, Uint32 pixel);