X/Y-Flip of Surfaces

Hello !

I am searching a ready to use
function to X/Y-Flip Surfaces ?

CU

Hi,

Torsten Giebl schrieb:

I am searching a ready to use
function to X/Y-Flip Surfaces ?

the only one I could give you is written in D. :slight_smile:

But it isn’t hard to write one. It basically just involves some
memcpy-ing of the lines. About half a screen of code or so.

-Sebastian

Hello !

But it isn’t hard to write one. It basically just involves some
memcpy-ing of the lines. About half a screen of code or so.

I know, i thought i could save a little bit time :slight_smile:

CU

Le Dimanche 13 Mars 2005 20:06, Torsten Giebl a ?crit?:

Hello !

I am searching a ready to use
function to X/Y-Flip Surfaces ?

first one :

scanline = SURFACEID->pitch;
src = (Uint8 *) SURFACEID->pixels;
dest = (((Uint8 )flipsurf->pixels)+((flipsurf->pitch)(flipsurf->h-1)));

for (loop=0; looph; loop++ )
memcpy (dest-(scanlineloop), src+(scanlineloop), scanline);

second one :

BPPixel = SURFACEID->format->BytesPerPixel;
scanline = SURFACEID->pitch;
src = (Uint8 *) SURFACEID->pixels;
dest = (((Uint8 *)mirrorsurf->pixels)+scanline-BPPixel);

for (loopy=0; loopy<(mirrorsurf->h); loopy++)
{
for (loopx=0; loopx<(mirrorsurf->w); loopx++)
{
memcpy(dest+((scanlineloopy)-(loopxBPPixel)),
src+((scanlineloopy)+(loopxBPPixel)), BPPixel);
}
}

grab from the Gambas SDL componant

http://gambas.sourceforge.net

Regards,–

Laurent Carlier