打印本文 打印本文 关闭窗口 关闭窗口
基本图象处理代码(1)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1632  更新时间:2009/4/23 18:39:03  文章录入:mintao  责任编辑:mintao
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] 

打印本文 打印本文 关闭窗口 关闭窗口