Trying to display a colored surface

I am a newbie with SDL and I wanted to do the simplest think we can do, but this doesn’t work… This thing is displaying a colored square.

So i do this*****

SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask); //square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to black
SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my square to white
SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this doen’t work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what I writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you to
read some tutorials.On Mon, 2002-07-15 at 00:37, Carlos wrote:

I am a newbie with SDL and I wanted to do the simplest think we can do, but this doesn’t work… This thing is displaying a colored square.

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask); //square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to black
SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my square to white
SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this doen’t work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what I writen ???

I already know how to setup a screen window, that’s why I don’t specify the code for the screen variable. Below the comments " /* window … */ ", just after le SDL_Rect declaration, you must understand that I put a window setup for “screen” (which uses le SDL_SetVideoMode)

Just the think I want to do, is drawing a little square into the screen WITH the “test” variable…> >

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask); //square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to black
SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my square to white
SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this doen’t work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what I writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you to
read some tutorials.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi Carlos,

If you don’t include all of the code in your example, other people can’t
compile it on their systems. This makes finding bugs difficult.
You have omitted the screen setup code, the bug may be in there and we
wouldn’t know. Also, you haven’t said what he actual problem is or what you
see on the screen. Does the screen go black or do you get an error of some
kind?

I think you may be getting your rects confused.
You haven’t defined a width or height for the rect r so they will be random
values.

Also, you are passing nil to the SDL_BlitSurface function for your destination
rect. You would only ever do this if your surface that you are blitting
covers the whole of the screen.

May I suggest that you create a destination rect. (the destination rect tells
SDL where to draw the image, but you have left yours blank)

SDL_Rect d;

d.x = 100;
d.y = 100;
d.w = 20;
d.h = 20;

then alter your source rect (the source rect tells SDL where to get the data
from to draw to the screen)

r.x = 0;
r.y = 0;
r.w = 20;
r.h = 20;

SDL_BlitSurface(test,&d,screen,&r);

All this aside, If you just want to display a coloured square, why not take a
look at SDL_FillRect

Hope this helps

Jason> I already know how to setup a screen window, that’s why I don’t specify the

code for the screen variable. Below the comments " /* window … */ ",
just after le SDL_Rect declaration, you must understand that I put a window
setup for “screen” (which uses le SDL_SetVideoMode)

Just the think I want to do, is drawing a little square into the screen
WITH the “test” variable…

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test =
SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);
//square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to black
SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my square to
white SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this doen’t
work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what I
writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you to
read some tutorials.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I will explain better my problem…
I have no error but I still get a black screen

I do :***
SDL_Surface test;
test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask); //mask are already setup
//this creates for me a 100x100 square, right ?


So I thought that my memory surface would be fully size and create.
then I create just one rectangle to give position into the screen


SDL_Rect r;
r.x = 150; r.y=150; //this mean that I want to place “test” at position 150,150 in the screen, right ?


and I fill my rectangles to be sure I see somethink
(here starts the main loop)


SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is a 1024x768x16 window
SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white


finally I blit


SDL_BlitSurface(test,NULL,screen,&d); //In the official documentation, it is written that passing NULL to second argument takes entire source surface, so won’t be my “test” surface entirely blitted ???

SDL_Flip(screen)


The result is that I still get a black screen… :confused: no white square at position (150,150)

Mon, 15 Jul 2002 08:42:21 +0000
Jason Farmer a ?crit:

Hi Carlos,

If you don’t include all of the code in your example, other people can’t
compile it on their systems. This makes finding bugs difficult.
You have omitted the screen setup code, the bug may be in there and we
wouldn’t know. Also, you haven’t said what he actual problem is or what you
see on the screen. Does the screen go black or do you get an error of some
kind?

I think you may be getting your rects confused.
You haven’t defined a width or height for the rect r so they will be random
values.

Also, you are passing nil to the SDL_BlitSurface function for your destination
rect. You would only ever do this if your surface that you are blitting
covers the whole of the screen.

May I suggest that you create a destination rect. (the destination rect tells
SDL where to draw the image, but you have left yours blank)

SDL_Rect d;

d.x = 100;
d.y = 100;
d.w = 20;
d.h = 20;

then alter your source rect (the source rect tells SDL where to get the data
from to draw to the screen)

r.x = 0;
r.y = 0;
r.w = 20;
r.h = 20;

SDL_BlitSurface(test,&d,screen,&r);

All this aside, If you just want to display a coloured square, why not take a
look at SDL_FillRect

Hope this helps

Jason

I already know how to setup a screen window, that’s why I don’t specify the
code for the screen variable. Below the comments " /* window … */ ",
just after le SDL_Rect declaration, you must understand that I put a window
setup for “screen” (which uses le SDL_SetVideoMode)

Just the think I want to do, is drawing a little square into the screen
WITH the “test” variable…

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test =
SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);
//square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to black
SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my square to
white SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this doen’t
work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what I
writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you to
read some tutorials.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

And I made a mistake at the begining of my test declaration you must
understant “SDL_Surface *test”, and not “SDL_Surface test”

:)> ----- Original Message -----

From: citrouille@wanadoo.fr (Carlos Alvarez)
To:
Cc:
Sent: Monday, July 15, 2002 12:57 PM
Subject: Re: [SDL] Trying to display a colored surface

I will explain better my problem…
I have no error but I still get a black screen

I do :


SDL_Surface test;
test =
SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);
//mask are already setup
//this creates for me a 100x100 square, right ?


So I thought that my memory surface would be fully size and create.
then I create just one rectangle to give position into the screen


SDL_Rect r;
r.x = 150; r.y=150; //this mean that I want to place “test” at position
150,150 in the screen, right ?


and I fill my rectangles to be sure I see somethink
(here starts the main loop)


SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is a
1024x768x16 window
SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white


finally I blit


SDL_BlitSurface(test,NULL,screen,&d); //In the official documentation, it
is written that passing NULL to second argument takes entire source surface,
so won’t be my “test” surface entirely blitted ???

SDL_Flip(screen)


The result is that I still get a black screen… :confused: no white square at
position (150,150)

Mon, 15 Jul 2002 08:42:21 +0000
Jason Farmer a ?crit:

Hi Carlos,

If you don’t include all of the code in your example, other people can’t
compile it on their systems. This makes finding bugs difficult.
You have omitted the screen setup code, the bug may be in there and we
wouldn’t know. Also, you haven’t said what he actual problem is or what
you

see on the screen. Does the screen go black or do you get an error of
some

kind?

I think you may be getting your rects confused.
You haven’t defined a width or height for the rect r so they will be
random

values.

Also, you are passing nil to the SDL_BlitSurface function for your
destination

rect. You would only ever do this if your surface that you are blitting
covers the whole of the screen.

May I suggest that you create a destination rect. (the destination rect
tells

SDL where to draw the image, but you have left yours blank)

SDL_Rect d;

d.x = 100;
d.y = 100;
d.w = 20;
d.h = 20;

then alter your source rect (the source rect tells SDL where to get the
data

from to draw to the screen)

r.x = 0;
r.y = 0;
r.w = 20;
r.h = 20;

SDL_BlitSurface(test,&d,screen,&r);

All this aside, If you just want to display a coloured square, why not
take a

look at SDL_FillRect

Hope this helps

Jason

I already know how to setup a screen window, that’s why I don’t
specify the

code for the screen variable. Below the comments " /* window … */
",

just after le SDL_Rect declaration, you must understand that I put a
window

setup for “screen” (which uses le SDL_SetVideoMode)

Just the think I want to do, is drawing a little square into the
screen

WITH the “test” variable…

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test =

SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);

//square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to
black

SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my
square to

white SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this
doen’t

work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what
I

writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you
to

read some tutorials.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I will explain better my problem…
I have no error but I still get a black screen

I see two problems:


SDL_Rect r;
r.x = 150; r.y=150; //this mean that I want to place “test” at position 150,150 in the screen, right ?


You need to fill in the width and height members of the rect so the blit
will work.


SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is a 1024x768x16 window
SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white


These values may work, but the third parameter is a pixel, the format
of which may vary depending on the format of the destination surface.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is a 1024x768x16 window
SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white


These values may work, but the third parameter is a pixel, the format
of which may vary depending on the format of the destination surface.

So how do I setup a pixel to fill the surface ?

Hi Carlos

And I made a mistake at the begining of my test declaration you must
understant “SDL_Surface *test”, and not “SDL_Surface test”

Sorry, i didn’t even notice this. C isn’t my main programming language.

I will explain better my problem…
I have no error but I still get a black screen

So SDL is initialising OK by the look of it.

I do :


SDL_Surface test;
test =

SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);
//mask are already setup

//this creates for me a 100x100 square, right ?

yes. test should be 100x100 surface now


So I thought that my memory surface would be fully size and create.
then I create just one rectangle to give position into the screen


SDL_Rect r;
r.x = 150; r.y=150; //this mean that I want to place “test” at position

150,150 in the screen, right ?

As long as you use this rect as your destination, then yes.

and I fill my rectangles to be sure I see somethink
(here starts the main loop)


SDL_FillRect(screen, NULL, 0x00000000); //screen set to black, screen is
a

1024x768x16 window

SDL_FillRect(test, NULL, 0xFFFFFF00); //test to white


finally I blit


SDL_BlitSurface(test,NULL,screen,&d); //In the official documentation, it

Where is your rect called r?
I reckon that if you placed &r there instead of &d, you’d be fine.

remember, the destination is the area on the target surface you want to blit
to.

is written that passing NULL to second argument takes entire source
surface, so won’t be my “test” surface entirely blitted ???

yes, by passing NULL, the whole of your test surface will be used.

SDL_Flip(screen)


The result is that I still get a black screen… :confused: no white square at

Try changing your SDL_BlitSurface(test,NULL,screen,&d); to
SDL_BlitSurface(test,NULL,screen,&r); saying as the rect r is set up with the
screen co-ordinates you want to blit to.

Also, you may want to use the function SDL_MapRGB instead of supplying hex
values for colours.

So instead of SDL_FillRect(test, NULL, 0xFFFFFF00);
You would have SDL_FillRect(test, NULL, SDL_MapRBG(test->format,255,255,255));
Please forgive any inaccuracies in my C, it’s been a while :slight_smile:

Hope this helps

Jason>

position (150,150)

Mon, 15 Jul 2002 08:42:21 +0000

Jason Farmer <@Jason_Farmer> a ?crit:

Hi Carlos,

If you don’t include all of the code in your example, other people
can’t compile it on their systems. This makes finding bugs difficult.
You have omitted the screen setup code, the bug may be in there and we
wouldn’t know. Also, you haven’t said what he actual problem is or what

you

see on the screen. Does the screen go black or do you get an error of

some

kind?

I think you may be getting your rects confused.
You haven’t defined a width or height for the rect r so they will be

random

values.

Also, you are passing nil to the SDL_BlitSurface function for your

destination

rect. You would only ever do this if your surface that you are blitting
covers the whole of the screen.

May I suggest that you create a destination rect. (the destination rect

tells

SDL where to draw the image, but you have left yours blank)

SDL_Rect d;

d.x = 100;
d.y = 100;
d.w = 20;
d.h = 20;

then alter your source rect (the source rect tells SDL where to get the

data

from to draw to the screen)

r.x = 0;
r.y = 0;
r.w = 20;
r.h = 20;

SDL_BlitSurface(test,&d,screen,&r);

All this aside, If you just want to display a coloured square, why not

take a

look at SDL_FillRect

Hope this helps

Jason

I already know how to setup a screen window, that’s why I don’t

specify the

code for the screen variable. Below the comments " /* window … */

",

just after le SDL_Rect declaration, you must understand that I put a

window

setup for “screen” (which uses le SDL_SetVideoMode)

Just the think I want to do, is drawing a little square into the

screen

WITH the “test” variable…

So i do this


SDL_Surface *screen;
SDL_Surface test;
SDL_Rect r;
/
window setup an screen setup */

test =

SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);

//square setup

r.x = 100; r.y = 100;
while(1) //main loop
{
SDL_FillRect(screen, NULL, 0x00000000); //I color my screen to

black

SDL_FillRect(test, NULL, 0xFFFFFF00); //I want to color my

square to

white SDL_BlitSurface(test,NULL,screen,&r); //then draw it, this

doen’t

work

SDL_Flip(screen);
}

what can I do to just display a little colored square if not what

I

writen ???

To setup a window you must use SDL_SetVideoMode().
SDL_CreateRGBSurface() creates an offscreen surface. I suggest you

to

read some tutorials.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I am very confused, I still get full black screen, you must know that I manage to load bitmaps (and still don’t manage to fill rects)
So I will give you the whoooole piece of code I want to use :slight_smile:

but first :

Try changing your SDL_BlitSurface(test,NULL,screen,&d); to
SDL_BlitSurface(test,NULL,screen,&r); saying as the rect r is set up with the
screen co-ordinates you want to blit to.

Yes that was a copy mistake :slight_smile:

Also, you may want to use the function SDL_MapRGB instead of supplying hex
values for colours.

So instead of SDL_FillRect(test, NULL, 0xFFFFFF00);
You would have SDL_FillRect(test, NULL, SDL_MapRBG(test->format,255,255,255));
Please forgive any inaccuracies in my C, it’s been a while :slight_smile:

Still don’t see square…

But here is my code :

/*********** start ****************/
#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL/SDL_Image.h>

int main(void)
{
SDL_Surface *screen; //here the display window
SDL_Surface *test; //a square
SDL_Rect d; //for square destination position
SDL_Event ev; //for futur events

Uint32 rmask, gmask, bmask, amask;	
#if SDL_BYTEORDER == SDL_BIG_ENDIAN //setup mask colors
  rmask = 0xff000000;
  gmask = 0x00ff0000;
  bmask = 0x0000ff00;
  amask = 0x000000ff;
#else
  rmask = 0x000000ff;
  gmask = 0x0000ff00;
  bmask = 0x00ff0000;
  amask = 0xff000000;
#endif


SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER);

//initialization
if(SDL_WasInit(SDL_INIT_VIDEO)!=0)
	printf("** Video init.\n");
else
	printf("** No video.\n");
if(SDL_WasInit(SDL_INIT_TIMER)!=0)
	printf("** Time init.\n");
else
	printf("** No timer.\n");

//setup surfaces
screen = SDL_SetVideoMode(800,600,16,SDL_HWSURFACE|SDL_DOUBLEBUF);
test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);

d.x = 150; //position where I want to blit the 'test' square into the screen
d.y = 150;

while(1) //main loop
{
	while (SDL_PollEvent(&ev))
	{
		switch(ev.type) //events
		{
			case SDL_QUIT:
				SDL_Quit();					
				printf("** End\n");
				exit(0);
				break;
			default:
				printf("** Unknown Event\n");
		}
	}
	
	// here we draw all
	SDL_FillRect(screen, NULL, SDL_MapRGB(Screen->format,0,0,0)); //to black
	SDL_FillRect(test, NULL, SDL_MapRGBA(test->format,255,255,255,0)); //to white

	SDL_BlitSurface(test,NULL,screen,&d); //blits test into screen
	//some people said that I should put a SOUCE RECTANGLE in second argument, but official
	// SDL documention says that if we pass NULL, whole source Surface is taken for blit.
	
	SDL_Flip(screen);
}

}

/*********** end ****************/

Conclusion = why still a black screen with no white square ?

#if SDL_BYTEORDER == SDL_BIG_ENDIAN //setup mask colors
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif

These are bitmasks for 32bit bitmaps…

test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,rmask,gmask,bmask,amask);

And you are passing the to a 16bit bitmap.

Use this:

    test = SDL_CreateRGBSurface(SDL_SWSURFACE,100,100,16,
            screen->format->Rmask,screen->format->Gmask,
            screen->format->Bmask,screen->format->Amask);

You should also remeber some other details (maybe they are only missing
because it’s a test program):

The most important thing is that almost any target supports HWSURFACEs
or DBUFFERing on a windowed context, so you will not get what you want
from your SDL_SetVideoMode call. Also, on windowed apps, if you can,
stick to the desktop display pixelformat, otherwise you can have big
performance losses. You only have to specify depth = 0 to obtain this.

Remember to use:

#include “SDL.h”

instead of

#include <SDL/SDL.h>

Check the SDL_Init() returncode, if it’s <0 it’s quite sure you cannot
obtain what you ask from SDL so you have to abort…

If you use exit() to quit the program add:

atexit(SDL_Quit);

just after a successfull SDL_Init();

Bye,
GabryOn Tue, 2002-07-16 at 13:11, Carlos wrote:

citrouille at wanadoo.fr wrote:

d.x = 150; file://position where I want to blit the ‘test’ square into
the screen
d.y = 150;

SDL_BlitSurface(test,NULL,screen,&d); file://blits test into screen

Conclusion = why still a black screen with no white square ?

Because you’re not supplying a full destination rectangle? I think
someone already pointed this out. I don’t think you can just set d.x and
d.y for the position. You also need to set d.w and d.h to make a full
rectangle.

(You should probably also check the return values of
SDL_CreateRGBSurface and SDL_SetVideoMode, although I doubt they’re the
problem here.)–
Kylotan

Thanx for Gabriele for his working solution :slight_smile:

for Kylotan :

Because you’re not supplying a full destination rectangle? I think
someone already pointed this out. I don’t think you can just set d.x and
d.y for the position. You also need to set d.w and d.h to make a full
rectangle.

See that at http://sdldoc.csn.ul.ie/sdlblitsurface.php

int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
Description
This performs a fast blit from the source surface to the destination surface.

The width and height in srcrect determine the size of the copied rectangle. Only the position is used in the dstrect (the width and height are ignored).

If srcrect is NULL, the entire surface is copied. If dstrect is NULL, then the destination position (upper left corner) is (0, 0).

bye bye :slight_smile: