画像を水平方向に反転させます。垂直反転と同じくバッファを使用するタイプです。といっても水平方向の反転はピクセル単位で処理しなければならないので、1ピクセル分のバッファで事足ります(^^;
procedure HorzReverse(Source: TBitmap);
var
X, Y, W: Integer;
pLine: PLine24;
Temp: TRGB24;
begin
Source.PixelFormat := pf24bit;
W := Source.Width -1;
for Y := 0 to Source.Height -1 do
begin
pLine := Source.ScanLine[Y];
for X := 0 to W div 2 do
begin
Temp := pLine^[X];
pLine^[X] := pLine^[W-X];
pLine^[W-X] := Temp;
end;
end;
if Assigned(Source.OnChange) then
Source.OnChange(Source);
end;
|