AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Bitmap perspektivisch in 3D drehen
Thema durchsuchen
Ansicht
Themen-Optionen

Bitmap perspektivisch in 3D drehen

Ein Thema von Cylence · begonnen am 6. Jun 2007 · letzter Beitrag vom 26. Jan 2009
 
Peter666

Registriert seit: 11. Aug 2007
357 Beiträge
 
#11

Re: Bitmap perspektivisch in 3D drehen

  Alt 12. Aug 2007, 12:29
Hat jemand eine schnelle Lösung für einen PlgBltersatz der die Textur in der z-Achse kleiner werden lässt? Meine Variante baut auf WarpBlt auf:
Delphi-Quellcode:
procedure CopySourceToDest(hdcDst: HDC; ul, ur, lr, ll: TPoint;
  hdcSrc: HDC; x1, y1, x2, y2: LONGINT);
var tm, lm, rm, bm, m: TPoint;
  mx, my: Longint;
  cr: COLORREF;

begin
       // Does the destination area specify a single pixel?
  if ((abs(ul.x - ur.x) < THRESH) and
    (abs(ul.x - lr.x) < THRESH) and
    (abs(ul.x - ll.x) < THRESH) and
    (abs(ul.y - ur.y) < THRESH) and
    (abs(ul.y - lr.y) < THRESH) and
    (abs(ul.y - ll.y) < THRESH)) then
  begin
    cr := GetPixel(hdcSrc, (x1 shr SHIFTS), (y1 shr SHIFTS));
    SetPixel(hdcDst, (ul.x shr SHIFTS), (ul.y shr SHIFTS), cr);
  end else
  begin // No // Quarter the source and the destination, and then recurse.
    tm.x := (ul.x + ur.x) shr 1;
    tm.y := (ul.y + ur.y) shr 1; bm.x := (ll.x + lr.x) shr 1; bm.y := (ll.y + lr.y) shr 1;
    lm.x := (ul.x + ll.x) shr 1; lm.y := (ul.y + ll.y) shr 1; rm.x := (ur.x + lr.x) shr 1;
    rm.y := (ur.y + lr.y) shr 1;
    m.x := (tm.x + bm.x) shr 1; m.y := (tm.y + bm.y) shr 1;
    mx := (x1 + x2) shr 1; my := (y1 + y2) shr 1;
    CopySourceToDest(hdcDst, ul, tm, m, lm, hdcSrc, x1, y1, mx, my);
    CopySourceToDest(hdcDst, tm, ur, rm, m, hdcSrc, mx, y1, x2, my);
    CopySourceToDest(hdcDst, m, rm, lr, bm, hdcSrc, mx, my, x2, y2);
    CopySourceToDest(hdcDst, lm, m, bm, ll, hdcSrc, x1, my, mx, y2);
  end;
end;

procedure WarpBlt(hdcDst: HDC; ul, ur, lr, ll: TPoint; hdcSrc: HDC; x1, y1, x2, y2: Longint);
begin
  ul.x := ul.x shl SHIFTS;
  ul.y := ul.y shl SHIFTS;
  ur.x := ur.x shl SHIFTS;
  ur.y := ur.y shl SHIFTS;

  lr.x := lr.x shl SHIFTS;
  lr.y := lr.y shl SHIFTS;
  ll.x := ll.x shl SHIFTS;
  ll.y := ll.y shl SHIFTS;

  x1 := x1 shl SHIFTS; y1 := y1 shl SHIFTS; x2 := x2 shl SHIFTS; y2 := y2 shl SHIFTS;

  CopySourceToDest(hdcDst, ul, ur, lr, ll, hdcSrc, x1, y1, x2, y2);
end;
und ist zu langsam. Selbst, wenn man GetPixel und Setpixel durch direkte Speicherzugriffe beschleunigt, ist die Geschwindigkeit inakzeptabel

Peter

[edit=SirThornberry]Delphi-Tags gesetzt - Mfg, SirThornberry[/edit]
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:12 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz