zaimen
zaimen

Reputation: 157

SharpDX DirectWrite rotate text

I wondered how to rotate a text rendered with Direct2D with SharpDX.

Can not find any possiblity in

RenderTarget2D.DrawText()

or

RenderTarget2D.DrawTextLayout()

Upvotes: 0

Views: 1717

Answers (1)

Peter Kostov
Peter Kostov

Reputation: 951

You could use a Transformation Matrix and more precisely - a rotation transformation via a 3x2 matrix.

pseudo example:

RenderTarget2D.BeginDraw;
try
  // your regular drawings
  ....

  // save the current tranform
  currentTransform = RenderTarget2D.GetTransform;

  // set a 90 degree rotation around the (100,100);
  RenderTarget2D.SetTransform(Matrix3x2F.Rotation(90, Point2F(100,100))); 

  // do your rotated text drawings
  RenderTarget2D.DrawText();

  // restore your previous/original transform
  RenderTarget2D.SetTransform(currentTransform);
finally
  RenderTarget2D.EndDraw;
end;

Upvotes: 3

Related Questions