AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia GdiPlus DrawImage mit PointArray not implemented?
Thema durchsuchen
Ansicht
Themen-Optionen

GdiPlus DrawImage mit PointArray not implemented?

Ein Thema von CTest · begonnen am 15. Dez 2013
Antwort Antwort
CTest

Registriert seit: 13. Apr 2010
Ort: Gehren
33 Beiträge
 
#1

GdiPlus DrawImage mit PointArray not implemented?

  Alt 15. Dez 2013, 13:58
Hallo,

Habe vorhin diesen Beitrag gefunden zur Bildertransformation.
Das Beispiel mit der Rotation funktioniert auch.

Ich wollte jetzt das Bild zu einem Trapez transformieren, mit dem Graphics32-Package habe ich das schon versucht, das Ergebnis ohne Interpolation reicht mir aber nicht.

hab mich an das Beispiel gehalten, DrawImage liefert aber Status not Implemented.

Delphi-Quellcode:
procedure RotateBitmap(Bmp: TBitmap; Degs: Integer; AdjustSize: Boolean;
  BkColor: TColor = clNone);
var
  Tmp: TGPBitmap;
  Matrix: TGPMatrix;
// C: Single;
// S: Single;
// NewSize: TSize;
  Graphs: TGPGraphics;
  Pnts: Array of TGPPointF;
  PPnts : PGPPointF;

  status : TStatus;
begin
  Tmp := TGPBitmap.Create(Bmp.Handle, Bmp.Palette);
  Matrix := TGPMatrix.Create;
  try
    Matrix.RotateAt(Degs, MakePoint(0.5 * Bmp.Width, 0.5 * Bmp.Height));
// if AdjustSize then
// begin
// C := Cos(DegToRad(Degs));
// S := Sin(DegToRad(Degs));
// NewSize.cx := Round(Bmp.Width * Abs(C) + Bmp.Height * Abs(S));
// NewSize.cy := Round(Bmp.Width * Abs(S) + Bmp.Height * Abs(C));
// Bmp.Width := NewSize.cx;
// Bmp.Height := NewSize.cy;
// end;
    Graphs := TGPGraphics.Create(Bmp.Canvas.Handle);
    try
      Graphs.Clear(ColorRefToARGB(ColorToRGB(BkColor)));
      SetLength(Pnts, 4);
      Pnts[0].X := 48;
      Pnts[0].Y := 0;
      Pnts[1].X := Bmp.Width-5;
      Pnts[1].Y := 43;
      Pnts[2].X := Bmp.Width-103;
      Pnts[2].Y := Bmp.Height+37;
      Pnts[3].X := 4;
      Pnts[3].Y := Bmp.Height-29;
      Graphs.SetInterpolationMode(InterpolationModeHighQuality);
      PPnts := @Pnts[0];

      status := Graphs.DrawImage(Tmp, PPnts, 4);
      if status <> Ok then
        showmessage('kaputt');
// Graphs.DrawImage(Tmp, PPnts, 4, 0, 0, 200, 200, UnitPixel);

// Graphs.SetTransform(Matrix);
// status := Graphs.DrawImage(Tmp, (Cardinal(Bmp.Width) - Tmp.GetWidth) div 2,
// (Cardinal(Bmp.Height) - Tmp.GetHeight) div 2);
    finally
      Graphs.Free;
    end;
  finally
    Matrix.Free;
    Tmp.Free;
  end;
end;
Hier hat jemand das gleiche Problem in C#, die Antwort hilft mir aber nicht weiter.
  Mit Zitat antworten Zitat
Antwort Antwort

 

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 13:22 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