Einzelnen Beitrag anzeigen

Benutzerbild von illegal eagle
illegal eagle

Registriert seit: 15. Jan 2003
Ort: Jena
10 Beiträge
 
Delphi 5 Standard
 
#2
  Alt 15. Jan 2003, 20:52
Hi!

Für 180° (oben nach unten umdrehen) sollte folgender Code gehen: (nicht getestet)

Delphi-Quellcode:
Procedure Turn180(Bitmap : tBitmap);
Type tLine : Array[0..$FFFF] of Byte;
Var LineWidth, y : Integer;
        Line : ^tLine;
Begin
LineWidth := Bitmap.Width;
Case Bitmap.PixelFormat of
        pf1Bit : LineWidth := LineWidth SHR 3;
        pf4Bit : LineWidth := LineWidth SHR 1;
        pf16Bit : LineWidth := LineWidth SHL 1;
        pf24Bit : LineWidth := LineWidth * 3;
        pf32Bit : LineWidth := LineWidth SHL 2;
End;
GetMem(Line, LineWidth);
For y := 0 to ((Bitmap.Height - 1) div 2) do Begin
        Move(Bitmap.ScanLine[Bitmap.Height - 1 - y]^, Line[0], LineWidth;
        Move(Bitmap.ScanLine[y]^, Bitmap.ScanLine[Bitmap.Height - 1 - y]^, LineWidth;
        Move(Line[0], Bitmap.ScanLine[y]^, LineWidth;
End;
FreeMem(Line, LineWidth);
End;
Für 90° und 270° mußt du ein neues (temporäres) Bitmap erstellen, weil sich ja wahrscheinlich die Abmessungen ändern werden.
  Mit Zitat antworten Zitat