mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-16 11:25:47 +00:00
Simplified SDL_CreateRGBSurface* functions
This commit is contained in:
@@ -169,28 +169,28 @@ SDL_CreateRGBSurfaceFrom() and SDL_CreateRGBSurfaceWithFormatFrom() have been co
|
|||||||
|
|
||||||
You can implement the old functions in your own code easily:
|
You can implement the old functions in your own code easily:
|
||||||
```c
|
```c
|
||||||
|
SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurface(width, height,
|
||||||
|
SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
|
SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format)
|
||||||
{
|
{
|
||||||
return SDL_CreateSurface(width, height, format);
|
return SDL_CreateSurface(width, height, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface * SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
|
|
||||||
{
|
|
||||||
return SDL_CreateSurfaceFrom(pixels, width, height, pitch, format);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
|
||||||
{
|
|
||||||
return SDL_CreateRGBSurfaceWithFormat(flags, width, height, depth,
|
|
||||||
SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
|
||||||
{
|
{
|
||||||
return SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, depth, pitch,
|
return SDL_CreateSurfaceFrom(pixels, width, height, pitch,
|
||||||
SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
|
SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 format)
|
||||||
|
{
|
||||||
|
return SDL_CreateSurfaceFrom(pixels, width, height, pitch, format);
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
But if you're migrating your code which uses masks, you probably have a format in mind, possibly one of these:
|
But if you're migrating your code which uses masks, you probably have a format in mind, possibly one of these:
|
||||||
|
|||||||
Reference in New Issue
Block a user