nirdu
asked on
How to change Brightness ????
Hi
How can I change the brightness of the screen / window application ??
I have tried using the SetColorAdjustment function but nothing happend when I chenged the caBrightness parameterof the tagCOLORADJUSTMENT.
This is what i did :
procedure TForm1.Button1Click(Sender : TObject);
var
hw : HWND;
nc : tagCOLORADJUSTMENT;
begin
//I first got the normal tagCOLORADJUSTMENT of the form :
hw := Form1.Handle;
GetColorAdjustment(GetDevi ceContext( hw),nc);
//and then I try to change it and set it back:
nc.caBrightness := 50;
nc.caIlluminantIndex := ILLUMINANT_B;
SetColorAdjustment(GetDevi ceContext( hw),nc);
Refresh;
end;
what can I do to make it work ??
Is there other functions to use ??
Thanks
How can I change the brightness of the screen / window application ??
I have tried using the SetColorAdjustment function but nothing happend when I chenged the caBrightness parameterof the tagCOLORADJUSTMENT.
This is what i did :
procedure TForm1.Button1Click(Sender
var
hw : HWND;
nc : tagCOLORADJUSTMENT;
begin
//I first got the normal tagCOLORADJUSTMENT of the form :
hw := Form1.Handle;
GetColorAdjustment(GetDevi
//and then I try to change it and set it back:
nc.caBrightness := 50;
nc.caIlluminantIndex := ILLUMINANT_B;
SetColorAdjustment(GetDevi
Refresh;
end;
what can I do to make it work ??
Is there other functions to use ??
Thanks
ASKER
I want to change the whole window brightnes / contrast / colors. Not just the imeges inside it, but also the menues, captions, buttons, status bars, and so on ... !!!
Is changing the palette is the answer for it ?
If it is how can I change a palette ?
How can I couse this change to affect all the project windows (should I change a pallet for each form seperate) ?
Is changing the palette is the answer for it ?
If it is how can I change a palette ?
How can I couse this change to affect all the project windows (should I change a pallet for each form seperate) ?
shaneholmes, as far as I know, it is possible to adjust monitor's settings by using DirectX.
nirdu, about changing brightness for a single app - can't you just use brighter backgrounds, fonts etc?
nirdu, about changing brightness for a single app - can't you just use brighter backgrounds, fonts etc?
ZhaawZ,
right - exactly - and as far as i know, it is determined by hardware/ monitor drivers... and is found more in a graphics type environment (GAMES), etc.
However, im listening......... i've been known to be wrong many times.......
Shane
right - exactly - and as far as i know, it is determined by hardware/ monitor drivers... and is found more in a graphics type environment (GAMES), etc.
However, im listening......... i've been known to be wrong many times.......
Shane
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Codedk
Thanks for your delphi code example its working great.
(-:
I used that code and changed the line :
V := Round(255 * Power(I / 255, Abs(Value) / 255)); //only for brighter screen
to :
V := Round(255 * power(I / 255, 1/(Abs(Value) / 255))); //only for darker screen
That way I can make the screen darker.
But for now the darknes and brightnes is very limited.
What can I change in that code so I can make the screen more darker / brighter then it can be ??
Thanks for your delphi code example its working great.
(-:
I used that code and changed the line :
V := Round(255 * Power(I / 255, Abs(Value) / 255)); //only for brighter screen
to :
V := Round(255 * power(I / 255, 1/(Abs(Value) / 255))); //only for darker screen
That way I can make the screen darker.
But for now the darknes and brightnes is very limited.
What can I change in that code so I can make the screen more darker / brighter then it can be ??
Didnt check it but what happens if you revert the fraction...
ASKER
I have noticed one more thing about that delphi code u gave me.
When I change the brightnes the white color stays the same (it never changes to darker white or brighter white).
I tried to change the white color manually in the SetGamma function by adding the line :
if V = 0 then V := 50;
after the calculation of V.
But still the white color stay the same.
Whay is that ? How can I change it ?
Cant check it right now unfortunately... :/
If v=0 ?? Are u sure V=0 ?
procedure ChangeGammaRamp;
var
n, c, cr, cg, cb : integer;
ramp : array [0..2] of array [0..255] of word;
begin
// cr, cg and cb are -128 .. +128
cr := 50;
cg := 60;
cb := 70;
for n := 0 to 255 do begin
c := (n + cr) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[0, n] := c;
c := (n + cg) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[1, n] := c;
c := (n + cb) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[2, n] := c;
end;
SetDeviceGammaRamp(dc, ramp);
end;
var
n, c, cr, cg, cb : integer;
ramp : array [0..2] of array [0..255] of word;
begin
// cr, cg and cb are -128 .. +128
cr := 50;
cg := 60;
cb := 70;
for n := 0 to 255 do begin
c := (n + cr) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[0, n] := c;
c := (n + cg) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[1, n] := c;
c := (n + cb) shl 8; if c > $ffff then c := $ffff else if c < 0 then c := 0; ramp[2, n] := c;
end;
SetDeviceGammaRamp(dc, ramp);
end;
Thanks
:/
:/
You can do a certain amount of this within a display driver by adjusting
the colors in the hardware palette, but there's no way for an application
to do so on a system-wide basis.
You see this done in Games - HOW? It is changed in the image shown, not in the hardware settings. So you could change your program's colours to make it appear brighter or darker.
Now if its an image in your app - you could do this. There are many examples (do a google search) for changing brightness / contrast of images.
Sorry!
sholmes