WPTools FMX - Legacy Rendering (Emulation Layer TWPCanvas)

    • Offizieller Beitrag

    You may have noticed the checkbox "Legacy Rendering" in the WPTools FMX demo.

    If this switch is activated, a special drawing mode is used which supports most features WPTools VCL also support.

    In this mode a special emulation layer is used which translates VCL.Graphics.TCanvas methods to the FMX equivalent. Also some windows GDI commands which require a handle are translated.

    This emulation layer can be very practical for your projects you want to convert from VCL to FMX.

    We use this emulation also to paint the ruler which serves a simple example

    A special class, TWPCanvas (from unit FMX.WPCanvas), is used to host the native FMX canvas and the emulation layer.

    This code create a bitmap, write a text on it and inserts it into WPTools FMX:

    If a TWPCanvas is created for a certain FMX Canvas BeginScene/EndScene is called automatically.

    You can access the FMX Canvas through TWPCanvas.Canvas.