{ author: DBR ©2001 (Detlef Brettschneider, germany) } { http://home.pages.at/dbr-software/delphi/ } { dbr.software@freenet.de } unit rotate; interface uses Graphics, SysUtils; type work = (grad90, grad180, grad270, horz, vert); b3 = array[0..2] of byte; var a: array of array of b3; procedure rotate_flip(bmp: tbitmap; art: work); implementation procedure rotate_flip(bmp: tbitmap; art: work); var x, y, h, w, w3: word; p: pbytearray; i: byte; procedure rechnen(b, c: word); var j: byte; begin for j := 0 to 2 do p[x + j] := a[b][c][j]; end; begin bmp.pixelformat := pf24bit; setlength(a, bmp.height); h := bmp.height - 1; for x := 0 to h do setlength(a[x], bmp.width); w3 := bmp.width * 3 - 1; for y := 0 to h do begin p := bmp.scanline[y]; x := 0; while x <= w3 do begin for i := 0 to 2 do a[h - y][x div 3][i] := p[x + i]; inc(x, 3); end; end; if (art = grad90) or (art = grad270) then begin x := bmp.height; bmp.height := bmp.width; bmp.width := x; h := bmp.height - 1; w3 := bmp.width * 3 - 1; end; w := bmp.width - 1; for y := 0 to h do begin p := bmp.scanline[y]; x := 0; while x <= w3 do begin case art of vert: rechnen(y, x div 3); grad90: rechnen(x div 3, y); grad180: rechnen(y, w - x div 3); horz: rechnen(h - y, w - x div 3); else rechnen(w - x div 3, h - y); end; inc(x, 3); end; end; a := nil; end; end. ============================================================= Sorry, but I speak German only. Look at the Attachment. Many greetings DBR // Examples uses rotate; procedure TForm1.Button1Click(Sender: TObject); var bmp:TBitmap; begin bmp:=TBitmap.create; bmp.loadfromfile('d:\bilder\corel044.bmp'); canvas.draw(0,0,bmp); rotate_flip(bmp,horz); { rotate_flip(bmp,horz); rotate_flip(bmp,vert); rotate_flip(bmp,grad90); rotate_flip(bmp,grad180); rotate_flip(bmp,grad270); } canvas.Draw(0,bmp.height,bmp); end; procedure TForm1.Button2Click(Sender: TObject); begin rotate_flip(image1.picture.bitmap,grad90); image1.refresh; end;