Added SDL_SetRenderDrawColorspace() and SDL_GetRenderDrawColorspace()

This commit is contained in:
Sam Lantinga
2024-01-31 21:46:02 -08:00
parent 9c8b47b726
commit dd28ab0489
5 changed files with 64 additions and 1 deletions

View File

@@ -2757,6 +2757,30 @@ int SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
return 0;
}
int SDL_SetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace colorspace)
{
CHECK_RENDERER_MAGIC(renderer, -1);
if (colorspace != SDL_COLORSPACE_SRGB &&
colorspace != SDL_COLORSPACE_SCRGB) {
return SDL_SetError("Unsupported colorspace");
}
renderer->input_colorspace = colorspace;
return 0;
}
int SDL_GetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace *colorspace)
{
CHECK_RENDERER_MAGIC(renderer, -1);
if (colorspace) {
*colorspace = renderer->input_colorspace;
}
return 0;
}
int SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
const float fR = (float)r / 255.0f;