type
PRGBArray = ^TRGBArray;
TRGBArray = array[0..MaxPixelCount - 1] of TRGBTriple;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
//b1,b2,b4bytearray;
b1,b2rgbarray;
i,j:integer;
bmp:tbitmap;
begin
bmp:=tbitmap.create;
bmp.width:=image1.Height;
bmp.height:=image1.width;
image1.picture.bitmap.PixelFormat:=pf24bit;
bmp.PixelFormat:=pf24bit;
for j:=0 to image1.height-1 do
begin
b1:=image1.picture.Bitmap.ScanLine[j];
// b2:=bmp.ScanLine[j];
for i:=0 to image1.width-1 do
begin
b2:=bmp.ScanLine;
b2[j]:=b1;
//pRGBArray(bmp.ScanLine[image1.Width - i - 1])[j] := b1;
end;
end;
image1.picture.bitmap:=bmp;
bmp.free
end;
FUNCTION Rotate90(Bitmap:TBitmap): TBitmap;
VAR i,j : INTEGER;
rowIn : pRGBArray;
BEGIN
{ IF Bitmap.PixelFormat <> pf24bit then
exit; }
RESULT := TBitmap.Create;
RESULT.Width := Bitmap.Height;
RESULT.Height := Bitmap.Width;
RESULT.PixelFormat := Bitmap.PixelFormat; // only pf24bit for now
// Out[j, Right - i - 1] = In[i, j]
FOR j := 0 TO Bitmap.Height - 1 DO BEGIN
rowIn := Bitmap.ScanLine[j];
FOR i := 0 TO Bitmap.Width - 1 DO
pRGBArray(RESULT.ScanLine[Bitmap.Width - i - 1])[j] := rowIn
END;
END;
procedure TForm1.Button2Click(Sender: TObject);
begin
image1.picture.bitmap.PixelFormat :=pf24bit;
rotate90(image1.picture.Bitmap);