Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL2/SDL_Surface: Updated. #598

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions SDL2/SDL_Surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ typedef struct SDL_Surface
} SDL_Surface;
```

## Code examples

```c
/* This is meant to show how to edit a surface's pixels on the CPU, but
normally you should use SDL_FillRect() to wipe a surface's contents. */
void WipeSurface(SDL_Surface *surface)
{
/* This is fast for surfaces that don't require locking. */
/* Once locked, surface->pixels is safe to access. */
SDL_LockSurface(surface);

/* This assumes that color value zero is black. Use
SDL_MapRGBA() for more robust surface color mapping! */
/* height times pitch is the size of the surface's whole buffer. */
SDL_memset(surface->pixels, 0, surface->h * surface->pitch);

SDL_UnlockSurface(surface);
}
```

## Remarks

This structure should be treated as read-only, except for `pixels`, which,
Expand Down
3 changes: 2 additions & 1 deletion SDL3/CategoryAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ probably want to look at the [API by category](APIByCategory) instead.
- [SDL_LockSurface](SDL_LockSurface)
- [SDL_LockTexture](SDL_LockTexture)
- [SDL_LockTextureToSurface](SDL_LockTextureToSurface)
- [SDL_log](SDL_log)
- [SDL_Log](SDL_Log)
- [SDL_log](SDL_log)
- [SDL_log10](SDL_log10)
- [SDL_log10f](SDL_log10f)
- [SDL_LogCritical](SDL_LogCritical)
Expand All @@ -721,6 +721,7 @@ probably want to look at the [API by category](APIByCategory) instead.
- [SDL_LogInfo](SDL_LogInfo)
- [SDL_LogMessage](SDL_LogMessage)
- [SDL_LogMessageV](SDL_LogMessageV)
- [SDL_LogTrace](SDL_LogTrace)
- [SDL_LogVerbose](SDL_LogVerbose)
- [SDL_LogWarn](SDL_LogWarn)
- [SDL_lround](SDL_lround)
Expand Down
1 change: 1 addition & 0 deletions SDL3/CategoryAPIEnumerators.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@
- [SDL_LOG_PRIORITY_ERROR](SDL_LOG_PRIORITY_ERROR)
- [SDL_LOG_PRIORITY_INFO](SDL_LOG_PRIORITY_INFO)
- [SDL_LOG_PRIORITY_INVALID](SDL_LOG_PRIORITY_INVALID)
- [SDL_LOG_PRIORITY_TRACE](SDL_LOG_PRIORITY_TRACE)
- [SDL_LOG_PRIORITY_VERBOSE](SDL_LOG_PRIORITY_VERBOSE)
- [SDL_LOG_PRIORITY_WARN](SDL_LOG_PRIORITY_WARN)
- [SDL_LOGICAL_PRESENTATION_DISABLED](SDL_LOGICAL_PRESENTATION_DISABLED)
Expand Down
3 changes: 2 additions & 1 deletion SDL3/CategoryAPIFunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ to look at the Functions section [in a specific category](APIByCategory) instead
- [SDL_LockSurface](SDL_LockSurface)
- [SDL_LockTexture](SDL_LockTexture)
- [SDL_LockTextureToSurface](SDL_LockTextureToSurface)
- [SDL_log](SDL_log)
- [SDL_Log](SDL_Log)
- [SDL_log](SDL_log)
- [SDL_log10](SDL_log10)
- [SDL_log10f](SDL_log10f)
- [SDL_LogCritical](SDL_LogCritical)
Expand All @@ -721,6 +721,7 @@ to look at the Functions section [in a specific category](APIByCategory) instead
- [SDL_LogInfo](SDL_LogInfo)
- [SDL_LogMessage](SDL_LogMessage)
- [SDL_LogMessageV](SDL_LogMessageV)
- [SDL_LogTrace](SDL_LogTrace)
- [SDL_LogVerbose](SDL_LogVerbose)
- [SDL_LogWarn](SDL_LogWarn)
- [SDL_lround](SDL_lround)
Expand Down
1 change: 1 addition & 0 deletions SDL3/CategoryLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Here's where the messages go on different platforms:
- [SDL_LogInfo](SDL_LogInfo)
- [SDL_LogMessage](SDL_LogMessage)
- [SDL_LogMessageV](SDL_LogMessageV)
- [SDL_LogTrace](SDL_LogTrace)
- [SDL_LogVerbose](SDL_LogVerbose)
- [SDL_LogWarn](SDL_LogWarn)
- [SDL_ResetLogPriorities](SDL_ResetLogPriorities)
Expand Down
Loading