Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_Gamma🞂SetGammaProcedure

SetGamma

Calculates global or custom power-law gamma lookup tables and notifies registered change listeners.

Declarations ​

pascal
procedure SetGamma; overload;
procedure SetGamma(Gamma: Double); overload;
procedure SetGamma(Gamma: Double; var GammaTable: TGammaTable8Bit); overload;
Overload Details

Overload 1 ​

pascal
procedure SetGamma; overload;

Recalculated global gamma encoding and decoding tables using DEFAULT_GAMMA (1.6).

Overload 2 ​

pascal
procedure SetGamma(Gamma: Double); overload;

Recalculates global gamma encoding and decoding tables using a specified power-law gamma exponent.

ParameterTypeDescription
GammaDoublePower-law gamma exponent (e.g. 1.6, 2.2).

Overload 3 ​

pascal
procedure SetGamma(Gamma: Double; var GammaTable: TGammaTable8Bit); overload;

Populates a custom 256-byte lookup table with values calculated from a specified power-law gamma exponent.

ParameterTypeDescription
GammaDoublePower-law gamma exponent.
GammaTableTGammaTable8BitTarget 256-byte table array to receive calculated gamma values.

Description ​

SetGamma calculates power-law gamma transformation values for 8-bit color channels (0…255).

Formula ​

For each entry i∈[0…255]:

GammaTable[i]=Round(255⋅(i255)γ)

Example ​

pascal
// Set global power-law gamma to standard display gamma 2.2
SetGamma(2.2);

// Or generate a custom lookup table for custom image processing
var
  CustomTable: TGammaTable8Bit;
begin
  SetGamma(1.8, CustomTable);
  ApplyCustomGamma(MyBitmap, CustomTable);
end;

See also ​