Einzelnen Beitrag anzeigen

Sunec

Registriert seit: 31. Aug 2013
88 Beiträge
 
Delphi XE8 Architect
 
#1

Direct2D / DirectWrite CreateGdiCompatibleTextLayout Implementation

  Alt 18. Jul 2015, 23:01
Delphi-Version: 5
Nabend!

Möchte gerne meine Text in DirectWrite durch ein TextLayout zeichnen.

MS hat dafür eine entsprechende Funktion:
https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

Nachteil dabei ist, dass sie nicht auf aliased Texte reagiert.

Dafür gibt's:
https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

Code:
virtual HRESULT CreateGdiCompatibleTextLayout(
  [in]          const WCHAR            * string,
                       UINT32             stringLength,
                       IDWriteTextFormat * textFormat,
                       FLOAT             layoutWidth,
                       FLOAT             layoutHeight,
                       FLOAT             pixelsPerDip,
  [in, optional] const DWRITE_MATRIX    * transform,
                       BOOL              useGdiNatural,
  [out]               IDWriteTextLayout ** textLayout
) = 0;

In Delphi erwartet das ganze folgende Parameter:
Delphi-Quellcode:
    function CreateGdiCompatibleTextLayout(var _string: WCHAR; stringLength: Cardinal;
      var textFormat: IDWriteTextFormat; layoutWidth: Single; layoutHeight: Single;
      pixelsPerDip: Single; var transform: TDwriteMatrix; useGdiNatural: BOOL;
      out textLayout: IDWriteTextLayout): HResult; stdcall;
Warum muss ich nun den string sowie die transform-Matrix als Referenz übertragen?

Bei CreateTextLayout habe ich keine Probleme.

Sehe ich was Offensichtliches nicht oder ist das falsch implementiert worden?



EDIT:

Sieht so aus als wäre ich nicht der erste dem dies aufgefallen ist:

http://qc.embarcadero.com/wc/qcmain.aspx?d=112581

Dieser ist jedoch geschlossen worden mit der Begründung: "As Designed"

Was soll das?

Geändert von Sunec (18. Jul 2015 um 23:05 Uhr)
  Mit Zitat antworten Zitat