Windows Preview Handler using FMX drawing functions?

  

I have created an FMX graphics application that draws various graphics from a custom binary vector file format. I’d now like to create a Windows Preview Handler to support that file format. I have already created a basic VCL preview handler based on the code found here. Some minor fixes were needed to get it to build in Delphi 10.4. I have also added a TPaintBox that I can draw to using the VCL TCanvas drawing functions.
The problem is that all the drawing for my file format is using FMX and uses several functions that don’t exist in VCL, such as colour gradients and opacity. Is it possible to somehow mix in FMX TCanvas code for the preview handler?
If not then I have another option, but I’m not sure how well it would work. I would add functionality to the FMX application such that executing it with the appropriate input parameters (file path and dimensions) would generate an image file. The preview handler would just need to call it and load the image to display it. This would mean that the preview handler could be VCL only and would also reduce code size by not replicating the drawing code, but there may be latency issues.
I could also potentially use GDI+ or Direct2D in a VCL application since it would also support the advanced drawing functions, but it would mean rewriting all the drawing functions and I’m not sure if it would look exactly the same.
Any ideas are welcome. Thanks.

Comments are closed.