ar i, j: Integer; row1, row2, rowRGB: pRGBTriple; Width, Height: Integer; begin Width := Bitmap.Width; Height := Bitmap.Height; GetMem(rowRGB, 3); for j := 0 to Height - 1 do begin row1 := Bitmap.ScanLine[j]; row2 := row1; Inc(row2, Width - 1); for i := 0 to (Width div 2) - 1 do begin rowRGB^ := row1^; row1^ := row2^; row2^ := rowRGB^; Inc(row1); Dec(row2); end; end; FreeMem(rowRGB); end;
//垂直翻转 procedure FlipVert(const Bitmap:TBitmap); var i, j: Integer; row1, row2, rowRGB: pRGBTriple; Width, Height: Integer; begin Height := Bitmap.Height; Width := Bitmap.Width; GetMem(rowRGB, Width * 3); for j := 0 to (Height div 2) - 1 do begin row1 := Bitmap.ScanLine[j]; row2 := Bitmap.ScanLine[Height - j -1]; CopyMemory(rowRGB, row1, Width * 3); CopyMemory(row1, row2, Width * 3); CopyMemory(row2, rowRGB, Width * 3); end; FreeMem(rowRGB); end;
上一页 [1] [2] |