GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_gamma_correction.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2009-2024 Cyril Hrubis <metan@ucw.cz>
4 */
5
81#ifndef CORE_GP_GAMMA_CORRECTION_H
82#define CORE_GP_GAMMA_CORRECTION_H
83
84#include <stdint.h>
85#include <core/gp_types.h>
86#include <core/gp_pixel.gen.h>
87#include <core/gp_gamma_correction.gen.h>
88
99
103typedef struct gp_gamma_table {
107 float gamma;
108
110 uint8_t in_bits;
112 uint8_t out_bits;
113
115 unsigned int ref_count;
116 struct gp_gamma_table *next;
117
119 union {
120 uint8_t u8[0];
121 uint16_t u16[0];
122 };
124
145
160 gp_correction_type corr_type, float gamma);
161
173
182
190
196void gp_gamma_print(const gp_gamma *self);
197
198#endif /* CORE_GP_GAMMA_CORRECTION_H */
A common types.
gp_gamma * gp_gamma_incref(gp_gamma *gamma)
Increases reference counters.
void gp_gamma_decref(gp_gamma *self)
Decreases reference counters.
void gp_gamma_print(const gp_gamma *self)
Prints info about gamma table into the stdout.
const char * gp_correction_type_name(gp_correction_type type)
Returns correction name.
A pixel defintions generated from gen/include/gfxprim_config.py.
#define GP_PIXEL_CHANS_MAX
Maximal number of channels per all defined pixel types.
gp_pixel_type
List of all pixel types.
gp_correction_type
A list of supported correction types.
gp_gamma * gp_gamma_acquire(gp_pixel_type pixel_type, gp_correction_type corr_type, float gamma)
Acquires a gamma tables for a given pixel type, correction type and a gamma value.
@ GP_CORRECTION_SRGB
Standard RGB - gamma = 2.2 linearized near zero.
@ GP_CORRECTION_GAMMA
Classical gamma correction.
A lookup gamma table.
uint8_t in_bits
Number of input bits.
float gamma
Gamma for GP_CORRECTION_GAMMA.
unsigned int ref_count
Reference counter.
uint8_t out_bits
Number of output bits.
gp_correction_type type
Correction type.
A correction tables for all pixel channels.
unsigned int ref_count
Reference counter.
gp_gamma_table * lin[4]
Tables to linearize channel values.
gp_gamma_table * enc[4]
Tables to encode the values back.
gp_pixel_type pixel_type
Pixel type the table could be used for.