Fórum brilho das imagens #147180
18/03/2003
0
por exemplo, um botao ´Aumenta Brilho´, q faça algo como imagem.brilho := imagem.brilho +1, um botao menos brilho q faça o contrario, alguem sabe^?
vlw, alias, estou procurando um jeito de mecher em varias propriedades de imagens atraves do delphi.. c alguem souber mecher com as mardita imagem me da um toque! vlw
Anonymous
Curtir tópico
+ 0Posts
19/03/2003
Anonymous
http://www.lischke-online.de/ThemeManager.php
Gostei + 0
19/03/2003
Anonymous
1909- Como mudar o brilho de um imagem?
procedure Helligkeit(C:TCanvas; Faktor:Real);
var x, y: integer;
Color: LongInt;
R, G, B: Integer;
begin
with C do
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := Round(GetRValue(Color)*Faktor);
G := Round(GetGValue(Color)*Faktor);
B := Round(GetBValue(Color)*Faktor);
if R>255 then R:=255;
if G>255 then G:=255;
if B>255 then B:=255;
Pixels[x,Y]:=RGB(R,G,B);
end;
end;
1910- Como mudar o brilho de um imagem? (2)
type
TPixelBMP24 = packed record
R: byte;
G: byte;
B: byte;
end;
var
SrcBMP, DstBMP24: TBitmap;
procedure TForm1.FormCreate(sender: TObject);
begin
SrcBMP:=TBitmap.Create; {Src Bitmap erstellen}
SrcBMP.LoadFromFile(´datei´); //sollte 24Bit sein
DstBMP24:=TBitmap.Create; {24-Bit Dst Bitmap erstellen}
DstBMP24.PixelFormat:=pf24bit;
DstBMP24.Width:=SrcBmp.Width;
DstBMP24.Height:=SrcBmp.Height;
end;
function BMPRGBtoYUV(rgb: TPixelBMP24): TPixelBMP24;
var y,u,v:longint;
begin
y := rgb.G*150 + rgb.B*29 + rgb.R*77; // 0.587 x 256, 0.114 x 256, 0.299 x 256
u := (rgb.B shl 8 - y) * 144; // 0.564 x 256
v := (rgb.R shl 8 - y) * 183; // 0,713 x 256
Result.G :=y shr 8;
Result.B :=u shr 16 + $80;
Result.R :=v shr 16 + $80;
end;
function BMPYUVtoRGB(yuv: TPixelBMP24): TPixelBMP24;
var temp: integer;
begin
temp := yuv.G + (yuv.B - $80) * 256 div 144 ;
if temp > 0 then Result.B:=temp else Result.B:=0;
if temp > 255 then Result.B:=255;
temp := yuv.G + (yuv.R - $80) * 256 div 183 ;
if temp > 0 then Result.R:=temp else Result.R:=0;
if temp > 255 then Result.R:=255;
temp := (yuv.G shl 8 - Result.B*29 - Result.R*77) div 150;
if temp > 0 then Result.G:=temp else Result.G:=0;
if temp > 255 then Result.G:=255;
end;
procedure TForm1.Button4Click(Sender: TObject);
var x, y: integer;
SrcPixel: ^TPixelBMP24;
DstPixel: ^TPixelBMP24;
yuv: TPixelBMP24;
begin
for y:=0 to SrcBMP.Height-1 do // SrcBMP und DstBMP24 sind gleich groß !!!
begin
SrcPixel:=SrcBMP.ScanLine[y];
DstPixel:=DstBMP24.ScanLine[y];
for x:=0 to SrcBMP.Width-1 do
begin
yuv:=BMPRGBtoYUV(SrcPixel^);
yuv.R:=$80;
yuv.B:=$80;
DstPixel^ := BMPYUVtoRGB(yuv);
inc(SrcPixel);
inc(DstPixel);
end;
end;
Image1.Picture.Graphic:=DstBMP24;
end;
1911- Como tingir uma imagem?
procedure Faerben(C:TCanvas);
var x, y: integer;
Color: LongInt;
R, G, B, Gr: Byte;
begin
with C do
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := GetRValue(Color);
G := GetGValue(Color);
B := GetBValue(Color);
Gr := Trunc(B*0.11+G*0.59+R*0.3);
//*************************
Pixels[x,Y]:=RGB(Gr,0,0);
// Pixels[x,Y]:=RGB(0,0,Gr); -> Blau
//*************************
end;
end;
1912- Como converter uma imagem em tons cinzentos?
procedure GrauStufen(C:TCanvas);
var x, y: integer;
Color: LongInt;
R, G, B, Gr: Byte;
begin
with C do begin
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := GetRValue(Color);
G := GetGValue(Color);
B := GetBValue(Color);
Gr:= Trunc(B*0.11+G*0.59+R*0.3);
Pixels[x,Y] := RGB(Gr, Gr, Gr);
end;
end;
end;
Gostei + 0
15/02/2004
Luciano2080
Luciano Lourenco
luciano@branco-produtos.com.br
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)