When to call SDL _ blitsurface on a locked surface?

When to call SDL _ blitsurface on a locked surface?

You should call SDL_BlitSurface() unless you know exactly how SDL blitting works internally and how to use the other blit functions. This is the public blit function, and it performs rectangle validation and clipping before passing it to SDL_LowerBlit(). The blit function should not be called on a locked surface.

Which is the public blit function in SDL?

You should call SDL_BlitSurface () unless you know exactly how SDL blitting works internally and how to use the other blit functions. This is the public blit function, and it performs rectangle validation and clipping before passing it to SDL_LowerBlit ().

How to properly use SDL _ blitsurface ( ) in C + +?

The selectionRect was set relative to the screen, while the selectionCanvas had the width and height of a particular menu item. So, the filling was done out of bounds of the selectionCanvas. Adding separate SDL_Rect for filling solved the problem.

Why is my SDL blitsurface all black?

SDLScreen.cpp: The selection rectangle for the active menu item should be blue, but it shows up in black. The file selection.bmp is also all black. Edit 2: I found out what created the problem.

What does the blit function do in SDL?

This is the public blit function, and it performs rectangle validation and clipping before passing it to SDL_LowerBlit (). The blit function should not be called on a locked surface. The width and height in srcrect determine the size of the copied rectangle.

What happens to blits with negative dstrect coordinates?

Blits with negative dstrect coordinates will be clipped properly. If srcrect is NULL, the entire surface is copied. If dstrect is NULL, then the destination position (upper left corner) is (0, 0). The final blit rectangle is saved in dstrect after all clipping is performed ( srcrect is not modified).

What happens if srcrect is null in blitsurface?

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). Blits with negative dstrect coordinates will be clipped properly. If srcrect is NULL, the entire surface is copied. If dstrect is NULL, then the destination position (upper left corner) is (0, 0).