Updated GB_set_color_correction_mode (markdown)

Lior Halphon 2024-11-27 20:38:45 +02:00
parent 484f1ae1ca
commit 7ebabbe178
1 changed files with 29 additions and 2 deletions

@ -12,14 +12,41 @@ typedef enum {
} GB_color_correction_mode_t;
```
<tt>void GB_set_color_correction_mode([[GB_gameboy_t]] *gb, [[GB_color_correction_mode_t]] mode);</tt>
<tt>void GB_set_color_correction_mode([[GB_gameboy_t]] *gb, GB_color_correction_mode_t mode);</tt>
In `display.h`
## Description
TBD
The original hardware does not use the sRGB colorspace. This function selects which color correction algorithm is used by the emulator instance to convert RGB values from the model's color space to sRGB. The values supported are:
* `GB_COLOR_CORRECTION_DISABLED`: Colors are directly interpreted as sRGB, resulting in unbalanced colors and inaccurate hues
* `GB_COLOR_CORRECTION_CORRECT_CURVES`: Colors have their brightness corrected, but hues remain unbalanced
* `GB_COLOR_CORRECTION_MODERN_ACCURATE`: Emulates a modern display. Colors have their hues and brightness corrected
* `GB_COLOR_CORRECTION_MODERN_BALANCED`: Emulates a modern display. Blue contrast is moderately enhanced at the cost of slight hue inaccuracy
* `GB_COLOR_CORRECTION_MODERN_BOOST_CONTRAST`: Like Modern Balanced, but further boosts the contrast of greens and magentas that is lacking on the original hardware
* `GB_COLOR_CORRECTION_REDUCE_CONTRAST`: Slightly reduce the contrast to better represent the tint and contrast of the original display
* `GB_COLOR_CORRECTION_LOW_CONTRAST`: Harshly reduce the contrast to accurately represent the tint and low constrast of the original display
The following values are also available as deprecated aliases:
* `GB_COLOR_CORRECTION_EMULATE_HARDWARE = GB_COLOR_CORRECTION_MODERN_BALANCED`,
* `GB_COLOR_CORRECTION_PRESERVE_BRIGHTNESS = GB_COLOR_CORRECTION_MODERN_BOOST_CONTRAST`
## Thread Safety
`GB_set_color_correction_mode` is thread-safe and can be called from any thread and context.
## Notes
The currently emulated [[model|GB_model_t]] affects how color correction behaves. Super Game Boy, Game Boy Color, and Game Boy Advanced can all render the same RGB values as different colors.
This value is not used when emulating monochrome models because they do not use RGB values. To control the appearance of these models, use [[GB_set_palette|GB_set_palette and GB_get_palette]].
The Super Game Boy colorspace is very similar to sRGB and only requires a correction of the brightness curve. When emulating a Super Game Boy, any color correction mode other than `GB_COLOR_CORRECTION_DISABLED` will be treated like `GB_COLOR_CORRECTION_CORRECT_CURVES`.
## See Also
* [[GB_set_light_temperature]]
* [[GB_set_palette and GB_get_palette]]
* [[GB_set_rgb_encode_callback]]