uses Windows, Graphics;
procedure PrcRotateBitmapRight(PrmBmp1, PrmBmp2: TBitmap);
var
x1, y1, x2, y2: Integer;
p: array[0..2] of TPoint;
begin
x1 := 0;
y1 := 0;
x2 := PrmBmp1.Width;
y2 := PrmBmp1.Height;
PrmBmp2.Width := y2;
PrmBmp2.Height := x2;
p[0].X := y2;
p[0].Y := x1;
p[1].X := y2;
p[1].Y := x2;
p[2].X := y1;
p[2].Y := x1;
PlgBlt(PrmBmp2.Canvas.Handle, p, PrmBmp1.Canvas.Handle, 0, 0, x2, y2, 0, 0, 0);
end;
procedure PrcRotateBitmapLeft(PrmBmp1, PrmBmp2: TBitmap);
var
x1, y1, x2, y2: Integer;
p: array[0..2] of TPoint;
begin
x1 := 0;
y1 := 0;
x2 := PrmBmp1.Width;
y2 := PrmBmp1.Height;
PrmBmp2.Width := y2;
PrmBmp2.Height := x2;
p[0].X := y1;
p[0].Y := x2;
p[1].X := y1;
p[1].Y := x1;
p[2].X := y2;
p[2].Y := x2;
PlgBlt(PrmBmp2.Canvas.Handle, p, PrmBmp1.Canvas.Handle, 0, 0, x2, y2, 0, 0, 0);
end;
procedure PrcFlipBitmapVert(PrmBmp: TBitmap);
var
Bmp: TBitmap;
SourceRect, DestRect: TRect;
begin
Bmp := TBitmap.Create;
try
Bmp.Assign(PrmBmp);
DestRect := Rect(0, 0, PrmBmp.Width, PrmBmp.Height);
SourceRect := Rect(0, PrmBmp.Height - 1, PrmBmp.Width, -1);
PrmBmp.Canvas.CopyRect(DestRect, Bmp.Canvas, SourceRect);
finally
Bmp.Free;
end;
end;
procedure PrcFlipBitmapHorz(PrmBmp: TBitmap);
var
Bmp: TBitmap;
SourceRect, DestRect: TRect;
begin
Bmp := TBitmap.Create;
try
Bmp.Assign(PrmBmp);
DestRect := Rect(0, 0, Bmp.Width, Bmp.Height);
SourceRect := Rect(Bmp.Width - 1, 0, -1, Bmp.Height);
PrmBmp.Canvas.CopyRect(DestRect, Bmp.Canvas, SourceRect);
finally
Bmp.Free;
end;
end;