//橫向翻轉
var
g: TGPGraphics;
bit1,bit2: TGPBitmap;
row,column,width,height: Integer;
color: TGPColor;
begin
g := TGPGraphics.Create(Canvas.Handle);
bit1 := TGPBitmap.Create('c:\temp\x.jpg');
width := bit1.GetWidth;
height := bit1.GetHeight;
bit2 := TGPBitmap.Create(width, height);
for row := 0 to height - 1 do
begin
for column := 0 to width - 1 do
begin
bit1.GetPixel(column, row, color);
bit2.SetPixel(width-column, row, color); {width-column}
end;
end;
g.DrawImage(bit1, 0, 0, width, height);
g.DrawImage(bit2, width, 0, width, height);
bit1.Free;
bit2.Free;
g.Free;
end;
//縱向翻轉
var
g: TGPGraphics;
bit1,bit2: TGPBitmap;
row,column,width,height: Integer;
color: TGPColor;
begin
g := TGPGraphics.Create(Canvas.Handle);
bit1 := TGPBitmap.Create('c:\temp\x.jpg');
width := bit1.GetWidth;
height := bit1.GetHeight;
bit2 := TGPBitmap.Create(width, height);
for row := 0 to height - 1 do
begin
for column := 0 to width - 1 do
begin
bit1.GetPixel(column, row, color);
bit2.SetPixel(column, height-row, color); {height-row}
end;
end;
g.DrawImage(bit1, 0, 0, width, height);
g.DrawImage(bit2, width, 0, width, height);
bit1.Free;
bit2.Free;
g.Free;
end;