From: "Philipp Pammler" Newsgroups: borland.public.delphi.graphics References: <3d4bda88_1@dnews> Subject: Re: Gamma Date: Sat, 14 Sep 2002 17:58:46 +0200 Lines: 74 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 212.93.17.111 Message-ID: <3d83b4d4@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1032041684 212.93.17.111 (14 Sep 2002 15:14:44 -0700) Path: newsgroups.borland.com!not-for-mail Xref: newsgroups.borland.com borland.public.delphi.graphics:51239 hi kim this should help u a bit type TGammaRamp = packed record R : array[0..255] of word; G : array[0..255] of word; B : array[0..255] of word; end; var SYS_OldGamma : TGammaRamp; // storeoldgamma // procedure StoreOldGamma; var DC : HDC; begin DC := GetDC(0); GetDeviceGammaRamp(DC, SYS_OldGamma); ReleaseDC(0, DC); end; // restoreoldgamma // procedure RestoreOldGamma; var DC : HDC; begin DC := GetDC(0); SetDeviceGammaRamp(DC, SYS_OldGamma); ReleaseDC(0, DC); end; // setgamma // to 0 = brighter, to 255 = more normal gamma function SetGamma(Value : byte) : TGammaRamp; var I : integer; DC : HDC; V : integer; begin for I := 0 to 255 do begin V := Round(255 * Power(I / 255, Abs(Value) / 255)); if V > 255 then V := 255; Result.R[I] := V shl 8; Result.G[I] := V shl 8; Result.B[I] := V shl 8; end; DC := GetDC(0); SetDeviceGammaRamp(DC, Result); ReleaseDC(0, DC); end; - first backup the original gammaramp via "StoreOldGamma" - modify the ramp e.g. var MyGamma : TGammaRamp; begin MyGamma := SetGamma(ScrollBar1.Position); end; - when finishing u should restore the original gammaramp via "RestoreOldGamma" HTH, philipp.