procedure TForm1.ScreenToLine;
var
Handle: THandle;
iFor, iFor2: Integer;
bRed, bGreen, bBlue: Byte;
PixelColor: Integer;
bXgesRed, bXgesGreen, bXgesBlue: Integer;
//Duchschnittsfarben Horizontal
bYgesRed, bYgesGreen, bYgesBlue: Integer;
//Duchschnittsfarben Vertikal
begin
Handle := GetDC(0);
try
bXgesBlue := 0;
bXgesGreen := 0;
bXgesRed := 0;
for iFor := 0
to 20
do
begin
bYgesBlue := 0;
bYgesGreen := 0;
bYgesRed := 0;
for iFor2 := 0
to 16
do
begin
//jeden 64-ten Pixel in der Horizontalen addieren
PixelColor := GetPixel(
Handle, (iFor * 64), (iFor2 * 64));
bBlue := PixelColor;
bGreen := PixelColor
shr 8;
bRed := PixelColor
shr 16;
bYgesBlue := bYgesBlue + bBlue;
bYgesGreen := bYgesGreen + bGreen;
bYgesRed := bYgesRed + bRed;
end;
bYgesBlue := Round(bYgesBlue / 16);
bYgesGreen := Round(bYgesGreen / 16);
bYgesRed := Round(bYgesRed / 16);
bXgesBlue := bXgesBlue + bYgesBlue;
bXgesGreen := bXgesGreen + bYgesGreen;
bXgesRed := bXgesRed + bYgesRed;
end;
bXgesBlue := Round(bXgesBlue / 20);
bXgesGreen := Round(bXgesGreen / 20);
bXgesRed := Round(bXgesRed / 20);
//Werte ausgeben
TrackBar1.Position := bXgesRed;
TrackBar2.Position := bXgesGreen;
TrackBar3.Position := bXgesBlue;
Application.ProcessMessages;
finally
ReleaseDC(0,
Handle);
end;
end;