Einzelnen Beitrag anzeigen

Peter666

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

Firemonkey Bild Perspektivisch zeichnen

  Alt 7. Mai 2016, 12:42
Hi,

ich hab mal ne Frage bezüglich folgendem Problem. Ich würde gerne ein Bild perspektivisch in ein anderes Zeichnen.

Zu dem Bild hab ich noch folgende Rahmeninformation:

untenlinks=0.186, 0.04
untenrechts=1.0, 0.0
obenlinks=0.0, 0.995
obenrechts=0.823, 0.733
bereich=0.067, 0.2275, 0.457, 0.6655

Delphi-Quellcode:
procedure TfrmPromoter.FormCreate(Sender: TObject);
var
  bottomLeft: TPointF;
  bottomRight: TPointF;
  dropZone: TRectF;
  topLeft: TPointF;
  topRight: TPointF;
  content: TSizeF;
  Poly: TPolygon;

  function RealPoint(P: TPointF): TPointF;
  var
    w, h: integer;
  begin
    w := Image1.Bitmap.Width;
    h := Image1.Bitmap.Height;
    result := PointF(w * P.x, h * (1 - P.y));
  end;

  function RealRect(R: TRectF): TRectF;
  var
    P1, P2: TPointF;
  begin
    P1 := RealPoint(PointF(R.Left, R.Top));
    P2 := RealPoint(PointF(R.Right, R.Bottom));
    result := rectf(P1.x, P1.y, P2.x, P2.y);
  end;

begin
  bottomLeft := PointF(0.186, 0.04);
  bottomRight := PointF(1.0, 0.0);
  dropZone := rectf(0.067, 0.2275, 0.457, 0.6655);
  topLeft := PointF(0.0, 0.995);
  topRight := PointF(0.823, 0.733);

  content.cx := 640;
  content.cy := 1136;

  setlength(Poly, 4);
  Poly[0] := RealPoint(topLeft);
  Poly[1] := RealPoint(topRight);
  Poly[2] := RealPoint(bottomRight);
  Poly[3] := RealPoint(bottomLeft);

  with Image1.Bitmap do
  begin
    Canvas.BeginScene;
    Canvas.Fill.Color := $FFFF0000;
    Canvas.FillPolygon(Poly, 1);

    Canvas.Fill.Color := $FFFF000FF;
    Canvas.FillRect(RealRect(dropZone), 0, 0, [], 1);
    Canvas.EndScene;
  end;
end;
und damit möchte ich ein Screenshot in das virtuelle Laptopdisplay zeichnen.

Peter
Miniaturansicht angehängter Grafiken
mac.jpg  

Geändert von Peter666 ( 7. Mai 2016 um 13:18 Uhr)
  Mit Zitat antworten Zitat