Commit Graph

68 Commits

Author SHA1 Message Date
Sam Lantinga
282cf286fc SDL_GetPixelFormatName() returns a string 2024-07-12 05:59:45 -07:00
SDL Wiki Bot
fdc04708f1 Sync SDL3 wiki -> header 2024-07-10 07:48:48 +00:00
Sam Lantinga
2ba76dbe80 Simplified SDL_Surface
SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
2024-07-10 00:48:18 -07:00
Sam Lantinga
4fa5196820 Revert "Switch pixel format loss fields to number of bits"
This reverts commit 3c90b1c1f6.

It turns out this is problematic for sdl2-compat. We're investigating a more complete separation between SDL2 and SDL3 surfaces, but in the meantime, I'll fix the breakage.
2024-07-07 19:41:05 -07:00
Sam Lantinga
3c90b1c1f6 Switch pixel format loss fields to number of bits
This makes more sense and handles pixel formats with > 8 bits per channel

Fixes https://github.com/libsdl-org/SDL/issues/10168
2024-07-06 11:37:16 -07:00
Sam Lantinga
0fa74d8aa8 Wiki-compatible documentation for SDL_ALPHA_OPAQUE and SDL_ALPHA_TRANSPARENT 2024-07-06 05:53:40 -07:00
Sam Lantinga
aeea819494 Added colorspace to SDL_CameraSpec 2024-06-16 17:47:16 -07:00
Ryan C. Gordon
51902d4ac5
Updated headers with latest wikiheaders tweaks. 2024-06-14 02:09:55 -04:00
Ryan C. Gordon
e23257307e Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.

This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.

Fixes #9902.

(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
Sam Lantinga
df25e4022d Removed short aliases for 16-bit pixel formats
These were potentially misleading in the same way the RGB888/BGR888 aliases were

Fixes https://github.com/libsdl-org/SDL/issues/4994
2024-05-27 07:24:46 -07:00
Sam Lantinga
6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00
Ryan C. Gordon
5e6d85b8f0
wikiheaders: bridge wiki Category docs to the headers!
Did an initial cleanup on the headers and wrote a few pieces of documentation,
but this needs more work to fill out the documentation.
2024-05-16 11:48:23 -04:00
SDL Wiki Bot
8af26cf463 Sync SDL3 wiki -> header 2024-05-08 07:53:33 +00:00
Ryan C. Gordon
e14ba41689
Some minor documentation tweaks. 2024-05-08 03:52:31 -04:00
Ryan C. Gordon
0e0bb22f79
include: More documentation updates. 2024-05-02 23:25:45 -04:00
Petar Popovic
b98116a996 Removing trailing commas in enums in SDL headers
Trailing commas in enums is a C99 feature.
This commit removes them in SDL headers for ANSI compatibility.
2024-04-24 09:44:41 -04:00
Ryan C. Gordon
0df988389c
include: Add \since to all documentation that was missing it. 2024-04-11 13:34:29 -04:00
Petar Popovic
132cef91c8 Removing macro SDL_FColour from SDL_pixels.h 2024-04-09 18:20:03 -04:00
Petar Popovic
f687e0732a Doxygen comment fixes in SDL_pixels.h 2024-04-09 16:57:34 -04:00
Petar Popovic
9b5944a14f Removing SDL_Colour macro 2024-04-09 12:25:36 -04:00
Ryan C. Gordon
e044318a8e
Sync SDL3 wiki -> headers 2024-04-09 00:50:03 -04:00
Ryan C. Gordon
ad090d2444
include: A ton of little documentation tweaks, fixes, and improvements.
This is just stuff I noticed while working on the wikiheaders updates. A
thorough pass over all the docs would not be terrible, and maybe a simple
script to check for consistency (does everything have a `\since` on it? etc)
might be nice, too.
2024-04-09 00:50:02 -04:00
Petar Popovic
3f8dba3713 Including SD_error.h into headers with error-returning functions 2024-04-04 11:12:58 -07:00
Sam Lantinga
171ff041d0 Removed invalid ascii from headers 2024-03-23 16:31:00 -07:00
Sam Lantinga
d8a54cd4f8 Updated "see also" references to be more consistent
Fixes https://github.com/libsdl-org/SDL/issues/9282
2024-03-17 12:28:11 -07:00
SDL Wiki Bot
59ab5c0824 Sync SDL3 wiki -> header 2024-03-07 00:20:27 +00:00
Sam Lantinga
c70710cde8 SDL_GetPixelFormatEnumForMasks() returns SDL_PixelFormatEnum 2024-03-06 16:19:08 -08:00
Susko3
424616e032 Use SDL_PixelFormatEnum as type 2024-03-06 15:02:13 -08:00
Sam Lantinga
db24560387 Additional colorspace clarification
Note that SDL_MATRIX_COEFFICIENTS_BT470BG is functionally equivalent to SDL_MATRIX_COEFFICIENTS_BT601
2024-03-05 16:47:36 -08:00
Sam Lantinga
b3858ec5f7 BT2020_CL is very different from BT2020_NCL, and not currently supported 2024-03-05 15:49:17 -08:00
Sam Lantinga
f2cd361e25 testyuv: added validation of P010 YUV format
Also added conversion between RGB and P010, using XRGB2101010 as a bridging format in PQ space
2024-03-01 20:26:52 -08:00
Sam Lantinga
220340e944 Remove SDL_PIXELFORMAT_P010
It's not supported by any renderer or pixel conversion path
2024-02-27 12:48:33 -08:00
Sam Lantinga
4ba6aeee9d A second take on HDR support with an SDR white point and HDR headroom
This better reflects how HDR content is actually used, e.g. most content is in the SDR range, with specular highlights and bright details beyond the SDR range, in the HDR headroom.

This more closely matches how HDR is handled on Apple platforms, as EDR.

This also greatly simplifies application code which no longer has to think about color scaling. SDR content is rendered at the appropriate brightness automatically, and HDR content is scaled to the correct range for the display HDR headroom.
2024-02-21 19:25:49 -08:00
Sam Lantinga
cacac6cc34 Updated structure and field names for consistency
Type names are camel case and field names are snake case except for fields ending in id, which are capitalized.

Fixes https://github.com/libsdl-org/SDL/issues/6955
2024-02-11 08:27:56 -08:00
Sam Lantinga
e74171b1ae Added support for HDR10 video playback on direct3d11
Fixes https://github.com/libsdl-org/SDL/issues/8053
2024-02-05 09:45:39 -08:00
Sam Lantinga
327b976bc4 SDL_COLORSPACE_JPEG is the default YUV colorspace 2024-02-04 13:09:40 -08:00
Sam Lantinga
50a805cdd1 Use YUV colorspaces instead of a global YUV conversion mode
Fixes https://github.com/libsdl-org/SDL/issues/8669
2024-02-03 07:36:18 -08:00
Sam Lantinga
9591b2cfb4 Finalized the SDL render API colorspaces
The renderer will always use the sRGB colorspace for drawing, and will default to the sRGB output colorspace. If you want blending in linear space and HDR support, you can select the scRGB output colorspace, which is supported by the direct3d11 and direct3d12
2024-02-02 13:13:53 -08:00
Sam Lantinga
3c45544a14 Added a slow blit function to handle large pixel formats and colorspace conversion 2024-01-31 09:50:46 -08:00
Amun
4a759b340f Fixes in SDL_ColorSpace (SDL_pixels.h) 2024-01-30 11:16:53 -08:00
Sam Lantinga
f257eb4481 Added the concept of colorspace to the SDL renderer
This allows color operations to happen in linear space between sRGB input and sRGB output. This is currently supported on the direct3d11, direct3d12 and opengl renderers.

This is a good resource on blending in linear space vs sRGB space:
https://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/

Also added testcolorspace to verify colorspace changes
2024-01-30 09:48:02 -08:00
Sam Lantinga
554f0625d3 Renderer colors now have floating point precision 2024-01-30 09:48:02 -08:00
Sam Lantinga
61a3a163db Fixed typo (thanks @Akaricchi!) 2024-01-29 18:48:41 -08:00
Sam Lantinga
61b5c38e6e Added the initial concept of colorspace to SDL 2024-01-28 18:24:39 -08:00
Sam Lantinga
aeac8774f7 Missed one 2024-01-25 16:53:19 -08:00
Sam Lantinga
d0dd60c8ba Updated new pixel format names to be more consistent with the others 2024-01-25 16:51:22 -08:00
Sam Lantinga
0f78aa7c30 Add some high bit-depth pixel formats
These are not fully supported yet, just preparing for future work.
2024-01-25 16:40:46 -08:00
Sam Lantinga
5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Sam Lantinga
30a2291d59 Fixed compatibility with sdl2-compat (thanks @sezero!) 2023-11-20 08:46:12 -08:00
Cameron Cawley
753bbd199e Add SDL_PIXELFORMAT_INDEX2LSB and SDL_PIXELFORMAT_INDEX2MSB 2023-11-17 08:45:32 -08:00