TFPCanvas should have coordinate translation routines

Original Reporter info from Mantis: AntonK
  • Reporter name: Anton Kavalenka

Description:

All modern graphic layers like Windows GDI, QT, (not sure about GTK and Carbon) has the coordinate translation functions using matrix arithmetic.
The FPCanvas can have abstraction layer to allow to the programmer Rotate and Translate World.
For example QT Painter has
QPainter::rotate() and Qpainter:translate() either with setting transformation marix routines.

Windows GDI have SetWorldTransform() function

Steps to reproduce:

Nothing, this just feature suggestion.

Additional information:

QT Example drawing rotated text
QPainterH(fCanvas.Handle).translate(X,Y);
QPainterH(fCanvas.Handle).rotate(-gFontAngle);

fCanvas.TextOut(0,0,Buf);

QPainterH(fCanvas.Handle).rotate(gFontAngle);
QPainterH(fCanvas.Handle).translate(-X,-Y);

GDI Example drawing rotated text
const m:TXForm=(0,0,0,0,0,0);
m.eM11:=cos(gFontAngle);
m.eM12:=sin(gFontAngle);
m.eM21:=-m.eM12;
m.eM22:=eM11;
SetWorldTransform(fCanvas.handle,matrix);
fCanvas.TextOut(0,0,Buf);

Anyway even if underlying graphic layer cannot do transformations - there can be generic transformation using matrix multiplication

Mantis conversion info:

  • Mantis ID: 9761
  • Platform: All